|
|
@ -1625,31 +1625,12 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|
|
|
|
|
|
|
|
|
|
|
var videoSizeParam = string.Empty;
|
|
|
|
var videoSizeParam = string.Empty;
|
|
|
|
var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, options) ?? string.Empty;
|
|
|
|
var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, options) ?? string.Empty;
|
|
|
|
|
|
|
|
var isWindows = Environment.OSVersion.Platform == PlatformID.Win32NT;
|
|
|
|
|
|
|
|
|
|
|
|
// Setup subtitle scaling
|
|
|
|
// Setup subtitle scaling
|
|
|
|
if (state.VideoStream != null && state.VideoStream.Width.HasValue && state.VideoStream.Height.HasValue)
|
|
|
|
if (state.VideoStream != null && state.VideoStream.Width.HasValue && state.VideoStream.Height.HasValue)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
videoSizeParam = string.Format(
|
|
|
|
// Adjust the size of graphical subtitles to fit the video stream.
|
|
|
|
CultureInfo.InvariantCulture,
|
|
|
|
|
|
|
|
"scale={0}x{1}",
|
|
|
|
|
|
|
|
state.VideoStream.Width.Value,
|
|
|
|
|
|
|
|
state.VideoStream.Height.Value);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// For QSV, feed it into hardware encoder now
|
|
|
|
|
|
|
|
var isWindows = Environment.OSVersion.Platform == PlatformID.Win32NT;
|
|
|
|
|
|
|
|
if (!isWindows && string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
videoSizeParam += ",hwupload=extra_hw_frames=64";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// For VAAPI and NVDEC decoder
|
|
|
|
|
|
|
|
// these encoders cannot automatically adjust the size of graphical subtitles to fit the output video,
|
|
|
|
|
|
|
|
// thus needs to be manually adjusted.
|
|
|
|
|
|
|
|
if (videoDecoder.IndexOf("cuvid", StringComparison.OrdinalIgnoreCase) != -1
|
|
|
|
|
|
|
|
|| (IsVaapiSupported(state) && string.Equals(options.HardwareAccelerationType, "vaapi", StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|
|
|
&& (videoDecoder.IndexOf("vaapi", StringComparison.OrdinalIgnoreCase) != -1
|
|
|
|
|
|
|
|
|| outputVideoCodec.IndexOf("vaapi", StringComparison.OrdinalIgnoreCase) != -1)))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var videoStream = state.VideoStream;
|
|
|
|
var videoStream = state.VideoStream;
|
|
|
|
var inputWidth = videoStream?.Width;
|
|
|
|
var inputWidth = videoStream?.Width;
|
|
|
|
var inputHeight = videoStream?.Height;
|
|
|
|
var inputHeight = videoStream?.Height;
|
|
|
@ -1663,6 +1644,11 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|
|
|
width.Value,
|
|
|
|
width.Value,
|
|
|
|
height.Value);
|
|
|
|
height.Value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// For QSV, feed it into hardware encoder now
|
|
|
|
|
|
|
|
if (!isWindows && string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
videoSizeParam += ",hwupload=extra_hw_frames=64";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1710,7 +1696,6 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|
|
|
with fixed frame size.
|
|
|
|
with fixed frame size.
|
|
|
|
Currently only supports linux.
|
|
|
|
Currently only supports linux.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
var isWindows = Environment.OSVersion.Platform == PlatformID.Win32NT;
|
|
|
|
|
|
|
|
if (!isWindows)
|
|
|
|
if (!isWindows)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
retStr = !string.IsNullOrEmpty(outputSizeParam) ?
|
|
|
|
retStr = !string.IsNullOrEmpty(outputSizeParam) ?
|
|
|
|