From 56d2c4aa5fea506abb15d71b53aea23b9dd3398b Mon Sep 17 00:00:00 2001 From: tguinot Date: Mon, 10 Feb 2020 03:31:07 +0100 Subject: Add which pathfinding for executables --- libmat2/video.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'libmat2/video.py') diff --git a/libmat2/video.py b/libmat2/video.py index 2b33bc0..b4a3232 100644 --- a/libmat2/video.py +++ b/libmat2/video.py @@ -1,6 +1,6 @@ import subprocess import functools -import os +import shutil import logging from typing import Dict, Union @@ -137,9 +137,8 @@ class MP4Parser(AbstractFFmpegParser): @functools.lru_cache() def _get_ffmpeg_path() -> str: # pragma: no cover - ffmpeg_path = '/usr/bin/ffmpeg' - if os.path.isfile(ffmpeg_path): - if os.access(ffmpeg_path, os.X_OK): - return ffmpeg_path + which_path = shutil.which('ffmpeg') + if which_path: + return which_path raise RuntimeError("Unable to find ffmpeg") -- cgit v1.3