update live tv transcoding params

This commit is contained in:
Luke Pulverenti 2016-10-22 15:21:50 -04:00
parent 10383a90e6
commit 7e05f03f09
5 changed files with 25 additions and 9 deletions

View File

@ -352,6 +352,11 @@ namespace MediaBrowser.Api.Playback
return defaultEncoder; return defaultEncoder;
} }
protected virtual string GetDefaultH264Preset()
{
return "superfast";
}
/// <summary> /// <summary>
/// Gets the video bitrate to specify on the command line /// Gets the video bitrate to specify on the command line
/// </summary> /// </summary>
@ -375,7 +380,7 @@ namespace MediaBrowser.Api.Playback
} }
else else
{ {
param += "-preset superfast"; param += "-preset " + GetDefaultH264Preset();
} }
if (encodingOptions.H264Crf >= 0 && encodingOptions.H264Crf <= 51) if (encodingOptions.H264Crf >= 0 && encodingOptions.H264Crf <= 51)

View File

@ -256,7 +256,7 @@ namespace MediaBrowser.Api.Playback.Hls
"hls/" + Path.GetFileNameWithoutExtension(outputPath)); "hls/" + Path.GetFileNameWithoutExtension(outputPath));
} }
var args = string.Format("{0} {1} {2} -map_metadata -1 -threads {3} {4} {5} -sc_threshold 0 {6} -hls_time {7} -start_number {8} -hls_list_size {9}{10} -y \"{11}\"", var args = string.Format("{0} {1} {2} -map_metadata -1 -threads {3} {4} {5} -avoid_negative_ts make_zero -fflags +genpts -sc_threshold 0 {6} -hls_time {7} -start_number {8} -hls_list_size {9}{10} -y \"{11}\"",
itsOffset, itsOffset,
inputModifier, inputModifier,
GetInputArgument(state), GetInputArgument(state),
@ -274,6 +274,11 @@ namespace MediaBrowser.Api.Playback.Hls
return args; return args;
} }
protected override string GetDefaultH264Preset()
{
return "veryfast";
}
protected virtual int GetStartNumber(StreamState state) protected virtual int GetStartNumber(StreamState state)
{ {
return 0; return 0;

View File

@ -91,6 +91,7 @@ namespace MediaBrowser.Api.Playback.Hls
{ {
args += " -bsf:v h264_mp4toannexb"; args += " -bsf:v h264_mp4toannexb";
} }
args += " -flags +global_header";
return args; return args;
} }
@ -113,7 +114,7 @@ namespace MediaBrowser.Api.Playback.Hls
args += GetGraphicalSubtitleParam(state, codec); args += GetGraphicalSubtitleParam(state, codec);
} }
args += " -flags -global_header"; args += " -flags +global_header";
return args; return args;
} }

View File

@ -150,6 +150,11 @@ namespace MediaBrowser.Api.Playback.Progressive
args += " -copyts -avoid_negative_ts disabled -start_at_zero"; args += " -copyts -avoid_negative_ts disabled -start_at_zero";
} }
if (!state.RunTimeTicks.HasValue)
{
args += " -fflags +genpts -flags +global_header";
}
return args; return args;
} }
@ -191,6 +196,11 @@ namespace MediaBrowser.Api.Playback.Progressive
args += GetGraphicalSubtitleParam(state, videoCodec); args += GetGraphicalSubtitleParam(state, videoCodec);
} }
if (!state.RunTimeTicks.HasValue)
{
args += " -fflags +genpts -flags +global_header";
}
return args; return args;
} }

View File

@ -159,15 +159,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
private async Task AddMediaInfo(MediaSourceInfo mediaSource, bool isAudio, CancellationToken cancellationToken) private async Task AddMediaInfo(MediaSourceInfo mediaSource, bool isAudio, CancellationToken cancellationToken)
{ {
var originalRuntime = mediaSource.RunTimeTicks;
mediaSource.DefaultSubtitleStreamIndex = null; mediaSource.DefaultSubtitleStreamIndex = null;
// Null this out so that it will be treated like a live stream // Null this out so that it will be treated like a live stream
if (!originalRuntime.HasValue) mediaSource.RunTimeTicks = null;
{
mediaSource.RunTimeTicks = null;
}
var audioStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == Model.Entities.MediaStreamType.Audio); var audioStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == Model.Entities.MediaStreamType.Audio);