honor --ffmpeg-map even during normalization

This commit is contained in:
Martin Sekera 2019-03-15 08:39:36 +01:00
parent b4621d0044
commit 2929725416
2 changed files with 13 additions and 11 deletions

View file

@ -22,7 +22,7 @@ X264_BANNED_PIXFMTS = {"bgr24", "yuv422p"}
# 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", "-filter:a", "loudnorm=i=-23.0:tp=-2.0:lra=7.0:print_format=json", "-f", "null", "/dev/null")
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.encode_generic = Command("ffmpeg", "FPS", "CUT_FROM", "-i", "INFILE", "-threads", str(multiprocessing.cpu_count()), "CUT_TO", "MAP", "VIDEO", "AUDIO", "-sn", "OUTFILE")
command.sub_mp3 = Command("-codec:a", "libmp3lame", "NORMALIZE")
command.sub_opus = Command("-codec:a", "libopus", "NORMALIZE")
@ -216,6 +216,16 @@ if __name__ == "__main__":
else:
main.print("<c>audio<.>: <y>None<.>", main.print.tl.warn)
# prepare input stream mapping (which needs to be correct even for the normalization pre-pass)
if main.cfg.ffmpeg_map:
info.map_command = []
for m in main.cfg.ffmpeg_map:
info.map_command.append("-map")
info.map_command.append(m)
else:
info.map_command = None
# --------------------------------------------------
# normalization pre-pass
@ -224,6 +234,7 @@ if __name__ == "__main__":
command.normalize_prepass.reset()
command.normalize_prepass.INFILE = "file:" + str(files.infile)
command.normalize_prepass.MAP = info.map_command
command.normalize_prepass.run(stderr=True)
pb = over.text.ProgressBar(
@ -339,15 +350,6 @@ if __name__ == "__main__":
else:
info.vfilter_command = None
if main.cfg.ffmpeg_map:
info.map_command = []
for m in main.cfg.ffmpeg_map:
info.map_command.append("-map")
info.map_command.append(m)
else:
info.map_command = None
encode_cmd.MAP = info.map_command
if main.cfg.video == "copy":

View file

@ -4,5 +4,5 @@
major = 1 # VERSION_MAJOR_IDENTIFIER
minor = 112 # VERSION_MINOR_IDENTIFIER
# VERSION_LAST_MM 1.112
patch = 0 # VERSION_PATCH_IDENTIFIER
patch = 1 # VERSION_PATCH_IDENTIFIER
str = ".".join(str(v) for v in (major, minor, patch))