Spaces:
Sleeping
Sleeping
Update app.py
Browse filesAdd Milliseconds to Timestamps
app.py
CHANGED
@@ -129,11 +129,11 @@ def download_video():
|
|
129 |
# Function to generate subtitle text
|
130 |
generator = lambda txt: TextClip(txt, font='Arial', fontsize=24, color='white')
|
131 |
|
132 |
-
# Generate subtitles (
|
133 |
subs = []
|
134 |
-
subtitle_length = 5 # seconds each subtitle will be displayed
|
135 |
for i in range(0, len(translated_subtitle), 50):
|
136 |
-
start_time = (i // 50) * subtitle_length
|
137 |
subtitle_text = translated_subtitle[i:i + 50] # Get the next 50 characters
|
138 |
subs.append((start_time, subtitle_text)) # Create a tuple for start time and text
|
139 |
|
|
|
129 |
# Function to generate subtitle text
|
130 |
generator = lambda txt: TextClip(txt, font='Arial', fontsize=24, color='white')
|
131 |
|
132 |
+
# Generate subtitles (each subtitle will last for 2.5 seconds with millisecond precision)
|
133 |
subs = []
|
134 |
+
subtitle_length = 2.5 # seconds each subtitle will be displayed
|
135 |
for i in range(0, len(translated_subtitle), 50):
|
136 |
+
start_time = (i // 50) * subtitle_length # Get start time with more precision
|
137 |
subtitle_text = translated_subtitle[i:i + 50] # Get the next 50 characters
|
138 |
subs.append((start_time, subtitle_text)) # Create a tuple for start time and text
|
139 |
|