diff options
| author | LukePulverenti <luke.pulverenti@gmail.com> | 2013-03-20 10:27:56 -0400 |
|---|---|---|
| committer | LukePulverenti <luke.pulverenti@gmail.com> | 2013-03-20 10:27:56 -0400 |
| commit | 095896fa4999c4cb583eead6343b91882485f874 (patch) | |
| tree | e8e069d8ddf7fc32f4b73b3cc2f5e696e6787e07 | |
| parent | 9ecd2bbf911df1bb038f0f500b51795da80a51b4 (diff) | |
#73 - added audio/video sync
| -rw-r--r-- | MediaBrowser.Api/Playback/Hls/VideoHlsService.cs | 19 | ||||
| -rw-r--r-- | MediaBrowser.Api/Playback/Progressive/VideoService.cs | 2 |
2 files changed, 11 insertions, 10 deletions
diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs index 578eb93ac0..62ed0f35f9 100644 --- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs @@ -56,13 +56,13 @@ namespace MediaBrowser.Api.Playback.Hls /// <returns>System.String.</returns> protected override string GetAudioArguments(StreamState state) { - if (!state.Request.AudioCodec.HasValue) + var codec = GetAudioCodec(state.Request); + + if (codec.Equals("copy", StringComparison.OrdinalIgnoreCase)) { return "-codec:a:0 copy"; } - var codec = GetAudioCodec(state.Request); - var args = "-codec:a:0 " + codec; if (state.AudioStream != null) @@ -84,6 +84,8 @@ namespace MediaBrowser.Api.Playback.Hls args += " -ab " + state.Request.AudioBitRate.Value; } + args += " -af \"aresample=async=1000\""; + return args; } @@ -99,12 +101,6 @@ namespace MediaBrowser.Api.Playback.Hls { var codec = GetVideoCodec(state.VideoRequest); - // Right now all we support is either h264 or copy - if (!codec.Equals("copy", StringComparison.OrdinalIgnoreCase) && !codec.Equals("libx264", StringComparison.OrdinalIgnoreCase)) - { - codec = "libx264"; - } - // See if we can save come cpu cycles by avoiding encoding if (codec.Equals("copy", StringComparison.OrdinalIgnoreCase)) { @@ -125,7 +121,7 @@ namespace MediaBrowser.Api.Playback.Hls } // Get the output framerate based on the FrameRate param - double framerate = state.VideoRequest.Framerate ?? 0; + var framerate = state.VideoRequest.Framerate ?? 0; // We have to supply a framerate for hls, so if it's null, account for that here if (framerate.Equals(0)) @@ -146,6 +142,9 @@ namespace MediaBrowser.Api.Playback.Hls // Needed to ensure segments stay under 10 seconds args += string.Format(" -g {0}", framerate); + args += " -vsync vfr"; + + return args; } diff --git a/MediaBrowser.Api/Playback/Progressive/VideoService.cs b/MediaBrowser.Api/Playback/Progressive/VideoService.cs index 0e94b7df89..f545c00051 100644 --- a/MediaBrowser.Api/Playback/Progressive/VideoService.cs +++ b/MediaBrowser.Api/Playback/Progressive/VideoService.cs @@ -154,6 +154,8 @@ namespace MediaBrowser.Api.Playback.Progressive { args += " " + qualityParam; } + + args += " -vsync vfr"; } else if (IsH264(state.VideoStream)) { |
