younes21000 commited on
Commit
541c194
·
verified ·
1 Parent(s): cf20236

Update app.py

Browse files

Add Milliseconds to Timestamps

Files changed (1) hide show
  1. app.py +3 -3
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 (assuming each subtitle appears for 5 seconds)
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