aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortassaron2022-04-21 01:05:55 -0400
committertassaron2022-04-21 01:05:55 -0400
commit1c9f5e4ae685a957a29100e7ade1ac365149c218 (patch)
tree80d51ddb665cc5db9b145aa6e4aff5fe5acb45af
parenta0291e3fcde739355669e0ca40487f0eb8ee82e4 (diff)
fix crash if ffmpeg is not installed (tested on windows 11)
-rw-r--r--src/toolkit/ffmpeg.py3
-rw-r--r--src/video_thread.py12
2 files changed, 12 insertions, 3 deletions
diff --git a/src/toolkit/ffmpeg.py b/src/toolkit/ffmpeg.py
index 0a536bc..3f083ba 100644
--- a/src/toolkit/ffmpeg.py
+++ b/src/toolkit/ffmpeg.py
@@ -383,6 +383,9 @@ def getAudioDuration(filename):
fileInfo = checkOutput(command, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as ex:
fileInfo = ex.output
+ except FileNotFoundError:
+ # ffmpeg is possibly not installed
+ return False
try:
info = fileInfo.decode("utf-8").split('\n')
diff --git a/src/video_thread.py b/src/video_thread.py
index 91ebe93..4a07fb2 100644
--- a/src/video_thread.py
+++ b/src/video_thread.py
@@ -244,9 +244,15 @@ class Worker(QtCore.QObject):
)
self.staticComponents[compNo] = None
- ffmpegCommand = createFfmpegCommand(
- self.inputFile, self.outputFile, self.components, duration
- )
+ try:
+ ffmpegCommand = createFfmpegCommand(
+ self.inputFile, self.outputFile, self.components, duration
+ )
+ except sp.CalledProcessError as e:
+ self.components[0]._error.emit("Ffmpeg could not be found. Is it installed?", str(e))
+ self.cancelExport()
+ return
+
cmd = " ".join(ffmpegCommand)
print('###### FFMPEG COMMAND ######\n%s' % cmd)
print('############################')