mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 09:59:06 -07:00
Fix segment_time_delta value for ffmpeg 4.1
This commit is contained in:
parent
685e9e4f58
commit
617f7e8b5b
@ -137,10 +137,10 @@ namespace MediaBrowser.Api.Playback
|
||||
/// </summary>
|
||||
private string GetOutputFilePath(StreamState state, EncodingOptions encodingOptions, string outputFileExtension)
|
||||
{
|
||||
var data = GetCommandLineArguments("dummy\\dummy", encodingOptions, state, false);
|
||||
|
||||
data += "-" + (state.Request.DeviceId ?? string.Empty)
|
||||
+ "-" + (state.Request.PlaySessionId ?? string.Empty);
|
||||
var data = $"{state.MediaPath}-" +
|
||||
$"{state.UserAgent}" +
|
||||
$"{state.Request.DeviceId ?? string.Empty}-" +
|
||||
$"{state.Request.PlaySessionId ?? string.Empty}";
|
||||
|
||||
var filename = data.GetMD5().ToString("N", CultureInfo.InvariantCulture);
|
||||
var ext = outputFileExtension.ToLowerInvariant();
|
||||
|
@ -904,7 +904,8 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
}
|
||||
else
|
||||
{
|
||||
var keyFrameArg = string.Format(" -force_key_frames \"expr:gte(t,n_forced*{0})\"",
|
||||
var keyFrameArg = string.Format(" -force_key_frames:0 \"expr:gte(t,{0}+n_forced*{1})\"",
|
||||
GetStartNumber(state) * state.SegmentLength,
|
||||
state.SegmentLength.ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
@ -961,10 +962,10 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
|
||||
var timeDeltaParam = string.Empty;
|
||||
|
||||
if (isEncoding && startNumber > 0)
|
||||
if (isEncoding && state.TargetFramerate > 0)
|
||||
{
|
||||
var startTime = state.SegmentLength * startNumber;
|
||||
timeDeltaParam = string.Format("-segment_time_delta -{0}", startTime);
|
||||
float startTime = 1 / (state.TargetFramerate.Value * 2);
|
||||
timeDeltaParam = string.Format("-segment_time_delta {0}", Math.Round(startTime, 3));
|
||||
}
|
||||
|
||||
var segmentFormat = GetSegmentFileExtension(state.Request).TrimStart('.');
|
||||
@ -973,11 +974,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
segmentFormat = "mpegts";
|
||||
}
|
||||
|
||||
var breakOnNonKeyFrames = state.EnableBreakOnNonKeyFrames(videoCodec);
|
||||
|
||||
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}\"",
|
||||
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}\"",
|
||||
inputModifier,
|
||||
EncodingHelper.GetInputArgument(state, encodingOptions),
|
||||
threads,
|
||||
@ -989,8 +986,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
outputPath,
|
||||
outputTsArg,
|
||||
timeDeltaParam,
|
||||
segmentFormat,
|
||||
breakOnNonKeyFramesArg
|
||||
segmentFormat
|
||||
).Trim();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user