The Free Software Media System - Server Backend & API
switch to audio filter for volume
Luke Pulverenticb3089791e5f
diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.csindex 5ef70c8109..130a3c5750 100644--- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs+++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs@@ -72,12 +72,6 @@ namespace MediaBrowser.Api.Playback.Hlsif (channels.HasValue){args += " -ac " + channels.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 (state.Request.AudioSampleRate.HasValue)@@ -90,7 +84,15 @@ namespace MediaBrowser.Api.Playback.Hlsargs += " -ab " + state.Request.AudioBitRate.Value;}- args += " -af \"aresample=async=1000\"";+ var volParam = string.Empty;++ // 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;}diff --git a/MediaBrowser.Api/Playback/Progressive/VideoService.cs b/MediaBrowser.Api/Playback/Progressive/VideoService.csindex 9474242410..c0f3fd6895 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 namevar 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;}