Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -96,20 +96,21 @@ def convert_video(video_file, quality, aspect_ratio, video_url):
|
|
96 |
|
97 |
try:
|
98 |
subprocess.run(ffmpeg_command, shell=True, timeout=600)
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
114 |
|
115 |
gr.Interface(convert_video, inputs=[video_file, quality, aspect_ratio, video_url], outputs='file').launch()
|
|
|
96 |
|
97 |
try:
|
98 |
subprocess.run(ffmpeg_command, shell=True, timeout=600)
|
99 |
+
|
100 |
+
except subprocess.TimeoutExpired:
|
101 |
+
print("ffmpeg timed out")
|
102 |
+
return "ffmpeg command timed out."
|
103 |
+
except FileNotFoundError:
|
104 |
+
print("ffmpeg is not installed.")
|
105 |
+
return "ffmpeg is not installed."
|
106 |
+
|
107 |
+
for i in range(10):
|
108 |
+
if os.path.exists(output_path):
|
109 |
+
break
|
110 |
+
else:
|
111 |
+
time.sleep(1)
|
112 |
+
|
113 |
+
# The file has now been converted, so we can display it in the output viewer
|
114 |
+
return output_path
|
115 |
|
116 |
gr.Interface(convert_video, inputs=[video_file, quality, aspect_ratio, video_url], outputs='file').launch()
|