add support for AMF hardware encoding on Linux.

1) h264_amf is now supported on linux with 'amdgpu-pro' installed and '--enable-amf' when compiling ffmpeg.
2) Using vaapi decode and h264_amf encode on linux platform can avoid some weird transcoding errors in h264_vaapi with amd gpu.
This commit is contained in:
Nyanmisaka 2020-01-12 21:38:28 +08:00 committed by GitHub
parent e95239e281
commit 08c4d3797f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2642,22 +2642,11 @@ namespace MediaBrowser.Controller.MediaEncoding
else
return "-hwaccel dxva2";
}
switch (videoStream.Codec.ToLowerInvariant())
else
{
case "avc":
case "h264":
if (_mediaEncoder.SupportsDecoder("h264_amf") && encodingOptions.HardwareDecodingCodecs.Contains("h264", StringComparer.OrdinalIgnoreCase))
{
return "-c:v h264_amf";
}
break;
case "mpeg2video":
if (_mediaEncoder.SupportsDecoder("hevc_amf") && encodingOptions.HardwareDecodingCodecs.Contains("mpeg2video", StringComparer.OrdinalIgnoreCase))
{
return "-c:v mpeg2_mmal";
}
break;
//h264_amf is now supported on linux with 'amdgpu-pro' installed and '--enable-amf' when compiling ffmpeg
//using vaapi decode and h264_amf encode on linux platform can avoid some weird transcoding errors in h264_vaapi with amd gpu
return "-hwaccel vaapi";
}
}
}