mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
added hls changes for live tv
This commit is contained in:
parent
a72a297c88
commit
d02c0ba3f4
@ -265,7 +265,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
|
|
||||||
if (cpuCount >= 4)
|
if (cpuCount >= 4)
|
||||||
{
|
{
|
||||||
return EncodingQuality.HighQuality;
|
//return EncodingQuality.HighQuality;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EncodingQuality.HighSpeed;
|
return EncodingQuality.HighSpeed;
|
||||||
@ -1418,6 +1418,9 @@ namespace MediaBrowser.Api.Playback
|
|||||||
|
|
||||||
state.HasMediaStreams = mediaStreams.Count > 0;
|
state.HasMediaStreams = mediaStreams.Count > 0;
|
||||||
|
|
||||||
|
state.SegmentLength = state.ReadInputAtNativeFramerate ? 3 : 10;
|
||||||
|
state.HlsListSize = state.ReadInputAtNativeFramerate ? 20 : 1440;
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
// If performSubtitleConversions is true we're actually starting ffmpeg
|
// If performSubtitleConversions is true we're actually starting ffmpeg
|
||||||
var startNumberParam = performSubtitleConversions ? GetStartNumber(state).ToString(UsCulture) : "0";
|
var startNumberParam = performSubtitleConversions ? GetStartNumber(state).ToString(UsCulture) : "0";
|
||||||
|
|
||||||
var args = string.Format("{0} {1} -i {2}{3} -map_metadata -1 -threads {4} {5} {6} -sc_threshold 0 {7} -hls_time {8} -start_number {9} -hls_list_size 1440 \"{10}\"",
|
var args = string.Format("{0} {1} -i {2}{3} -map_metadata -1 -threads {4} {5} {6} -sc_threshold 0 {7} -hls_time {8} -start_number {9} -hls_list_size {10} \"{11}\"",
|
||||||
itsOffset,
|
itsOffset,
|
||||||
inputModifier,
|
inputModifier,
|
||||||
GetInputArgument(state),
|
GetInputArgument(state),
|
||||||
@ -296,6 +296,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
GetAudioArguments(state),
|
GetAudioArguments(state),
|
||||||
state.SegmentLength.ToString(UsCulture),
|
state.SegmentLength.ToString(UsCulture),
|
||||||
startNumberParam,
|
startNumberParam,
|
||||||
|
state.HlsListSize.ToString(UsCulture),
|
||||||
outputPath
|
outputPath
|
||||||
).Trim();
|
).Trim();
|
||||||
|
|
||||||
@ -307,11 +308,12 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
|
|
||||||
var bitrate = hlsVideoRequest.BaselineStreamAudioBitRate ?? 64000;
|
var bitrate = hlsVideoRequest.BaselineStreamAudioBitRate ?? 64000;
|
||||||
|
|
||||||
var lowBitrateParams = string.Format(" -threads {0} -vn -codec:a:0 libmp3lame -ac 2 -ab {1} -hls_time {2} -start_number {3} -hls_list_size 1440 \"{4}\"",
|
var lowBitrateParams = string.Format(" -threads {0} -vn -codec:a:0 libmp3lame -ac 2 -ab {1} -hls_time {2} -start_number {3} -hls_list_size {4} \"{5}\"",
|
||||||
threads,
|
threads,
|
||||||
bitrate / 2,
|
bitrate / 2,
|
||||||
state.SegmentLength.ToString(UsCulture),
|
state.SegmentLength.ToString(UsCulture),
|
||||||
startNumberParam,
|
startNumberParam,
|
||||||
|
state.HlsListSize.ToString(UsCulture),
|
||||||
lowBitratePath);
|
lowBitratePath);
|
||||||
|
|
||||||
args += " " + lowBitrateParams;
|
args += " " + lowBitrateParams;
|
||||||
|
@ -163,7 +163,9 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
return IsH264(state.VideoStream) ? "-codec:v:0 copy -bsf h264_mp4toannexb" : "-codec:v:0 copy";
|
return IsH264(state.VideoStream) ? "-codec:v:0 copy -bsf h264_mp4toannexb" : "-codec:v:0 copy";
|
||||||
}
|
}
|
||||||
|
|
||||||
const string keyFrameArg = " -force_key_frames expr:if(isnan(prev_forced_t),gte(t,.1),gte(t,prev_forced_t+5))";
|
var keyFrameArg = state.ReadInputAtNativeFramerate ?
|
||||||
|
" -force_key_frames expr:if(isnan(prev_forced_t),gte(t,.1),gte(t,prev_forced_t+1))" :
|
||||||
|
" -force_key_frames expr:if(isnan(prev_forced_t),gte(t,.1),gte(t,prev_forced_t+5))";
|
||||||
|
|
||||||
var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsExternal &&
|
var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsExternal &&
|
||||||
(state.SubtitleStream.Codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 ||
|
(state.SubtitleStream.Codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||||
|
@ -56,6 +56,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
public string LiveTvStreamId { get; set; }
|
public string LiveTvStreamId { get; set; }
|
||||||
|
|
||||||
public int SegmentLength = 10;
|
public int SegmentLength = 10;
|
||||||
|
public int HlsListSize;
|
||||||
|
|
||||||
public long? RunTimeTicks;
|
public long? RunTimeTicks;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user