From a2c3dab02a1e8f0a43b8a63ef5f4f01cffd06f43 Mon Sep 17 00:00:00 2001 From: John Warburton Date: Thu, 13 Jul 2023 21:09:13 +0100 Subject: [PATCH] FFmpeg output has changed format slightly --- cue_playlist.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cue_playlist.py b/cue_playlist.py index 6c7ef6b..6ee0740 100644 --- a/cue_playlist.py +++ b/cue_playlist.py @@ -61,19 +61,20 @@ def analyse(filename, volDrop, volStart=40, mezzanine=None, forceEncode=False): stderr=subprocess.STDOUT)).split('\\n') measure = [] #print(test[:-14]) - for item in test[:-14]: + for item in test[:-12]: if item.startswith("[Parsed_ebur128"): - #print(item, item[-86:-74], item[-53:-47]) - measure.append([float(item[-86:-74].strip()), float(item[-53:-47].strip())]) + if item.find("Summary") == -1: +# print(item, item[-86:-74], item[-53:-47]) + measure.append([float(item[-86:-74].strip()), float(item[-53:-47].strip())]) # measure now contains a list of lists-of-floats: each item is [time],[loudness] - +# print("Testing THIS line for loudness: %s" % test[-9]) loudness = float(test[-9].split()[1]) # Get duration. It's the second item in the -13th line returned from # the FFmpeg process, in the list of lines named 'test' - print("Stats line is %s" % test[-14]) - partiallyParsedDuration = test[-14].split("=")[2].split()[0] + print("Stats line is %s" % test[-13]) + partiallyParsedDuration = test[-13].split("=")[2].split()[0] print("Duration line is %s" % partiallyParsedDuration) hmsSplit = partiallyParsedDuration.split(":") duration = float(int(hmsSplit[0])*3600 + int(hmsSplit[1])*60 + float(hmsSplit[2]))