update progressive encoding

pull/702/head
Luke Pulverenti 9 years ago
parent 521cfa9584
commit fcd15da1e6

@ -305,9 +305,8 @@ namespace MediaBrowser.Api.Playback
/// </summary> /// </summary>
/// <param name="state">The state.</param> /// <param name="state">The state.</param>
/// <param name="videoCodec">The video codec.</param> /// <param name="videoCodec">The video codec.</param>
/// <param name="isHls">if set to <c>true</c> [is HLS].</param>
/// <returns>System.String.</returns> /// <returns>System.String.</returns>
protected string GetVideoQualityParam(StreamState state, string videoCodec, bool isHls) protected string GetVideoQualityParam(StreamState state, string videoCodec)
{ {
var param = string.Empty; var param = string.Empty;
@ -385,7 +384,7 @@ namespace MediaBrowser.Api.Playback
param = "-mbd 2"; param = "-mbd 2";
} }
param += GetVideoBitrateParam(state, videoCodec, isHls); param += GetVideoBitrateParam(state, videoCodec);
var framerate = GetFramerateParam(state); var framerate = GetFramerateParam(state);
if (framerate.HasValue) if (framerate.HasValue)
@ -1190,7 +1189,7 @@ namespace MediaBrowser.Api.Playback
return bitrate; return bitrate;
} }
protected string GetVideoBitrateParam(StreamState state, string videoCodec, bool isHls) protected string GetVideoBitrateParam(StreamState state, string videoCodec)
{ {
var bitrate = state.OutputVideoBitrate; var bitrate = state.OutputVideoBitrate;
@ -1209,14 +1208,9 @@ namespace MediaBrowser.Api.Playback
} }
// h264 // h264
if (isHls) return string.Format(" -b:v {0} -maxrate {0} -bufsize {1}",
{ bitrate.Value.ToString(UsCulture),
return string.Format(" -b:v {0} -maxrate {0} -bufsize {1}", (bitrate.Value * 2).ToString(UsCulture));
bitrate.Value.ToString(UsCulture),
(bitrate.Value * 2).ToString(UsCulture));
}
return string.Format(" -b:v {0}", bitrate.Value.ToString(UsCulture));
} }
return string.Empty; return string.Empty;

@ -430,7 +430,7 @@ namespace MediaBrowser.Api.Playback.Dash
var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream; var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream;
args += " " + GetVideoQualityParam(state, GetH264Encoder(state), true) + keyFrameArg; args += " " + GetVideoQualityParam(state, GetH264Encoder(state)) + keyFrameArg;
// Add resolution params, if specified // Add resolution params, if specified
if (!hasGraphicalSubs) if (!hasGraphicalSubs)

@ -822,7 +822,7 @@ namespace MediaBrowser.Api.Playback.Hls
var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream; var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream;
args += " " + GetVideoQualityParam(state, GetH264Encoder(state), true) + keyFrameArg; args += " " + GetVideoQualityParam(state, GetH264Encoder(state)) + keyFrameArg;
//args += " -mixed-refs 0 -refs 3 -x264opts b_pyramid=0:weightb=0:weightp=0"; //args += " -mixed-refs 0 -refs 3 -x264opts b_pyramid=0:weightb=0:weightp=0";

@ -106,7 +106,7 @@ namespace MediaBrowser.Api.Playback.Hls
var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream; var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream;
args += " " + GetVideoQualityParam(state, GetH264Encoder(state), true) + keyFrameArg; args += " " + GetVideoQualityParam(state, GetH264Encoder(state)) + keyFrameArg;
// Add resolution params, if specified // Add resolution params, if specified
if (!hasGraphicalSubs) if (!hasGraphicalSubs)

@ -166,7 +166,7 @@ namespace MediaBrowser.Api.Playback.Progressive
args += GetOutputSizeParam(state, videoCodec); args += GetOutputSizeParam(state, videoCodec);
} }
var qualityParam = GetVideoQualityParam(state, videoCodec, false); var qualityParam = GetVideoQualityParam(state, videoCodec);
if (!string.IsNullOrEmpty(qualityParam)) if (!string.IsNullOrEmpty(qualityParam))
{ {

@ -568,9 +568,8 @@ namespace MediaBrowser.MediaEncoding.Encoder
/// </summary> /// </summary>
/// <param name="state">The state.</param> /// <param name="state">The state.</param>
/// <param name="videoCodec">The video codec.</param> /// <param name="videoCodec">The video codec.</param>
/// <param name="isHls">if set to <c>true</c> [is HLS].</param>
/// <returns>System.String.</returns> /// <returns>System.String.</returns>
protected string GetVideoQualityParam(EncodingJob state, string videoCodec, bool isHls) protected string GetVideoQualityParam(EncodingJob state, string videoCodec)
{ {
var param = string.Empty; var param = string.Empty;
@ -648,7 +647,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
param = "-mbd 2"; param = "-mbd 2";
} }
param += GetVideoBitrateParam(state, videoCodec, isHls); param += GetVideoBitrateParam(state, videoCodec);
var framerate = GetFramerateParam(state); var framerate = GetFramerateParam(state);
if (framerate.HasValue) if (framerate.HasValue)
@ -718,7 +717,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
return "-pix_fmt yuv420p " + param; return "-pix_fmt yuv420p " + param;
} }
protected string GetVideoBitrateParam(EncodingJob state, string videoCodec, bool isHls) protected string GetVideoBitrateParam(EncodingJob state, string videoCodec)
{ {
var bitrate = state.OutputVideoBitrate; var bitrate = state.OutputVideoBitrate;
@ -737,14 +736,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
} }
// h264 // h264
if (isHls) return string.Format(" -b:v {0} -maxrate {0} -bufsize {1}",
{ bitrate.Value.ToString(UsCulture),
return string.Format(" -b:v {0} -maxrate {0} -bufsize {1}", (bitrate.Value * 2).ToString(UsCulture));
bitrate.Value.ToString(UsCulture),
(bitrate.Value * 2).ToString(UsCulture));
}
return string.Format(" -b:v {0}", bitrate.Value.ToString(UsCulture));
} }
return string.Empty; return string.Empty;

@ -96,7 +96,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
args += GetOutputSizeParam(state, videoCodec); args += GetOutputSizeParam(state, videoCodec);
} }
var qualityParam = GetVideoQualityParam(state, videoCodec, false); var qualityParam = GetVideoQualityParam(state, videoCodec);
if (!string.IsNullOrEmpty(qualityParam)) if (!string.IsNullOrEmpty(qualityParam))
{ {

Loading…
Cancel
Save