News:

--

Main Menu

GPU for decode and encode in avidemux?

Started by jamesmustain, February 22, 2021, 03:30:20 AM

Previous topic - Next topic

jamesmustain

[Spam removed]

eumagga0x2a

On Linux, both HW accelerated encoding and decoding (at least for H.264 and HEVC) should be available using VA-API (should be, completely untested on AMD hardware). However, current design of Avidemux does not allow to pass hardware surfaces from decoder to encoder (only from decoder to display), forcing download of decoded data to system memory and very costly NV12 to YV12 pixel format conversion followed by less demanding YV12 to NV12 conversion and re-upload of the pixel data to the graphics card.

Additionally, HW acceleration is mutually exclusive with multi-threaded decoding. Depending on video codec and resolution, both can not only destroy performance gains on decoder side but actually are able to turn them into their opposite with modern powerful multi-core CPUs. HW accelerated encoding, when available, is usually orders of magnitude faster than encoding in software, so this is always beneficial speed-wise. Despite "Intrel" in the names of respective encoders in Avidemux, they should work with all graphics cards exposing their encoder units via VA-API.

VA-API decoding in Avidemux is highly recommended for copy mode when also using libva display.

On Windows, no HW accelerated encoding on non-NVIDIA hardware and no sharing of HW surfaces is possible. HW accelerated decoding is available using the vendor-neutral DXVA2 interface, which suffers from the same performance penalty from NV12 --> YV12 conversion as VA-API.

With the target of benefitting most from HW accel in Avidemux right now, you should have bought a NVIDIA graphics card.

eumagga0x2a

I should have added that you need to use latest nightlies to use multi-threaded decoding by libavcodec. Earlier versions like the 2.7.6 release had the switch in Preferences, but multi-threaded decoding in libavcodec was always disabled.

butterw

- The speed advantage of Hardware-Encoder vs. software-encoder is typically much greater than HW-decoder vs SW-decoder.  But the compression efficiency achieved with Hardware Encoding is inferior vs software-encoding.

- If I understood the reply correctly, there is only limited benefit from using HW-accelerated decoding in Avidemux when  encoding (because there is a forced conversion from NV12 to YV12 and transfer to cpu), and multi-threaded libavcodec cpu decoding available in nightly version may be preferable.

 

eumagga0x2a

Quote from: butterw on February 22, 2021, 03:12:52 PMbecause there is a forced conversion from NV12 to YV12

Not with VDPAU on Linux and not with VideoToolbox on macOS. "Just" VA-API on Linux and DXVA2 on Windows.