diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e719265d..75e459da3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - Merge generated `Other Video` folder tags with tags from sidecar NFO +- Prioritize audio streams that are flagged as "default" when multiple candidate streams are available + - For example, a video with a stereo commentary track and a stereo "default" track will now prefer the "default" track ## [0.7.3-beta] - 2023-01-25 ### Added diff --git a/ErsatzTV.Core/FFmpeg/FFmpegStreamSelector.cs b/ErsatzTV.Core/FFmpeg/FFmpegStreamSelector.cs index d425c4c47..4ade1d13a 100644 --- a/ErsatzTV.Core/FFmpeg/FFmpegStreamSelector.cs +++ b/ErsatzTV.Core/FFmpeg/FFmpegStreamSelector.cs @@ -233,7 +233,7 @@ public class FFmpegStreamSelector : IFFmpegStreamSelector if (string.IsNullOrWhiteSpace(title)) { _logger.LogDebug("No audio title has been specified; selecting stream with most channels"); - return streams.OrderByDescending(s => s.Channels).Head(); + return streams.OrderByDescending(s => s.Channels).ThenByDescending(s => s.Default).Head(); } // prioritize matching titles @@ -247,14 +247,14 @@ public class FFmpegStreamSelector : IFFmpegStreamSelector matchingTitle.Count, title); - return matchingTitle.OrderByDescending(s => s.Channels).Head(); + return matchingTitle.OrderByDescending(s => s.Channels).ThenByDescending(s => s.Default).Head(); } _logger.LogDebug( "Unable to find audio stream with preferred title {Title}; selecting stream with most channels", title); - return streams.OrderByDescending(s => s.Channels).Head(); + return streams.OrderByDescending(s => s.Channels).ThenByDescending(s => s.Default).Head(); } private async Task> SelectEpisodeAudioStream(