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")
logging.debug("Falling back to full decode to find duration: %s % filename")
- ffmpeg = find_ffmpeg()
cmd = [
- ffmpeg,
+ "ffmpeg",
"-i", filename,
"-vn",
"-f", "null", "-",
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",