Commit 3656d30c authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Read ffprobe and ffmpeg path from env

parent 54f6eca7
Pipeline #44386 passed with stages
in 1 minute and 29 seconds
......@@ -18,7 +18,8 @@ def is_mkv(input_path):
def fix_mp4(input_path):
backup_path = input_path + '.bak'
os.rename(input_path, backup_path)
cmd = f"ffmpeg -i {backup_path} -vcodec copy -acodec copy {input_path}"
ffmpeg_path = os.environ.get('FFMPEG_PATH') or 'ffmpeg'
cmd = f"{ffmpeg_path} -i {backup_path} -vcodec copy -acodec copy {input_path}"
status, output = subprocess.getstatusoutput(cmd)
if status == 0:
os.remove(backup_path)
......
......@@ -44,7 +44,8 @@ def _decode(o):
def run_ffprobe(options, silent=False):
cmd = f"ffprobe -v quiet -print_format json {options}"
ffprobe_path = os.environ.get('FFPROBE_PATH') or 'ffprobe'
cmd = f"{ffprobe_path} -v quiet -print_format json {options}"
logging.debug(cmd)
status, output = subprocess.getstatusoutput(cmd)
if status != 0:
......
......@@ -104,10 +104,11 @@ class MediaChecker:
if logs_dir:
os.makedirs(logs_dir, exist_ok=True)
deep_log = os.path.join(logs_dir, deep_log)
ffmpeg_path = os.environ.get('FFMPEG_PATH') or 'ffmpeg'
if self.options.max_duration:
cmd = f'ffmpeg -v error -i "{path}" -max_muxing_queue_size 4096 -t {self.options.max_duration} -f null - >"{deep_log}" 2>&1'
cmd = f'{ffmpeg_path} -v error -i "{path}" -max_muxing_queue_size 4096 -t {self.options.max_duration} -f null - >"{deep_log}" 2>&1'
else:
cmd = f'ffmpeg -v error -i "{path}" -max_muxing_queue_size 4096 -f null - >"{deep_log}" 2>&1'
cmd = f'{ffmpeg_path} -v error -i "{path}" -max_muxing_queue_size 4096 -f null - >"{deep_log}" 2>&1'
logging.debug(f'Running {cmd}')
status, output = subprocess.getstatusoutput(cmd)
if os.path.getsize(deep_log) and os.path.getsize(deep_log) > 0:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment