From c4b7dbf40c15a2ae8b7092b11f6c6f7a93d343ed Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Sun, 1 Oct 2023 20:18:40 -0400 Subject: [PATCH] force aac 5.1 to use mkv when preserving multichannel audio --- components/ItemGrid/LoadVideoContentTask.brs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/components/ItemGrid/LoadVideoContentTask.brs b/components/ItemGrid/LoadVideoContentTask.brs index 31c10e3e7..736198a18 100644 --- a/components/ItemGrid/LoadVideoContentTask.brs +++ b/components/ItemGrid/LoadVideoContentTask.brs @@ -229,10 +229,16 @@ sub addVideoContentURL(video, mediaSourceId, audio_stream_idx, fully_external) print "Users receiver can not decode the selected multichannel audio stream" ' check to see if the receiver can decode our preferred audio codec preferredCodec = "ac3" - if m.global.session.user.settings["playback.forceDTS"] - if selectedAudioStream.Container = "webm" or selectedAudioStream = "mkv" + forceMKV = false + if selectedAudioStream.Container = "webm" or selectedAudioStream = "mkv" + if m.global.session.user.settings["playback.forceDTS"] preferredCodec = "dts" end if + else + ' if the file is aac and not mkv, force container to be mkv + if selectedAudioStream.Codec = "aac" + forceMKV = true + end if end if if di.CanDecodeAudio({ Codec: preferredCodec, ChCnt: selectedAudioStream.Channels, PassThru: 1 }).Result print "Attempting to transcode audio to our preferred multichannel codec" @@ -240,6 +246,9 @@ sub addVideoContentURL(video, mediaSourceId, audio_stream_idx, fully_external) ' otherwise the roku device will downmix aac/opus to stereo params.Delete("Static") params.audioCodec = preferredCodec + if forceMKV + params.container = "mkv" + end if video.isTranscoded = true video.directplaysupported = false params.transcodeReasons = "Switching audio codecs to preserve multichannel audio support"