[Cin] HW Accel

Andrew Randrianasulu randrianasulu at gmail.com
Sat Apr 26 12:07:06 CEST 2025


сб, 26 апр. 2025 г., 12:23 Andrea paz via Cin <cin at lists.cinelerra-gg.org>:

> A few silly questions on topics already addressed several times. I was
> reading about hardware acceleration in ffmpeg.
> In my system ffmpeg I have:
>
> $ ffmpeg -hwaccels
> ffmpeg version n7.1 Copyright (c) 2000-2024 the FFmpeg developers
>   built with gcc 14.2.1 (GCC) 20250207
>   configuration: --prefix=/usr --disable-debug --disable-static
> --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm
> --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp
> --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom
> --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d
> --enable-libdrm --enable-libdvdnav --enable-libdvdread
> --enable-libfreetype --enable-libfribidi --enable-libglslang
> --enable-libgsm --enable-libharfbuzz --enable-libiec61883
> --enable-libjack --enable-libjxl --enable-libmodplug
> --enable-libmp3lame --enable-libopencore_amrnb
> --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt
> --enable-libopus --enable-libplacebo --enable-libpulse
> --enable-librav1e --enable-librsvg --enable-librubberband
> --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt
> --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2
> --enable-libvidstab --enable-libvmaf --enable-libvorbis
> --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264
> --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid
> --enable-libzimg --enable-libzmq --enable-nvdec --enable-nvenc
> --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth
> --enable-version3 --enable-vulkan
>   libavutil      59. 39.100 / 59. 39.100
>   libavcodec     61. 19.100 / 61. 19.100
>   libavformat    61.  7.100 / 61.  7.100
>   libavdevice    61.  3.100 / 61.  3.100
>   libavfilter    10.  4.100 / 10.  4.100
>   libswscale      8.  3.100 /  8.  3.100
>   libswresample   5.  3.100 /  5.  3.100
>   libpostproc    58.  3.100 / 58.  3.100
> Hardware acceleration methods:
> vdpau
> cuda
> vaapi
> qsv
> drm
> opencl
> vulkan
>
>
> If I try the same command with ffmpeg contained in
> .../thirdparty/ffmpeg-7.0 I get:
>
> ./ffmpeg -hwaccels
> Hardware acceleration methods:
> vdpau
> cuda
> vaapi
> vulkan
>
>
> So I guess OpenCL; Qsv and drm can only be obtained by manually
> compiling them. With what exact options in ./configure? (I never know
> when to use “--with-” and when to use “--enable-”).
>

I set two environment variables in Slackbuild:

EXTRA_LIBS=" -lOpenCL -lSvtAv1Enc -lvpl -ldav1d -lxvidcore -lass -lbluray
-lsnappy -lzimg" \       FFMPEG_EXTRA_CFG=" --enable-libvpl --disable-doc
--enable-opencl --enable-libsvtav1 --enable-frei0r --enable-libdav1d
--enable-libzimg --enable-libxvid --enable-libass --enable-libbluray
--enable-libsnappy --disable-debug --extra-cflags=-I/usr/local/include/vpl
--extra-cflags=-I/usr/include/svt-av1" \

before running configure and make.

You need to tweak them a bit gor your include path, or delete enables you
do not need.

Not sure if "drm" hwaccel will make any sense on desktop? Never tried to
use it .... Can you show some usage examples?



> “drm” can serve in CinGG?
>
> Another thing: vulkan is already included in CinGG, but I have never
> been able to activate the device and get it working. How to do that?
> With system ffmpeg I can activate it without any problems.
>


I only got my vulkan-capable gpu running yesterday ;)

I'am rebuilding vulkan-sdk and ffmpeg 7.1 to learn now libplacebo etc works
in standalone ffmpeg.
May be purely vulkan hw decode/encode need some tweaks in cingg code ....

>
> I am attaching the part of ffmpeg's documentation regarding hardware
> acceleration.
> The following part (regarding decoding) seems important to me:
> "Note that most acceleration methods are intended for playback and
> will not be faster than software decoding on modern CPUs.
> Additionally, ffmpeg will usually need to copy the decoded frames from
> the GPU memory into the system memory, resulting in further
> performance loss. This option is thus mainly useful for testing."
>
> As usual, I thought it would be a good thing to have playback in
> hardware but it is not. (However, there is a video of Adam where he
> manages to get better decoding with his Nvidia:
> https://www.youtube.com/watch?v=IZdJqrObnik).
>


Well, it speeds up things for me on 32bit cinelerra-gg, and most
importantly frees up system ram/virtual size so 4k encode does not crash ;)

You can try to bench your pcie bus speed:

echo 4 | sudo tee /sys/kernel/debug/dri/1/amdgpu_benchmark

and watch answer in dmesg ;)

For me it does not exceed 3 GiB/s, also running nvtop shows during cingg's
vaapi decode around 1.2Gb of data comes out of gpu (8 lanes * pcie 2.0).

Integrated APU from AMD or intel probably can go faster, I was really
surprized how fast decoding become on Sandybridge-based laptop when I
enabled vaapi for decode!

-- 
> Cin mailing list
> Cin at lists.cinelerra-gg.org
> https://lists.cinelerra-gg.org/mailman/listinfo/cin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20250426/1b54b253/attachment.htm>


More information about the Cin mailing list