aboutsummaryrefslogtreecommitdiff
path: root/src/toolkit/ffmpeg.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/toolkit/ffmpeg.py')
-rw-r--r--src/toolkit/ffmpeg.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/toolkit/ffmpeg.py b/src/toolkit/ffmpeg.py
index 89d4e9d..cc59a6c 100644
--- a/src/toolkit/ffmpeg.py
+++ b/src/toolkit/ffmpeg.py
@@ -113,7 +113,7 @@ def createFfmpegCommand(inputFile, outputFile, components, duration=-1):
'-t', safeDuration,
# Tell ffmpeg about shorter clips (seemingly not needed)
# streamDuration = getAudioDuration(extraInputFile)
- # if streamDuration > float(safeDuration)
+ # if streamDuration and streamDuration > float(safeDuration)
# else "{0:.3f}".format(streamDuration),
'-i', extraInputFile
])
@@ -228,11 +228,18 @@ def getAudioDuration(filename):
d = d.split(' ')[3]
d = d.split(':')
duration = float(d[0])*3600 + float(d[1])*60 + float(d[2])
+ break
+ else:
+ # String not found in output
+ return False
return duration
def readAudioFile(filename, parent):
duration = getAudioDuration(filename)
+ if not duration:
+ print('Audio file doesn\'t exist or unreadable.')
+ return
command = [
Core.FFMPEG_BIN,