qqwjq1981 commited on
Commit
8ed8cba
·
verified ·
1 Parent(s): 3424ae2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -97,12 +97,14 @@ def add_transcript_to_video(video_path, translated_json, output_path):
97
  logger.debug("Full translated_json: %s", translated_json)
98
  for entry in translated_json:
99
  logger.debug("Processing entry: %s", entry)
100
-
 
 
101
  for entry in translated_json:
102
  # Ensure `entry` is a dictionary with keys "start", "end", and "translated"
103
  if isinstance(entry, dict) and "translated" in entry:
104
  txt_clip = TextClip(
105
- text=entry["translated"], font='Arial', method='caption', color='white', bg_color='black', size=video.size
106
  ).set_start(entry["start"]).set_duration(entry["end"] - entry["start"]).set_position(('bottom')).set_opacity(0.7)
107
  text_clips.append(txt_clip)
108
  else:
 
97
  logger.debug("Full translated_json: %s", translated_json)
98
  for entry in translated_json:
99
  logger.debug("Processing entry: %s", entry)
100
+
101
+ font_path = "./NotoSansSC-Regular.ttf"
102
+
103
  for entry in translated_json:
104
  # Ensure `entry` is a dictionary with keys "start", "end", and "translated"
105
  if isinstance(entry, dict) and "translated" in entry:
106
  txt_clip = TextClip(
107
+ text=entry["translated"], font=font_path, method='caption', color='white', bg_color='black', size=video.size
108
  ).set_start(entry["start"]).set_duration(entry["end"] - entry["start"]).set_position(('bottom')).set_opacity(0.7)
109
  text_clips.append(txt_clip)
110
  else: