From a2c6f687aea4164091b78b554372d523edeeb7fd Mon Sep 17 00:00:00 2001 From: tikuf Date: Mon, 28 Oct 2013 15:01:35 +1100 Subject: [PATCH 1/2] Move depreciated audio re-sample into audio filters --- .../Playback/Hls/VideoHlsService.cs | 15 +++++---- .../Playback/Progressive/VideoService.cs | 33 ++++++++++--------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs index ecc53ce34..f6bad78bf 100644 --- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Common.MediaInfo; +using MediaBrowser.Common.MediaInfo; using MediaBrowser.Controller; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Library; @@ -79,11 +79,6 @@ namespace MediaBrowser.Api.Playback.Hls args += " -ac " + channels.Value; } - if (state.Request.AudioSampleRate.HasValue) - { - args += " -ar " + state.Request.AudioSampleRate.Value; - } - var bitrate = GetAudioBitrateParam(state); if (bitrate.HasValue) @@ -92,14 +87,20 @@ namespace MediaBrowser.Api.Playback.Hls } var volParam = string.Empty; + var AudioSampleRate = 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"; } + + if (state.Request.AudioSampleRate.HasValue) + { + AudioSampleRate= state.Request.AudioSampleRate.Value + ":"; + } - args += string.Format(" -af \"adelay=1,aresample=async=1000{0}\"", volParam); + args += string.Format(" -af \"adelay=1,aresample={0}async=1000{1}\"",AudioSampleRate, volParam); return args; } diff --git a/MediaBrowser.Api/Playback/Progressive/VideoService.cs b/MediaBrowser.Api/Playback/Progressive/VideoService.cs index c1dd7fa01..8e106b2d4 100644 --- a/MediaBrowser.Api/Playback/Progressive/VideoService.cs +++ b/MediaBrowser.Api/Playback/Progressive/VideoService.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Common.MediaInfo; +using MediaBrowser.Common.MediaInfo; using MediaBrowser.Controller; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Dto; @@ -219,11 +219,6 @@ namespace MediaBrowser.Api.Playback.Progressive args += " -ac " + channels.Value; } - if (request.AudioSampleRate.HasValue) - { - args += " -ar " + request.AudioSampleRate.Value; - } - var bitrate = GetAudioBitrateParam(state); if (bitrate.HasValue) @@ -231,19 +226,25 @@ namespace MediaBrowser.Api.Playback.Progressive args += " -ab " + bitrate.Value.ToString(UsCulture); } - var volParam = string.Empty; + var volParam = string.Empty; + var AudioSampleRate = 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"; + // 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"; + } + + if (state.Request.AudioSampleRate.HasValue) + { + AudioSampleRate= state.Request.AudioSampleRate.Value + ":"; + } + + args += string.Format(" -af \"aresample={0}async=1000{1}\"",AudioSampleRate, volParam); + + return args; } - args += string.Format(" -af \"aresample=async=1000{0}\"", volParam); - - return args; - } - /// /// Gets the video bitrate to specify on the command line /// From 407b64d0f90a0b6d145b264f198dcb7f33fee95f Mon Sep 17 00:00:00 2001 From: tikuf Date: Wed, 30 Oct 2013 18:00:54 +1100 Subject: [PATCH 2/2] Support Korean Subtitles --- .../MediaEncoder/MediaEncoder.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Server.Implementations/MediaEncoder/MediaEncoder.cs b/MediaBrowser.Server.Implementations/MediaEncoder/MediaEncoder.cs index 785bbca7c..6f4d01e3e 100644 --- a/MediaBrowser.Server.Implementations/MediaEncoder/MediaEncoder.cs +++ b/MediaBrowser.Server.Implementations/MediaEncoder/MediaEncoder.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Common.Configuration; +using MediaBrowser.Common.Configuration; using MediaBrowser.Common.IO; using MediaBrowser.Common.MediaInfo; using MediaBrowser.Model.Entities; @@ -600,6 +600,8 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder return "-sub_charenc windows-1251"; case "vie": return "-sub_charenc windows-1258"; + case "kor": + return "-sub_charenc cp949"; default: return "-sub_charenc windows-1252"; }