From 0aecb6e2963245c2d43d3450915a9d7561d94a8a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 5 Mar 2016 13:29:32 -0500 Subject: [PATCH] fix opus transcoding --- MediaBrowser.Api/Playback/Progressive/AudioService.cs | 8 ++++++-- MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/MediaBrowser.Api/Playback/Progressive/AudioService.cs b/MediaBrowser.Api/Playback/Progressive/AudioService.cs index ada4761c7..1d8f5003f 100644 --- a/MediaBrowser.Api/Playback/Progressive/AudioService.cs +++ b/MediaBrowser.Api/Playback/Progressive/AudioService.cs @@ -73,9 +73,13 @@ namespace MediaBrowser.Api.Playback.Progressive audioTranscodeParams.Add("-ac " + state.OutputAudioChannels.Value.ToString(UsCulture)); } - if (state.OutputAudioSampleRate.HasValue) + // opus will fail on 44100 + if (!string.Equals(state.OutputAudioCodec, "opus", global::System.StringComparison.OrdinalIgnoreCase)) { - audioTranscodeParams.Add("-ar " + state.OutputAudioSampleRate.Value.ToString(UsCulture)); + if (state.OutputAudioSampleRate.HasValue) + { + audioTranscodeParams.Add("-ar " + state.OutputAudioSampleRate.Value.ToString(UsCulture)); + } } const string vn = " -vn"; diff --git a/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs index a4d4797eb..c2754217f 100644 --- a/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs @@ -35,9 +35,13 @@ namespace MediaBrowser.MediaEncoding.Encoder audioTranscodeParams.Add("-ac " + state.OutputAudioChannels.Value.ToString(UsCulture)); } - if (state.OutputAudioSampleRate.HasValue) + // opus will fail on 44100 + if (!string.Equals(state.OutputAudioCodec, "opus", StringComparison.OrdinalIgnoreCase)) { - audioTranscodeParams.Add("-ar " + state.OutputAudioSampleRate.Value.ToString(UsCulture)); + if (state.OutputAudioSampleRate.HasValue) + { + audioTranscodeParams.Add("-ar " + state.OutputAudioSampleRate.Value.ToString(UsCulture)); + } } const string vn = " -vn";