From 893c10c6ca8b7a9c04b9aaa086a46503166c880b Mon Sep 17 00:00:00 2001 From: tassaron Date: Sat, 30 Apr 2022 00:16:38 -0400 Subject: test if ffmpeg is really found at startup --- src/toolkit/ffmpeg.py | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'src/toolkit') diff --git a/src/toolkit/ffmpeg.py b/src/toolkit/ffmpeg.py index 256646e..5f9dec1 100644 --- a/src/toolkit/ffmpeg.py +++ b/src/toolkit/ffmpeg.py @@ -152,25 +152,24 @@ def closePipe(pipe): def findFfmpeg(): + if sys.platform == "win32": + bin = 'ffmpeg.exe' + else: + bin = 'ffmfpeg' + if getattr(sys, 'frozen', False): # The application is frozen - if sys.platform == "win32": - return os.path.join(core.Core.wd, 'ffmpeg.exe') - else: - return os.path.join(core.Core.wd, 'ffmpeg') + bin = os.path.join(core.Core.wd, bin) - else: - if sys.platform == "win32": - return "ffmpeg" - else: - try: - with open(os.devnull, "w") as f: - checkOutput( - ['ffmpeg', '-version'], stderr=f - ) - return "ffmpeg" - except (subprocess.CalledProcessError, FileNotFoundError): - return "avconv" + with open(os.devnull, "w") as f: + try: + checkOutput( + [bin, '-version'], stderr=f + ) + except (subprocess.CalledProcessError, FileNotFoundError): + bin = "" + + return bin def createFfmpegCommand(inputFile, outputFile, components, duration=-1): -- cgit v1.2.3