qqwjq1981 commited on
Commit
936bad0
·
verified ·
1 Parent(s): b31c13c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -223,7 +223,7 @@ def update_translations(file, edited_table, mode):
223
  except Exception as e:
224
  raise ValueError(f"Error updating translations: {e}")
225
 
226
- def process_entry(entry, i, add_voiceover, target_language):
227
  logger.debug(f"Processing entry {i}: {entry}")
228
 
229
  # Create text clip for subtitles
@@ -234,8 +234,8 @@ def process_entry(entry, i, add_voiceover, target_language):
234
  color='yellow',
235
  stroke_color='black', # Border color
236
  stroke_width=2, # Border thickness
237
- font_size=int(video.h // 20),
238
- size=(int(video.w * 0.8), None)
239
  ).with_start(entry["start"]).with_duration(entry["end"] - entry["start"]).with_position(('bottom')).with_opacity(0.8)
240
 
241
  audio_segment = None
@@ -257,7 +257,7 @@ def add_transcript_voiceover(video_path, translated_json, output_path, add_voice
257
  audio_segments = []
258
 
259
  with concurrent.futures.ThreadPoolExecutor() as executor:
260
- futures = [executor.submit(process_entry, entry, i, video.w, video.h, font_path, add_voiceover, target_language)
261
  for i, entry in enumerate(translated_json)]
262
 
263
  for future in concurrent.futures.as_completed(futures):
 
223
  except Exception as e:
224
  raise ValueError(f"Error updating translations: {e}")
225
 
226
+ def process_entry(entry, i, video_width, video_height, add_voiceover, target_language):
227
  logger.debug(f"Processing entry {i}: {entry}")
228
 
229
  # Create text clip for subtitles
 
234
  color='yellow',
235
  stroke_color='black', # Border color
236
  stroke_width=2, # Border thickness
237
+ font_size=int(video_height // 20),
238
+ size=(int(video_width * 0.8), None)
239
  ).with_start(entry["start"]).with_duration(entry["end"] - entry["start"]).with_position(('bottom')).with_opacity(0.8)
240
 
241
  audio_segment = None
 
257
  audio_segments = []
258
 
259
  with concurrent.futures.ThreadPoolExecutor() as executor:
260
+ futures = [executor.submit(process_entry, entry, i, video.w, video.h, add_voiceover, target_language)
261
  for i, entry in enumerate(translated_json)]
262
 
263
  for future in concurrent.futures.as_completed(futures):