Changes between Version 87 and Version 88 of HWAccelIntro


Ignore:
Timestamp:
Jul 7, 2023, 1:19:43 PM (3 years ago)
Author:
Dmitrii Ovchinnikov
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HWAccelIntro

    v87 v88  
    272272
    273273On Windows, UVD is accessible via standard DXVA2/D3D11VA APIs, while VCE is supported via AMF.
     274The Advanced Media Framework (AMF) SDK provides developers with easy access to AMD GPUs for multimedia processing.
     275
     276AMF is effectively supported by FFmpeg to significantly speed up video encoding, decoding, and transcoding via AMD GPUs.
     277== Encoding ==
     278Currently AMF encoder supports H.264/AVC, H.265/HEVC, AV1 encoder. FFmpeg uses `_amf` as the postfix for the AMF encoder names. The command lines shown below may use `h264_amf`, and should be replaced by `hevc_amf` for H.265/HEVC encoder and `av1_amf` for AV1 encoder.
     279
     280{{{
     281ffmpeg -s 1920x1080 -pix_fmt yuv420p -i input.yuv -c:v h264_amf output.mp4
     282
     283ffmpeg -s 1920x1080 -pix_fmt yuv420p -i input.yuv -c:v hevc_amf output.mp4
     284
     285ffmpeg -s 1920x1080 -pix_fmt yuv420p -i input.yuv -c:v av1_amf output.mp4
     286}}}
     287
     288== Transcode ==
     289
     290There are two possible methods for transcoding: hardware decoding and hardware encoding, or software decoding and hardware encoding.
     291
     292**Hardware Decode and Hardware Encode**
     293
     294Use DX9 hardware decoder
     295
     296{{{
     297ffmpeg -hwaccel dxva2 -hwaccel_output_format dxva2_vld -i input.mkv -c:v av1_amf output.mp4
     298}}}
     299
     300Use DX11 hardware decoder
     301
     302{{{
     303ffmpeg -hwaccel d3d11va -hwaccel_output_format d3d11 -i input.mkv -c:v hevc_amf output.mp4
     304}}}
     305
     306The parameter `hwaccel_output_format` will specify the raw data (YUV) format after decoding.
     307
     308To avoid raw data copy between GPU memory and system memory, use `-hwaccel_output_format dxva2_vld` when using DX9 and use `-hwaccel_output_format d3d11` when using DX11. This will improve transcoding speed greatly. **This is the best setting we recommend for transcoding.**
     309
     310**Software Decode and Hardware Encode**
     311
     312Use the CPU to decode the input bitstream, and the GPU to encode the output stream.
     313
     314{{{
     315ffmpeg -i input.mkv -c:v av1_amf output.mp4
     316}}}
     317
     318The default software decoder corresponding to the elementary video stream will be used as the decoder.
     319
     320== Transcode with Scaling ==
     321
     322Scaling is a very common operation in transcoding. It is done through video filter in FFmpeg.
     323
     324**Hardware decode and hardware encode with scaling**
     325
     326{{{
     327ffmpeg -hwaccel d3d11va -i input.mkv  -vf scale=1280x720 -c:v h264_amf output.mp4
     328}}}
     329
     330If filter parameters are used in transcoding, users can’t set `hwaccel_output_format` parameters. In fact, the filter processing is finished in the CPU in the above example.
     331
     332**Software decode and hardware encode with scaling**
     333
     334In the following command line, both decoding and scaling are done via the CPU, and encoding is done via the GPU.
     335
     336{{{
     337ffmpeg -i input.mkv -vf scale=1280x720 -c:v h264_amf output.mp4
     338}}}
    274339
    275340= External resources =