mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-05 21:37:10 -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)
|
||||
{
|
||||
return EncodingQuality.HighQuality;
|
||||
//return EncodingQuality.HighQuality;
|
||||
}
|
||||
|
||||
return EncodingQuality.HighSpeed;
|
||||
@ -1418,6 +1418,9 @@ namespace MediaBrowser.Api.Playback
|
||||
|
||||
state.HasMediaStreams = mediaStreams.Count > 0;
|
||||
|
||||
state.SegmentLength = state.ReadInputAtNativeFramerate ? 3 : 10;
|
||||
state.HlsListSize = state.ReadInputAtNativeFramerate ? 20 : 1440;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
// If performSubtitleConversions is true we're actually starting ffmpeg
|
||||
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,
|
||||
inputModifier,
|
||||
GetInputArgument(state),
|
||||
@ -296,6 +296,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
GetAudioArguments(state),
|
||||
state.SegmentLength.ToString(UsCulture),
|
||||
startNumberParam,
|
||||
state.HlsListSize.ToString(UsCulture),
|
||||
outputPath
|
||||
).Trim();
|
||||
|
||||
@ -307,11 +308,12 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
|
||||
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,
|
||||
bitrate / 2,
|
||||
state.SegmentLength.ToString(UsCulture),
|
||||
startNumberParam,
|
||||
state.HlsListSize.ToString(UsCulture),
|
||||
lowBitratePath);
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
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 &&
|
||||
(state.SubtitleStream.Codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||
|
@ -56,6 +56,7 @@ namespace MediaBrowser.Api.Playback
|
||||
public string LiveTvStreamId { get; set; }
|
||||
|
||||
public int SegmentLength = 10;
|
||||
public int HlsListSize;
|
||||
|
||||
public long? RunTimeTicks;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user