Spaces:
Paused
Paused
Commit
·
f7fa4ee
1
Parent(s):
159a568
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,6 +9,7 @@ import ffmpeg
|
|
| 9 |
from zipfile import ZipFile
|
| 10 |
import stat
|
| 11 |
import uuid
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
ZipFile("ffmpeg.zip").extractall()
|
|
@@ -69,12 +70,13 @@ def process_video(Video, target_language):
|
|
| 69 |
# Debugging: Validate FFmpeg command for subtitle embedding
|
| 70 |
print("Validating FFmpeg command for subtitle embedding...")
|
| 71 |
try:
|
| 72 |
-
|
| 73 |
-
result = run(["ffmpeg", "-i", Video, "-vf", f"subtitles={translated_file}", output_video])
|
| 74 |
if result.returncode == 0:
|
| 75 |
print("FFmpeg executed successfully.")
|
| 76 |
else:
|
| 77 |
print(f"FFmpeg failed with return code {result.returncode}.")
|
|
|
|
|
|
|
| 78 |
except Exception as e:
|
| 79 |
print(f"Exception occurred: {e}")
|
| 80 |
print("process_video concluído com sucesso")
|
|
|
|
| 9 |
from zipfile import ZipFile
|
| 10 |
import stat
|
| 11 |
import uuid
|
| 12 |
+
import subprocess
|
| 13 |
|
| 14 |
|
| 15 |
ZipFile("ffmpeg.zip").extractall()
|
|
|
|
| 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:
|
| 75 |
print("FFmpeg executed successfully.")
|
| 76 |
else:
|
| 77 |
print(f"FFmpeg failed with return code {result.returncode}.")
|
| 78 |
+
print("Stdout:", result.stdout)
|
| 79 |
+
print("Stderr:", result.stderr)
|
| 80 |
except Exception as e:
|
| 81 |
print(f"Exception occurred: {e}")
|
| 82 |
print("process_video concluído com sucesso")
|