artificialguybr commited on
Commit
9fd2740
·
1 Parent(s): f7fa4ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -53,7 +53,7 @@ def process_video(Video, target_language):
53
  f.write(f"{segment.text}\n\n")
54
  counter += 1
55
  flores_code = lang_codes.get(target_language, "eng_Latn")
56
- translated_file = f"{uuid.uuid4()}.srt"
57
  with open(transcript_file, "r", encoding="utf-8") as infile, open(translated_file, "w", encoding="utf-8") as outfile:
58
  for line in infile:
59
  if line.strip().isnumeric() or "-->" in line:
@@ -69,6 +69,10 @@ def process_video(Video, target_language):
69
  output_video = "output_video.mp4"
70
  # Debugging: Validate FFmpeg command for subtitle embedding
71
  print("Validating FFmpeg command for subtitle embedding...")
 
 
 
 
72
  try:
73
  result = subprocess.run(["ffmpeg", "-i", Video, "-vf", f"subtitles={translated_file}", output_video], capture_output=True, text=True)
74
  if result.returncode == 0:
 
53
  f.write(f"{segment.text}\n\n")
54
  counter += 1
55
  flores_code = lang_codes.get(target_language, "eng_Latn")
56
+ translated_file = f"{uuid.uuid4()}.srt"
57
  with open(transcript_file, "r", encoding="utf-8") as infile, open(translated_file, "w", encoding="utf-8") as outfile:
58
  for line in infile:
59
  if line.strip().isnumeric() or "-->" in line:
 
69
  output_video = "output_video.mp4"
70
  # Debugging: Validate FFmpeg command for subtitle embedding
71
  print("Validating FFmpeg command for subtitle embedding...")
72
+ print(f"Translated SRT file: {translated_file}")
73
+ with open(translated_file, 'r', encoding='utf-8') as f:
74
+ print(f"First few lines of translated SRT: {f.readlines()[:10]}")
75
+
76
  try:
77
  result = subprocess.run(["ffmpeg", "-i", Video, "-vf", f"subtitles={translated_file}", output_video], capture_output=True, text=True)
78
  if result.returncode == 0: