add break on non keyframes

This commit is contained in:
Luke Pulverenti 2017-03-31 15:05:19 -04:00
parent 6e4074ab8a
commit 06394d1a9f
5 changed files with 17 additions and 2 deletions

View File

@ -912,7 +912,12 @@ namespace MediaBrowser.Api.Playback.Hls
segmentFormat = "mpegts";
}
return string.Format("{0} {1} -map_metadata -1 -map_chapters -1 -threads {2} {3} {4} {5} -f segment -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -segment_time {6} {10} -individual_header_trailer 0 -segment_format {11} -segment_list_type m3u8 -segment_start_number {7} -segment_list \"{8}\" -y \"{9}\"",
var videoCodec = EncodingHelper.GetVideoEncoder(state, ApiEntryPoint.Instance.GetEncodingOptions());
var breakOnNonKeyFrames = state.Request.BreakOnNonKeyFrames && string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase);
var breakOnNonKeyFramesArg = breakOnNonKeyFrames ? " -break_non_keyframes 1" : "";
return string.Format("{0} {1} -map_metadata -1 -map_chapters -1 -threads {2} {3} {4} {5} -f segment -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -segment_time {6} {10} -individual_header_trailer 0{12} -segment_format {11} -segment_list_type m3u8 -segment_start_number {7} -segment_list \"{8}\" -y \"{9}\"",
inputModifier,
EncodingHelper.GetInputArgument(state, encodingOptions),
threads,
@ -924,7 +929,8 @@ namespace MediaBrowser.Api.Playback.Hls
outputPath,
outputTsArg,
timeDeltaParam,
segmentFormat
segmentFormat,
breakOnNonKeyFramesArg
).Trim();
}

View File

@ -43,6 +43,7 @@ namespace MediaBrowser.Api.Playback
public int? SegmentLength { get; set; }
public int? MinSegments { get; set; }
public bool BreakOnNonKeyFrames { get; set; }
}
public class VideoStreamRequest : StreamRequest

View File

@ -484,6 +484,8 @@ namespace MediaBrowser.Model.Dlna
playlistItem.CopyTimestamps = transcodingProfile.CopyTimestamps;
playlistItem.EnableSubtitlesInManifest = transcodingProfile.EnableSubtitlesInManifest;
playlistItem.BreakOnNonKeyFrames = transcodingProfile.BreakOnNonKeyFrames;
if (transcodingProfile.MinSegments > 0)
{
playlistItem.MinSegments = transcodingProfile.MinSegments;

View File

@ -40,6 +40,7 @@ namespace MediaBrowser.Model.Dlna
public int? SegmentLength { get; set; }
public int? MinSegments { get; set; }
public bool BreakOnNonKeyFrames { get; set; }
public bool RequireAvc { get; set; }
public bool DeInterlace { get; set; }
@ -305,6 +306,8 @@ namespace MediaBrowser.Model.Dlna
{
list.Add(new NameValuePair("MinSegments", item.MinSegments.Value.ToString(CultureInfo.InvariantCulture)));
}
list.Add(new NameValuePair("BreakOnNonKeyFrames", item.BreakOnNonKeyFrames.ToString()));
}
return list;

View File

@ -48,6 +48,9 @@ namespace MediaBrowser.Model.Dlna
[XmlAttribute("segmentLength")]
public int SegmentLength { get; set; }
[XmlAttribute("breakOnNonKeyFrames")]
public bool BreakOnNonKeyFrames { get; set; }
public List<string> GetAudioCodecs()
{
List<string> list = new List<string>();