From 1b5ab6416b599986b7079b220d1a142db10a46fd Mon Sep 17 00:00:00 2001 From: Martin Sekera Date: Sun, 29 Aug 2021 15:26:47 +0200 Subject: [PATCH] Increase normalization speed, fix normalization scope when --cut is set. --- over-video.py | 7 ++++++- version.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/over-video.py b/over-video.py index a4c4129..25ff072 100755 --- a/over-video.py +++ b/over-video.py @@ -484,7 +484,7 @@ subtitle_codec_router.add_codec(codec_sdrop) # see doc/command_assembler.png command = over.types.ndict() command.identify = Command("ffprobe", "-v", "quiet", "-print_format", "json", "-show_format", "-show_streams", "INFILE") -command.normalize_prepass = Command("ffmpeg", "-i", "INFILE", "MAP", "-filter:a", "loudnorm=i=-23.0:tp=-2.0:lra=7.0:print_format=json", "-f", "null", "/dev/null") +command.normalize_prepass = Command("ffmpeg", "CUT_FROM", "-i", "INFILE", "-threads", str(multiprocessing.cpu_count()), "CUT_TO", "MAP", "-filter:a", "loudnorm=i=-23.0:tp=-2.0:lra=7.0:print_format=json", "-f", "null", "/dev/null") command.encode_generic = Command("ffmpeg", "FPS", "CUT_FROM", "-i", "INFILE", "-threads", str(multiprocessing.cpu_count()), "CUT_TO", "MAP", "VIDEO", "AUDIO", "SUBTITLE", "OUTFILE") command.sub_vfilter = Command("-filter:v", "ARGS") command.sub_afilter = Command("-filter:a", "ARGS", "-ar", "48k") @@ -691,6 +691,9 @@ if __name__ == "__main__": main.log.info("video: %s", ", ".join(video_words)) main.log.info("container: %s<.>", files.container) + if main.cfg.cut: + main.log.warn("cut: start at %s<.>, take %s<.>", main.cfg.cut[0], main.cfg.cut[1]) + if main.cfg.move: main.log.info("move source files to %s<.>/", main.cfg.move) @@ -830,6 +833,8 @@ if __name__ == "__main__": command.normalize_prepass.reset() command.normalize_prepass.INFILE = "file:" + str(files.infile) + command.normalize_prepass.CUT_FROM = ["-ss", main.cfg.cut[0]] if main.cfg.cut else None + command.normalize_prepass.CUT_TO = ["-to", main.cfg.cut[1]] if main.cfg.cut else None command.normalize_prepass.MAP = info.map_command command.normalize_prepass.run(stderr=True) diff --git a/version.py b/version.py index 9602ffe..a3768e5 100644 --- a/version.py +++ b/version.py @@ -4,5 +4,5 @@ major = 2 # VERSION_MAJOR_IDENTIFIER minor = 1 # VERSION_MINOR_IDENTIFIER # VERSION_LAST_MM 2.1 -patch = 0 # VERSION_PATCH_IDENTIFIER +patch = 1 # VERSION_PATCH_IDENTIFIER str = ".".join(str(v) for v in (major, minor, patch))