Added linux support for amf encoder through vulkan. To use h.264(AMD VCE) encoder on linux amdgru-pro version 19.20+ and amf-amdgpu-pro package(amdgru-pro contains, but does not install automatically) are required. This driver can be installed using amdgpu-pro-install script in official amd driver archive. Initialization of amf encoder occurs in this order: 1) trying to initialize through dx11(only windows) 2) trying to initialize through dx9(only windows) 3) trying to initialize through vulkan Only Vulkan initialization available on linux.
Unified · Split
| @@ -6,6 +6,7 @@ version <next>: · 5 unmodified lines | ||
| 6 | 6 | - Intel QSV-accelerated MJPEG decoding |
| 7 | 7 | - Intel QSV-accelerated VP9 decoding |
| 8 | 8 | - support for TrueHD in mp4 |
| 9 | +- Supoort AMD AMF encoder on Linux (via Vulkan) | |
| 9 | 10 | |
| 10 | 11 | |
| 11 | 12 | version 4.2: |
| @@ -27,16 +27,26 @@ enable it. · 26 unmodified lines | ||
| 27 | 27 | |
| 28 | 28 | @section AMD AMF/VCE |
| 29 | 29 | |
| 30 | −FFmpeg can use the AMD Advanced Media Framework library under Windows | |
| 31 | −for accelerated H.264 and HEVC encoding on hardware with Video Coding Engine (VCE). | |
| 30 | +FFmpeg can use the AMD Advanced Media Framework library | |
| 31 | +for accelerated H.264 and HEVC(only windows) encoding on hardware with Video Coding Engine (VCE). | |
| 32 | 32 | |
| 33 | −To enable support you must obtain the AMF framework header files from | |
| 33 | +To enable support you must obtain the AMF framework header files(version 1.4.9+) from | |
| 34 | 34 | @url{https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git}. |
| 35 | 35 | |
| 36 | 36 | Create an @code{AMF/} directory in the system include path. |
| 37 | 37 | Copy the contents of @code{AMF/amf/public/include/} into that directory. |
| 38 | 38 | Then configure FFmpeg with @code{--enable-amf}. |
| 39 | 39 | |
| 40 | +Initialization of amf encoder occurs in this order: | |
| 41 | +1) trying to initialize through dx11(only windows) | |
| 42 | +2) trying to initialize through dx9(only windows) | |
| 43 | +3) trying to initialize through vulkan | |
| 44 | + | |
| 45 | +To use h.264(AMD VCE) encoder on linux amdgru-pro version 19.20+ and amf-amdgpu-pro | |
| 46 | +package(amdgru-pro contains, but does not install automatically) are required. | |
| 47 | + | |
| 48 | +This driver can be installed using amdgpu-pro-install script in official amd driver archive. | |
| 49 | + | |
| 40 | 50 | @section AviSynth |
| 41 | 51 | |
| 42 | 52 | FFmpeg can read AviSynth scripts as input. To enable support, pass |
| @@ -213,6 +213,7 @@ static int amf_init_from_dxva2_device(AVCodecContext *avctx, AVDXVA2DeviceContex · 212 unmodified lines | ||
| 213 | 213 | static int amf_init_context(AVCodecContext *avctx) |
| 214 | 214 | { |
| 215 | 215 | AmfContext *ctx = avctx->priv_data; |
| 216 | + AMFContext1 *context1 = NULL; | |
| 216 | 217 | AMF_RESULT res; |
| 217 | 218 | av_unused int ret; |
| 218 | 219 | |
| @@ -311,8 +312,20 @@ static int amf_init_context(AVCodecContext *avctx) · 92 unmodified lines | ||
| 311 | 312 | if (res == AMF_OK) { |
| 312 | 313 | av_log(avctx, AV_LOG_VERBOSE, "AMF initialisation succeeded via D3D9.\n"); |
| 313 | 314 | } else { |
| 314 | − av_log(avctx, AV_LOG_ERROR, "AMF initialisation failed via D3D9: error %d.\n", res); | |
| 315 | − return AVERROR(ENOSYS); | |
| 315 | + AMFGuid guid = IID_AMFContext1(); | |
| 316 | + res = ctx->context->pVtbl->QueryInterface(ctx->context, &guid, (void**)&context1); | |
| 317 | + AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR_UNKNOWN, "CreateContext1() failed with error %d\n", res); | |
| 318 | + | |
| 319 | + res = context1->pVtbl->InitVulkan(context1, NULL); | |
| 320 | + context1->pVtbl->Release(context1); | |
| 321 | + if (res != AMF_OK) { | |
| 322 | + if (res == AMF_NOT_SUPPORTED) | |
| 323 | + av_log(avctx, AV_LOG_ERROR, "AMF via Vulkan is not supported on the given device.\n"); | |
| 324 | + else | |
| 325 | + av_log(avctx, AV_LOG_ERROR, "AMF failed to initialise on the given Vulkan device: %d.\n", res); | |
| 326 | + return AVERROR(ENOSYS); | |
| 327 | + } | |
| 328 | + av_log(avctx, AV_LOG_VERBOSE, "AMF initialisation succeeded via Vulkan.\n"); | |
| 316 | 329 | } |
| 317 | 330 | } |
| 318 | 331 | } |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | #define LIBAVCODEC_VERSION_MAJOR 58 |
| 31 | 31 | #define LIBAVCODEC_VERSION_MINOR 55 |
| 32 | −#define LIBAVCODEC_VERSION_MICRO 101 | |
| 32 | +#define LIBAVCODEC_VERSION_MICRO 102 | |
| 33 | 33 | |
| 34 | 34 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| 35 | 35 | LIBAVCODEC_VERSION_MINOR, \ |