- add mp3 output

- explicitly map 5.1 audio with opus
This commit is contained in:
Martinez 2018-08-18 22:21:56 +02:00
parent dffe860bfa
commit 41f94f724b
2 changed files with 13 additions and 7 deletions

View file

@ -22,9 +22,10 @@ X264_BANNED_PIXFMTS = {"bgr24", "yuv422p"}
# see doc/command_assembler.png # see doc/command_assembler.png
command = over.types.ndict() command = over.types.ndict()
command.identify = Command("ffprobe", "-v", "quiet", "-print_format", "json", "-show_format", "-show_streams", "INFILE") command.identify = Command("ffprobe", "-v", "quiet", "-print_format", "json", "-show_format", "-show_streams", "INFILE")
command.normalize_prepass = Command("ffmpeg", "-i", "INFILE", "-max_muxing_queue_size", "512", "-filter:a", "loudnorm=I=-16:TP=-1.5:LRA=11:print_format=json", "-f", "null", "/dev/null") command.normalize_prepass = Command("ffmpeg", "-i", "INFILE", "-filter:a", "loudnorm=I=-16:TP=-1.5:LRA=11:print_format=json", "-f", "null", "/dev/null")
command.encode_generic = Command("ffmpeg", "FPS", "CUT_FROM", "-i", "INFILE", "-max_muxing_queue_size", "512", "-threads", str(multiprocessing.cpu_count()), "CUT_TO", "MAP", "VIDEO", "AUDIO", "-sn", "OUTFILE") command.encode_generic = Command("ffmpeg", "FPS", "CUT_FROM", "-i", "INFILE", "-threads", str(multiprocessing.cpu_count()), "CUT_TO", "MAP", "VIDEO", "AUDIO", "-sn", "OUTFILE")
command.sub_opus = Command("-codec:a", "libopus", "NORMALIZE") command.sub_mp3 = Command("-codec:a", "libmp3lame", "NORMALIZE")
command.sub_opus = Command("-codec:a", "libopus", "NORMALIZE", "-filter:a", "channelmap=channel_layout=5.1")
command.sub_vorbis = Command("-codec:a", "libvorbis", "-qscale:a", "QUALITY", "NORMALIZE") command.sub_vorbis = Command("-codec:a", "libvorbis", "-qscale:a", "QUALITY", "NORMALIZE")
command.sub_pcm = Command("-codec:a", "pcm_s16le", "NORMALIZE") command.sub_pcm = Command("-codec:a", "pcm_s16le", "NORMALIZE")
command.sub_x264 = Command("PIXFMT", "-codec:v", "libx264", "-preset", "PRESET", "-crf", "QUALITY", "-profile:v", "high", "-level", "4.2", "VFILTER") command.sub_x264 = Command("PIXFMT", "-codec:v", "libx264", "-preset", "PRESET", "-crf", "QUALITY", "-profile:v", "high", "-level", "4.2", "VFILTER")
@ -111,7 +112,7 @@ if __name__ == "__main__":
if main.cfg.move_source: if main.cfg.move_source:
main.print("move source files to <W>%s<.>/" %(main.cfg.move_source)) main.print("move source files to <W>%s<.>/" %(main.cfg.move_source))
if main.cfg.audio not in ("drop", "copy", "pcm", "vorbis", "opus"): if main.cfg.audio not in ("drop", "copy", "pcm", "vorbis", "opus", "mp3"):
raise ValueError("unknown audio codec: %s" %(main.cfg.audio)) raise ValueError("unknown audio codec: %s" %(main.cfg.audio))
if main.cfg.video not in ("drop", "copy", "x264", "x265", "vp9"): if main.cfg.video not in ("drop", "copy", "x264", "x265", "vp9"):
@ -311,6 +312,11 @@ if __name__ == "__main__":
command.sub_opus.NORMALIZE = info.normalize_command command.sub_opus.NORMALIZE = info.normalize_command
encode_cmd.AUDIO = command.sub_opus encode_cmd.AUDIO = command.sub_opus
elif main.cfg.audio == "mp3":
command.sub_mp3.reset()
command.sub_mp3.NORMALIZE = info.normalize_command
encode_cmd.AUDIO = command.sub_mp3
if main.cfg.ffmpeg_vfilter: if main.cfg.ffmpeg_vfilter:
info.vfilter_command = command.sub_vfilter info.vfilter_command = command.sub_vfilter

View file

@ -2,7 +2,7 @@
# encoding: utf-8 # encoding: utf-8
major = 1 # VERSION_MAJOR_IDENTIFIER major = 1 # VERSION_MAJOR_IDENTIFIER
minor = 110 # VERSION_MINOR_IDENTIFIER minor = 111 # VERSION_MINOR_IDENTIFIER
# VERSION_LAST_MM 1.110 # VERSION_LAST_MM 1.111
patch = 1 # VERSION_PATCH_IDENTIFIER patch = 0 # VERSION_PATCH_IDENTIFIER
str = ".".join(str(v) for v in (major, minor, patch)) str = ".".join(str(v) for v in (major, minor, patch))