drop the unnecessary colorspace conversion
Since 'hwdownload, format = nv12' has completed the conversion of colorspace. 'format = p010le' is redundant and will reduce the speed by almost half under the premise of unchanged cpu usage.
This commit is contained in:
parent
a5249730d7
commit
0ecac47098
|
@ -1605,7 +1605,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
// For VAAPI and CUVID decoder
|
// For VAAPI and CUVID decoder
|
||||||
// these encoders cannot automatically adjust the size of graphical subtitles to fit the output video,
|
// these encoders cannot automatically adjust the size of graphical subtitles to fit the output video,
|
||||||
// thus needs to be manually adjusted.
|
// thus needs to be manually adjusted.
|
||||||
if (IsVaapiSupported(state) && string.Equals(options.HardwareAccelerationType, "vaapi", StringComparison.OrdinalIgnoreCase)
|
if (string.Equals(options.HardwareAccelerationType, "vaapi", StringComparison.OrdinalIgnoreCase)
|
||||||
|| (videoDecoder ?? string.Empty).IndexOf("cuvid", StringComparison.OrdinalIgnoreCase) != -1)
|
|| (videoDecoder ?? string.Empty).IndexOf("cuvid", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
{
|
{
|
||||||
var videoStream = state.VideoStream;
|
var videoStream = state.VideoStream;
|
||||||
|
@ -2020,19 +2020,13 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
var codec = videoStream.Codec.ToLowerInvariant();
|
var codec = videoStream.Codec.ToLowerInvariant();
|
||||||
var pixelFormat = videoStream.PixelFormat.ToLowerInvariant();
|
var pixelFormat = videoStream.PixelFormat.ToLowerInvariant();
|
||||||
|
|
||||||
// Assert 10-bit hardware VAAPI decodable
|
// Assert hardware VAAPI decodable (Except h264 10-bit and higher color depth)
|
||||||
if ((pixelFormat ?? string.Empty).IndexOf("p10", StringComparison.OrdinalIgnoreCase) != -1
|
// TODO: a propery way to detect hardware capabilities and falling back when transcoding is failed
|
||||||
&& (string.Equals(codec, "hevc", StringComparison.OrdinalIgnoreCase)
|
if ((pixelFormat ?? string.Empty).IndexOf("p10", StringComparison.OrdinalIgnoreCase) == -1
|
||||||
|| string.Equals(codec, "h265", StringComparison.OrdinalIgnoreCase)
|
|| ((pixelFormat ?? string.Empty).IndexOf("p10", StringComparison.OrdinalIgnoreCase) != -1
|
||||||
|| string.Equals(codec, "vp9", StringComparison.OrdinalIgnoreCase)))
|
&& (string.Equals(codec, "hevc", StringComparison.OrdinalIgnoreCase)
|
||||||
{
|
|| string.Equals(codec, "h265", StringComparison.OrdinalIgnoreCase)
|
||||||
filters.Add("hwdownload");
|
|| string.Equals(codec, "vp9", StringComparison.OrdinalIgnoreCase))))
|
||||||
filters.Add("format=p010le");
|
|
||||||
filters.Add("format=nv12");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assert 8-bit hardware VAAPI decodable
|
|
||||||
else if ((pixelFormat ?? string.Empty).IndexOf("p10", StringComparison.OrdinalIgnoreCase) == -1)
|
|
||||||
{
|
{
|
||||||
filters.Add("hwdownload");
|
filters.Add("hwdownload");
|
||||||
filters.Add("format=nv12");
|
filters.Add("format=nv12");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user