improved opus stream remapping (bug #5718)

This commit is contained in:
Martinez 2018-08-18 23:14:47 +02:00
parent 41f94f724b
commit 4f9cac78c5
2 changed files with 9 additions and 2 deletions

View file

@ -25,7 +25,7 @@ command.identify = Command("ffprobe", "-v", "quiet", "-print_format", "json", "-
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", "-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", "-filter:a", "channelmap=channel_layout=5.1")
command.sub_opus = Command("-codec:a", "libopus", "NORMALIZE")
command.sub_vorbis = Command("-codec:a", "libvorbis", "-qscale:a", "QUALITY", "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")
@ -194,6 +194,7 @@ if __name__ == "__main__":
audio = audio_streams[0]
info.audio_codec = audio["codec_name"]
info.audio_channels = audio["channels"]
info.audio_channel_layout = audio["channel_layout"]
info.audio_samplerate = over.text.Unit(audio["sample_rate"], "Hz")
info.audio_language = audio["tags"]["language"] if "tags" in audio and "language" in audio["tags"] else "und"
info.audio_bitrate = over.text.Unit(audio["bit_rate"], "b/s") if "bit_rate" in audio else "<R>??<.>"
@ -311,6 +312,12 @@ if __name__ == "__main__":
command.sub_opus.reset()
command.sub_opus.NORMALIZE = info.normalize_command
# workaround of https://trac.ffmpeg.org/ticket/5718
if info.audio_channel_layout == "5.1(side)":
main.print("applying <y>#5718 workaround<.>", main.print.tl.warn)
command.sub_opus.sequence.append("-filter:a")
command.sub_opus.sequence.append("channelmap=channel_layout=5.1")
encode_cmd.AUDIO = command.sub_opus
elif main.cfg.audio == "mp3":
command.sub_mp3.reset()