mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-24 22:48:56 +02:00
support additional encoding switches
This commit is contained in:
parent
bdf27b81c1
commit
92eeee0fc5
|
@ -879,7 +879,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
// Add resolution params, if specified
|
// Add resolution params, if specified
|
||||||
if (!hasGraphicalSubs)
|
if (!hasGraphicalSubs)
|
||||||
{
|
{
|
||||||
args += EncodingHelper.GetOutputSizeParam(state, codec, EnableCopyTs(state));
|
args += EncodingHelper.GetOutputSizeParam(state, codec, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is for internal graphical subs
|
// This is for internal graphical subs
|
||||||
|
@ -891,7 +891,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
//args += " -flags -global_header";
|
//args += " -flags -global_header";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EnableCopyTs(state) && args.IndexOf("-copyts", StringComparison.OrdinalIgnoreCase) == -1)
|
if (args.IndexOf("-copyts", StringComparison.OrdinalIgnoreCase) == -1)
|
||||||
{
|
{
|
||||||
args += " -copyts";
|
args += " -copyts";
|
||||||
}
|
}
|
||||||
|
@ -901,13 +901,9 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
args += " -vsync " + state.OutputVideoSync;
|
args += " -vsync " + state.OutputVideoSync;
|
||||||
}
|
}
|
||||||
|
|
||||||
return args;
|
args += EncodingHelper.GetOutputFFlags(state);
|
||||||
}
|
|
||||||
|
|
||||||
private bool EnableCopyTs(StreamState state)
|
return args;
|
||||||
{
|
|
||||||
//return state.SubtitleStream != null && state.SubtitleStream.IsTextSubtitleStream && state.VideoRequest.SubtitleMethod == SubtitleDeliveryMethod.Encode;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string GetCommandLineArguments(string outputPath, StreamState state, bool isEncoding)
|
protected override string GetCommandLineArguments(string outputPath, StreamState state, bool isEncoding)
|
||||||
|
|
|
@ -124,6 +124,8 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
args += " -vsync " + state.OutputVideoSync;
|
args += " -vsync " + state.OutputVideoSync;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
args += EncodingHelper.GetOutputFFlags(state);
|
||||||
|
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1306,7 +1306,8 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
filters.Add("format=nv12|vaapi");
|
filters.Add("format=nv12|vaapi");
|
||||||
filters.Add("hwupload");
|
filters.Add("hwupload");
|
||||||
}
|
}
|
||||||
else if (state.DeInterlace && !string.Equals(outputVideoCodec, "h264_vaapi", StringComparison.OrdinalIgnoreCase))
|
|
||||||
|
if (state.DeInterlace && !string.Equals(outputVideoCodec, "h264_vaapi", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
filters.Add("yadif=0:-1:0");
|
filters.Add("yadif=0:-1:0");
|
||||||
}
|
}
|
||||||
|
@ -1533,14 +1534,26 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
}
|
}
|
||||||
|
|
||||||
var flags = new List<string>();
|
var flags = new List<string>();
|
||||||
if (state.IgnoreDts)
|
if (state.IgnoreInputDts)
|
||||||
{
|
{
|
||||||
flags.Add("+igndts");
|
flags.Add("+igndts");
|
||||||
}
|
}
|
||||||
if (state.IgnoreIndex)
|
if (state.IgnoreInputIndex)
|
||||||
{
|
{
|
||||||
flags.Add("+ignidx");
|
flags.Add("+ignidx");
|
||||||
}
|
}
|
||||||
|
if (state.GenPtsInput)
|
||||||
|
{
|
||||||
|
flags.Add("+genpts");
|
||||||
|
}
|
||||||
|
if (state.DiscardCorruptFramesInput)
|
||||||
|
{
|
||||||
|
flags.Add("+discardcorrupt");
|
||||||
|
}
|
||||||
|
if (state.EnableFastSeekInput)
|
||||||
|
{
|
||||||
|
flags.Add("+fastseek");
|
||||||
|
}
|
||||||
|
|
||||||
if (flags.Count > 0)
|
if (flags.Count > 0)
|
||||||
{
|
{
|
||||||
|
@ -1864,6 +1877,22 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
).Trim();
|
).Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetOutputFFlags(EncodingJobInfo state)
|
||||||
|
{
|
||||||
|
var flags = new List<string>();
|
||||||
|
if (state.GenPtsOutput)
|
||||||
|
{
|
||||||
|
flags.Add("+genpts");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags.Count > 0)
|
||||||
|
{
|
||||||
|
return " -fflags " + string.Join("", flags.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
public string GetProgressiveVideoArguments(EncodingJobInfo state, EncodingOptions encodingOptions, string videoCodec, string defaultH264Preset)
|
public string GetProgressiveVideoArguments(EncodingJobInfo state, EncodingOptions encodingOptions, string videoCodec, string defaultH264Preset)
|
||||||
{
|
{
|
||||||
var args = "-codec:v:0 " + videoCodec;
|
var args = "-codec:v:0 " + videoCodec;
|
||||||
|
@ -1943,6 +1972,8 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
args += " -vsync " + state.OutputVideoSync;
|
args += " -vsync " + state.OutputVideoSync;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
args += GetOutputFFlags(state);
|
||||||
|
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,14 +39,52 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
|
|
||||||
public bool ReadInputAtNativeFramerate { get; set; }
|
public bool ReadInputAtNativeFramerate { get; set; }
|
||||||
|
|
||||||
public bool IgnoreDts
|
public bool IgnoreInputDts
|
||||||
{
|
{
|
||||||
get { return MediaSource.IgnoreDts; }
|
get
|
||||||
|
{
|
||||||
|
return MediaSource.IgnoreDts;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IgnoreIndex
|
public bool IgnoreInputIndex
|
||||||
{
|
{
|
||||||
get { return MediaSource.IgnoreIndex; }
|
get
|
||||||
|
{
|
||||||
|
return MediaSource.IgnoreIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool GenPtsInput
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool DiscardCorruptFramesInput
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool EnableFastSeekInput
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool GenPtsOutput
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string OutputContainer { get; set; }
|
public string OutputContainer { get; set; }
|
||||||
|
|
Loading…
Reference in a new issue