Opened 2 hours ago

Last modified 36 minutes ago

#11271 new enhancement

How to choose the best hwaccel?

Reported by: Mads Johansen Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I have been using auto and consistently gotten dxva2 as the result.
For example ffmpeg -hwaccel auto -i input output will write [vist#0:0/h264 @ 0000021c3915e700] [dec:h264 @ 0000021c39fa4740] Using auto hwaccel type dxva2 with new default device.

With ffmpeg -hwaccels I get

ffmpeg version N-117642-g08b1bffa49 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 14.2.0 (Rev1, Built by MSYS2 project)
  configuration:  --pkg-config=pkgconf --cc='ccache gcc' --cxx='ccache g++' --ld='ccache g++' --extra-cxxflags=-fpermissive --extra-cflags=-Wno-int-conversion --disable-autodetect --enable-cuda --enable-cuvid --enable-d3d12va --enable-d3d11va --enable-dxva2 --enable-nvenc --enable-ffnvcodec --enable-nvdec --enable-cuda-llvm --enable-libvmaf --enable-libaom --enable-libvpx --enable-libx264 --enable-libx265 --disable-debug --enable-gpl --enable-vulkan --enable-libplacebo --enable-opencl --enable-schannel --disable-w32threads
  libavutil      59. 45.100 / 59. 45.100
  libavcodec     61. 22.100 / 61. 22.100
  libavformat    61.  9.100 / 61.  9.100
  libavdevice    61.  4.100 / 61.  4.100
  libavfilter    10.  6.100 / 10.  6.100
  libswscale      8.  9.100 /  8.  9.100
  libswresample   5.  4.100 /  5.  4.100
  libpostproc    58.  4.100 / 58.  4.100
Hardware acceleration methods:
cuda
dxva2
d3d11va
opencl
vulkan
d3d12va

My assumption is that the hwaccel option talks with the hardware, so by changing the option the only thing that will be different (for supported codecs) is the speed of the method.

So my question is: How do I chose which (if any, other than auto) hwaccel to choose use?
As methodology for the an informed choice, I would use standard H264 (for example h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 3840x2160, 25000 kb/s, 25 fps, 25 tbr, 25k tbn (default)) and use any of the above hwaccels, read the file with hwaccel number -> output to NULL and benchmark the wall time each hwaccel takes and chose the fastest.

Change History (1)

comment:1 by Balling, 36 minutes ago

So, the way I do it, if d3d11 fails I use nvdec, if even it fails I use -c:v hevc_cuvid as input option.

Nvdec is probably the best.

Note: See TracTickets for help on using tickets.