Backport pull request #18195 from jellyfin/release-12.z

Apply stereo downmix filter consistently to progressive audio transcodes

Original-merge: 4d99715770

Merged-by: crobibero <cody@robibe.ro>

Backported-by: Cody Robibero <cody@robibe.ro>
This commit is contained in:
Shadowghost authored and Cody Robibero committed 2026-09-27 16:30:57 -04:00
1 parent 8bce631afa
commit 3142fcd12f
2 files changed
+70 -1

No files matched your search

@@ -7832,7 +7832,9 @@ namespace MediaBrowser.Controller.MediaEncoding
var channels = state.OutputAudioChannels;
var useDownMixAlgorithm = state.AudioStream is not null
// Must match the condition under which GetAudioFilterParam emits the downmix filter.
var useDownMixAlgorithm = channels == 2
&& state.AudioStream?.Channels > 2
&& DownMixAlgorithmsHelper.AlgorithmFilterStrings.ContainsKey((encodingOptions.DownMixStereoAlgorithm, DownMixAlgorithmsHelper.InferChannelLayout(state.AudioStream)));
if (channels.HasValue && !useDownMixAlgorithm)
@@ -7927,6 +7929,13 @@ namespace MediaBrowser.Controller.MediaEncoding
audioTranscodeParams.Add("-ar " + sampleRateValue.ToString(CultureInfo.InvariantCulture));
}
// Without the downmix filter, -ac 2 alone drops the LFE channel.
var audioFilterParam = GetAudioFilterParam(state, encodingOptions);
if (!string.IsNullOrEmpty(audioFilterParam))
{
audioTranscodeParams.Add(audioFilterParam.TrimStart());
}
// Copy the movflags from GetProgressiveVideoFullCommandLine
// See #9248 and the associated PR for why this is needed
if (_mp4ContainerNames.Contains(state.OutputContainer))