From 4f9cac78c5ecd35af3713900427c409090f36914 Mon Sep 17 00:00:00 2001 From: Martinez Date: Sat, 18 Aug 2018 23:14:47 +0200 Subject: [PATCH] improved opus stream remapping (bug #5718) --- over-video.py | 9 ++++++++- version.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/over-video.py b/over-video.py index 7078629..b168e5a 100755 --- a/over-video.py +++ b/over-video.py @@ -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 "??<.>" @@ -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 #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() diff --git a/version.py b/version.py index e1dd9c8..705a56a 100644 --- a/version.py +++ b/version.py @@ -4,5 +4,5 @@ major = 1 # VERSION_MAJOR_IDENTIFIER minor = 111 # VERSION_MINOR_IDENTIFIER # VERSION_LAST_MM 1.111 -patch = 0 # VERSION_PATCH_IDENTIFIER +patch = 1 # VERSION_PATCH_IDENTIFIER str = ".".join(str(v) for v in (major, minor, patch))