diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-03-24 18:37:20 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-03-24 18:37:20 -0400 |
| commit | cb3089791e5f7d13056ed247faa415da58d1a00b (patch) | |
| tree | ece30b6b4ceb2710c15daa10f028203f550e7e46 /MediaBrowser.Api/Playback/Progressive/VideoService.cs | |
| parent | 63e16a4d99ff8d97a16d0fe9e0edd860ce6f0815 (diff) | |
switch to audio filter for volume
Diffstat (limited to 'MediaBrowser.Api/Playback/Progressive/VideoService.cs')
| -rw-r--r-- | MediaBrowser.Api/Playback/Progressive/VideoService.cs | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/MediaBrowser.Api/Playback/Progressive/VideoService.cs b/MediaBrowser.Api/Playback/Progressive/VideoService.cs index 947424241..c0f3fd689 100644 --- a/MediaBrowser.Api/Playback/Progressive/VideoService.cs +++ b/MediaBrowser.Api/Playback/Progressive/VideoService.cs @@ -184,36 +184,41 @@ namespace MediaBrowser.Api.Playback.Progressive // Get the output codec name var codec = GetAudioCodec(request); + if (codec.Equals("copy", StringComparison.OrdinalIgnoreCase)) + { + return "-acodec copy"; + } + var args = "-acodec " + codec; - // If we're encoding audio, add additional params - if (!codec.Equals("copy", StringComparison.OrdinalIgnoreCase)) + // Add the number of audio channels + var channels = GetNumAudioChannelsParam(request, state.AudioStream); + + if (channels.HasValue) { - // Add the number of audio channels - var channels = GetNumAudioChannelsParam(request, state.AudioStream); + args += " -ac " + channels.Value; + } - if (channels.HasValue) - { - args += " -ac " + channels.Value; + if (request.AudioSampleRate.HasValue) + { + args += " -ar " + request.AudioSampleRate.Value; + } - // Boost volume to 200% when downsampling from 6ch to 2ch - if (channels.Value <= 2 && state.AudioStream.Channels.HasValue && state.AudioStream.Channels.Value > 5) - { - args += " -vol 512"; - } - } + if (request.AudioBitRate.HasValue) + { + args += " -ab " + request.AudioBitRate.Value; + } - if (request.AudioSampleRate.HasValue) - { - args += " -ar " + request.AudioSampleRate.Value; - } + var volParam = string.Empty; - if (request.AudioBitRate.HasValue) - { - args += " -ab " + request.AudioBitRate.Value; - } + // Boost volume to 200% when downsampling from 6ch to 2ch + if (channels.HasValue && channels.Value <= 2 && state.AudioStream.Channels.HasValue && state.AudioStream.Channels.Value > 5) + { + volParam = ",volume=2.000000"; } + args += string.Format(" -af \"aresample=async=1000,{0}\"", volParam); + return args; } |
