浏览代码

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.
Nyanmisaka 5 年之前
父节点
当前提交
08c4d3797f
共有 1 个文件被更改,包括 4 次插入15 次删除
  1. 4 15
      MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs

+ 4 - 15
MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs

@@ -2642,22 +2642,11 @@ namespace MediaBrowser.Controller.MediaEncoding
                         else
                         else
                             return "-hwaccel dxva2";
                             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";
                     }
                     }
                 }
                 }
             }
             }