Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -88,16 +88,18 @@ def convert_video(video_file, quality, aspect_ratio, video_url, api_key, upload)
|
|
88 |
"-vf", f"scale={scale},setsar={aspect_ratio}", "-hls_time", "6",
|
89 |
"-hls_playlist_type", "vod", "-f", "hls", str(output_path)
|
90 |
]
|
91 |
-
|
92 |
try:
|
93 |
-
|
94 |
-
|
95 |
-
except subprocess.CalledProcessError:
|
96 |
logging.exception("ffmpeg command failed.")
|
97 |
error_file_path = tempfile.gettempdir() + "/error.txt"
|
98 |
with open(error_file_path, 'w') as error_file:
|
99 |
-
error_file.write("ffmpeg command failed.")
|
|
|
|
|
100 |
return error_file_path
|
|
|
101 |
except subprocess.TimeoutExpired:
|
102 |
logging.exception("ffmpeg command timed out.")
|
103 |
return "ffmpeg command timed out."
|
|
|
88 |
"-vf", f"scale={scale},setsar={aspect_ratio}", "-hls_time", "6",
|
89 |
"-hls_playlist_type", "vod", "-f", "hls", str(output_path)
|
90 |
]
|
91 |
+
|
92 |
try:
|
93 |
+
result = subprocess.run(ffmpeg_command, check=True, timeout=600, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
94 |
+
except subprocess.CalledProcessError as e:
|
|
|
95 |
logging.exception("ffmpeg command failed.")
|
96 |
error_file_path = tempfile.gettempdir() + "/error.txt"
|
97 |
with open(error_file_path, 'w') as error_file:
|
98 |
+
error_file.write("ffmpeg command failed. Output was:\n\n")
|
99 |
+
error_file.write(e.stdout.decode())
|
100 |
+
error_file.write(e.stderr.decode())
|
101 |
return error_file_path
|
102 |
+
|
103 |
except subprocess.TimeoutExpired:
|
104 |
logging.exception("ffmpeg command timed out.")
|
105 |
return "ffmpeg command timed out."
|