Spaces:
Paused
Paused
Commit ·
fdbd781
1
Parent(s): 9fd2740
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,9 +72,13 @@ def process_video(Video, target_language):
|
|
| 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 |
-
|
|
|
|
| 78 |
if result.returncode == 0:
|
| 79 |
print("FFmpeg executed successfully.")
|
| 80 |
else:
|
|
|
|
| 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 |
+
if os.path.exists(translated_file):
|
| 76 |
+
print(f"{translated_file} exists.")
|
| 77 |
+
else:
|
| 78 |
+
print(f"{translated_file} does not exist.")
|
| 79 |
try:
|
| 80 |
+
translated_file_abs_path = os.path.abspath(translated_file)
|
| 81 |
+
result = subprocess.run(["ffmpeg", "-i", Video, "-vf", f"subtitles={translated_file_abs_path}", output_video], capture_output=True, text=True)
|
| 82 |
if result.returncode == 0:
|
| 83 |
print("FFmpeg executed successfully.")
|
| 84 |
else:
|