Skip to content

Commit 48bec36

Browse files
committed
fail gracefully when ffmpey does not exists for video/audio mixing
Signed-off-by: Tin Lai <[email protected]>
1 parent 2601583 commit 48bec36

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

echo360/videos.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,18 @@ def combine_audio_video(audio_file, video_file, final_file):
382382
_inputs[video_file] = None
383383
if audio_file is not None:
384384
_inputs[audio_file] = None
385-
ff = ffmpy.FFmpeg(
386-
global_options="-loglevel panic",
387-
inputs=_inputs,
388-
outputs={final_file: ["-c:v", "copy", "-c:a", "ac3"]},
389-
)
390-
ff.run()
385+
try:
386+
ff = ffmpy.FFmpeg(
387+
global_options="-loglevel panic",
388+
inputs=_inputs,
389+
outputs={final_file: ["-c:v", "copy", "-c:a", "ac3"]},
390+
)
391+
ff.run()
392+
except ffmpy.FFExecutableNotFoundError:
393+
print('[WARN] Skipping mixing of audio/video because "ffmpeg" not installed.')
394+
except ffmpy.FFRuntimeError:
395+
print("[Error] Skipping mixing of audio/video because ffmpeg exited with non-zero status code.")
396+
391397

392398
def _loop_find_m3u8_url(self, video_url, waitsecond=15, max_attempts=5):
393399
def brute_force_get_url(suffix):

0 commit comments

Comments
 (0)