]> code.delx.au - webdl/commitdiff
Only support ffmpeg
authorJames Bunton <jamesbunton@delx.net.au>
Sun, 4 Jun 2023 14:05:47 +0000 (00:05 +1000)
committerJames Bunton <jamesbunton@delx.net.au>
Sun, 4 Jun 2023 14:05:47 +0000 (00:05 +1000)
Also fixes #124, thanks MarkJ

common.py

index d126d133e57d22634e0a6583f39898eaaa60b1ce..951dfa342b885de72761e559b17692d49f2f81a6 100644 (file)
--- a/common.py
+++ b/common.py
@@ -152,33 +152,13 @@ def check_command_exists(cmd):
     except Exception:
         return False
 
-def find_ffmpeg():
-    if check_command_exists(["ffmpeg", "--help"]):
-        return "ffmpeg"
-
-    if check_command_exists(["avconv", "--help"]):
-        logging.warn("Detected libav-tools! ffmpeg is recommended")
-        return "avconv"
-
-    raise Exception("You must install ffmpeg or libav-tools")
-
-def find_ffprobe():
-    if check_command_exists(["ffprobe", "--help"]):
-        return "ffprobe"
-
-    if check_command_exists(["avprobe", "--help"]):
-        logging.warn("Detected libav-tools! ffmpeg is recommended")
-        return "avprobe"
-
-    raise Exception("You must install ffmpeg or libav-tools")
-
 def get_duration(filename):
     ffprobe = find_ffprobe()
 
     cmd = [
-        ffprobe,
+        "ffprobe",
         filename,
-        "-show_format_entry", "duration",
+        "-show_entries", "format=duration",
         "-v", "quiet",
     ]
     output = subprocess.check_output(cmd).decode("utf-8")
@@ -193,9 +173,8 @@ def get_duration(filename):
 
     logging.debug("Falling back to full decode to find duration: %s % filename")
 
-    ffmpeg = find_ffmpeg()
     cmd = [
-        ffmpeg,
+        "ffmpeg",
         "-i", filename,
         "-vn",
         "-f", "null", "-",
@@ -231,9 +210,8 @@ def check_video_durations(flv_filename, mp4_filename):
 def remux(infile, outfile):
     logging.info("Converting %s to mp4", infile)
 
-    ffmpeg = find_ffmpeg()
     cmd = [
-        ffmpeg,
+        "ffmpeg",
         "-i", infile,
         "-bsf:a", "aac_adtstoasc",
         "-acodec", "copy",