|
|
|
@ -2090,6 +2090,9 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|
|
|
|
var hasTextSubs = state.SubtitleStream != null && state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
|
|
|
|
var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
|
|
|
|
|
|
|
|
|
// If double rate deinterlacing is enabled and the input framerate is 30fps or below, otherwise the output framerate will be too high for many devices
|
|
|
|
|
var doubleRateDeinterlace = options.DeinterlaceDoubleRate && (videoStream?.RealFrameRate ?? 60) <= 30;
|
|
|
|
|
|
|
|
|
|
// When the input may or may not be hardware VAAPI decodable
|
|
|
|
|
if (isVaapiH264Encoder)
|
|
|
|
|
{
|
|
|
|
@ -2136,35 +2139,38 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|
|
|
|
{
|
|
|
|
|
if (isVaapiH264Encoder)
|
|
|
|
|
{
|
|
|
|
|
filters.Add(string.Format(CultureInfo.InvariantCulture, "deinterlace_vaapi"));
|
|
|
|
|
filters.Add(
|
|
|
|
|
string.Format(
|
|
|
|
|
CultureInfo.InvariantCulture,
|
|
|
|
|
"deinterlace_vaapi=rate={0}",
|
|
|
|
|
doubleRateDeinterlace ? "field" : "frame"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add software deinterlace filter before scaling filter
|
|
|
|
|
if (state.DeInterlace("h264", true)
|
|
|
|
|
|| state.DeInterlace("avc", true)
|
|
|
|
|
|| state.DeInterlace("h265", true)
|
|
|
|
|
|| state.DeInterlace("hevc", true))
|
|
|
|
|
if ((state.DeInterlace("h264", true)
|
|
|
|
|
|| state.DeInterlace("avc", true)
|
|
|
|
|
|| state.DeInterlace("h265", true)
|
|
|
|
|
|| state.DeInterlace("hevc", true))
|
|
|
|
|
&& !isVaapiH264Encoder
|
|
|
|
|
&& !isQsvH264Encoder
|
|
|
|
|
&& !isNvdecH264Decoder)
|
|
|
|
|
{
|
|
|
|
|
string deintParam;
|
|
|
|
|
var inputFramerate = videoStream?.RealFrameRate;
|
|
|
|
|
|
|
|
|
|
// If it is already 60fps then it will create an output framerate that is much too high for roku and others to handle
|
|
|
|
|
if (string.Equals(options.DeinterlaceMethod, "yadif_bob", StringComparison.OrdinalIgnoreCase) && (inputFramerate ?? 60) <= 30)
|
|
|
|
|
if (string.Equals(options.DeinterlaceMethod, "bwdif", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
deintParam = "yadif=1:-1:0";
|
|
|
|
|
filters.Add(
|
|
|
|
|
string.Format(
|
|
|
|
|
CultureInfo.InvariantCulture,
|
|
|
|
|
"bwdif={0}:-1:0",
|
|
|
|
|
doubleRateDeinterlace ? "1" : "0"));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
deintParam = "yadif=0:-1:0";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(deintParam))
|
|
|
|
|
{
|
|
|
|
|
if (!isVaapiH264Encoder && !isQsvH264Encoder && !isNvdecH264Decoder)
|
|
|
|
|
{
|
|
|
|
|
filters.Add(deintParam);
|
|
|
|
|
}
|
|
|
|
|
filters.Add(
|
|
|
|
|
string.Format(
|
|
|
|
|
CultureInfo.InvariantCulture,
|
|
|
|
|
"yadif={0}:-1:0",
|
|
|
|
|
doubleRateDeinterlace ? "1" : "0"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2397,6 +2403,11 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|
|
|
|
if (state.DeInterlace("h264", true))
|
|
|
|
|
{
|
|
|
|
|
inputModifier += " -deint 1";
|
|
|
|
|
|
|
|
|
|
if (!encodingOptions.DeinterlaceDoubleRate || (videoStream?.RealFrameRate ?? 60) > 30)
|
|
|
|
|
{
|
|
|
|
|
inputModifier += " -drop_second_field 1";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|