Hardware Video Encoding Setup (newbie)

I am new to manjaro and want to use my GPUs hardware encoder, I have an Radeon Rx 5600 xt and I’m trying to use Handbrake to re-encode a bunch of files but I’m lost.
So from my understanding in order to use my gpu’s encoder with handbrake I have to make sure vaapi is enabled in ffmpeg, Its not. I know I need to re-build FFmpeg with vaapi enable and I’m not sure how to do that

I don’t think you need to rebuild it.

See

https://wiki.archlinux.org/index.php/FFmpeg#Hardware_video_acceleration

And
https://wiki.archlinux.org/index.php/Hardware_video_acceleration

I’m pretty positive I do. Specifically this note about about needing to check the buildconf.

"Note: The flag --enable-vaapi needs to be configured to use VA-API with ffmpeg, which ffmpeg does not contain. You can check the configuration of ffmpeg: ffmpeg -buildconf"

when I check the build config its not included.

side note, can I not include screenshots in form posts or am I just dumb?

  configuration:
    --prefix=/usr
    --disable-debug
    --disable-static
    --disable-stripping
    --enable-amf
    --enable-avisynth
    --enable-cuda-llvm
    --enable-lto
    --enable-fontconfig
    --enable-gmp
    --enable-gnutls
    --enable-gpl
    --enable-ladspa
    --enable-libaom
    --enable-libass
    --enable-libbluray
    --enable-libdav1d
    --enable-libdrm
    --enable-libfreetype
    --enable-libfribidi
    --enable-libgsm
    --enable-libiec61883
    --enable-libjack
    --enable-libmfx
    --enable-libmodplug
    --enable-libmp3lame
    --enable-libopencore_amrnb
    --enable-libopencore_amrwb
    --enable-libopenjpeg
    --enable-libopus
    --enable-libpulse
    --enable-librav1e
    --enable-libsoxr
    --enable-libspeex
    --enable-libsrt
    --enable-libssh
    --enable-libtheora
    --enable-libv4l2
    --enable-libvidstab
    --enable-libvmaf
    --enable-libvorbis
    --enable-libvpx
    --enable-libwebp
    --enable-libx264
    --enable-libx265
    --enable-libxcb
    --enable-libxml2
    --enable-libxvid
    --enable-libzimg
    --enable-nvdec
    --enable-nvenc
    --enable-shared
    --enable-version3

The easiest way is to uninstall ffmpeg and install it from AUR. ffmpeg-full should work fine, it has --enable-vaapi, as you can see in the PKGBUILD. There are other builds too if you want to look at them, but I think ffmpeg-full should be fine.

pamac build ffmpeg-full

New users cannot post screenshots. It is to prevent them from getting too used to / getting into a bad habit of posting screenshots which is looked down upon. It is a lot easier to help someone who posts text, instead of screenshots. Also, posting text allows other users to use the search function on the forum to find the post, allowing other users to find solutions to their issues as well.

Screenshots should only be used if absolutely necessary.

Also, in your “configuration” post, can you please edit it with ``` before and after the output?

Alternatively, highlight it all then press on the </> button.

2 Likes

Ok so this causes me a new problem with the build of ffmpeg-full and it also occurs with ffmpeg-amd -full. that I think has to do with the PKGBUILD

- unable to satisfy dependency 'libavcodec.so=58-64' required by vapoursynth
- unable to satisfy dependency 'libavformat.so=58-64' required by vapoursynth
- unable to satisfy dependency 'libavutil.so=56-64' required by vapoursynth

Oh sorry. Indeed. I didn’t read it properly and thought it was an argument rather than a build-config paramater.

Easiest way then is indeed to use one of the AUR ffmpeg packages with vaapi support as @realmain mentioned

Alternative is to download the arch PKGBUILD and additional files, modify the PKGBUILD file and add the build paramter. Then run makepkg -si to build and install.

Disadvantage with that is that you need manually maintain it and take action in case of updates…

It has something to do with this package:

This package is in our local repo though, so I don’t know why it’s having issues resolving the dependencies.

Can you please try to do sudo pacman vapoursynth or pamac install vapoursynth to install this package first?

so it seems to install vapoursynth without any problems, but gives me the same error if I try do install ffmpeg with pamac

sudo pacman -S vapoursynth
resolving dependencies...
looking for conflicting packages...

Packages (3) leptonica-1.80.0-1  tesseract-4.1.1-4  vapoursynth-R52-3

Total Download Size:    7.14 MiB
Total Installed Size:  20.78 MiB

:: Proceed with installation? [Y/n] Y
:: Retrieving packages...
 leptonica-1.80.0-1-x86_64                                              1160.4 KiB  1354 KiB/s 00:01 [###########################################################] 100%
 tesseract-4.1.1-4-x86_64                                                  5.2 MiB  11.3 MiB/s 00:00 [###########################################################] 100%
 vapoursynth-R52-3-x86_64                                                774.3 KiB  17.6 MiB/s 00:00 [###########################################################] 100%
(3/3) checking keys in keyring                                                                       [###########################################################] 100%
(3/3) checking package integrity                                                                     [###########################################################] 100%
(3/3) loading package files                                                                          [###########################################################] 100%
(3/3) checking for file conflicts                                                                    [###########################################################] 100%
(3/3) checking available disk space                                                                  [###########################################################] 100%
:: Processing package changes...
(1/3) installing leptonica                                                                           [###########################################################] 100%
(2/3) installing tesseract                                                                           [###########################################################] 100%
You must install one of tesseract-data-* packages or whole tesseract-data group
Optional dependencies for tesseract
    icu [installed]
    cairo [installed]
    pango [installed]
    tesseract-data-afr
    tesseract-data-ara
    tesseract-data-aze
    tesseract-data-bel
    tesseract-data-ben
    tesseract-data-bul
    tesseract-data-cat
    tesseract-data-ces
    tesseract-data-chi_sim
    tesseract-data-chi_tra
    tesseract-data-chr
    tesseract-data-dan
    tesseract-data-deu
    tesseract-data-ell
    tesseract-data-eng
    tesseract-data-enm
    tesseract-data-epo
    tesseract-data-equ
    tesseract-data-est
    tesseract-data-eus
    tesseract-data-fin
    tesseract-data-fra
    tesseract-data-frk
    tesseract-data-frm
    tesseract-data-glg
    tesseract-data-grc
    tesseract-data-heb
    tesseract-data-hin
    tesseract-data-hrv
    tesseract-data-hun
    tesseract-data-ind
    tesseract-data-isl
    tesseract-data-ita
    tesseract-data-ita_old
    tesseract-data-jpn
    tesseract-data-kan
    tesseract-data-kor
    tesseract-data-lav
    tesseract-data-lit
    tesseract-data-mal
    tesseract-data-mkd
    tesseract-data-mlt
    tesseract-data-msa
    tesseract-data-nld
    tesseract-data-nor
    tesseract-data-pol
    tesseract-data-por
    tesseract-data-ron
    tesseract-data-rus
    tesseract-data-slk
    tesseract-data-slv
    tesseract-data-spa
    tesseract-data-spa_old
    tesseract-data-sqi
    tesseract-data-srp
    tesseract-data-swa
    tesseract-data-swe
    tesseract-data-tam
    tesseract-data-tel
    tesseract-data-tgl
    tesseract-data-tha
    tesseract-data-tur
    tesseract-data-ukr
    tesseract-data-vie
(3/3) installing vapoursynth                                                                         [###########################################################] 100%
:: Running post-transaction hooks...
(1/2) Arming ConditionNeedsUpdate...
(2/2) Updating the MIME type database...

but then I get the same error as before

- unable to satisfy dependency 'libavcodec.so=58-64' required by vapoursynth
- unable to satisfy dependency 'libavformat.so=58-64' required by vapoursynth
- unable to satisfy dependency 'libavutil.so=56-64' required by vapoursynth
1 Like

2 things we can try here now.

First we can see if these 3 libraries are already on your computer, but maybe different versions?

locate libavcodec.so
locate libavformat.so
locate libavutil.so

If you do not have it on your system, we can try to locate where this library is available from via:

pacman -Fyx libavcodec.so
pacman -Fyx libavformat.so
pacman -Fyx libavutil.so

I am not at my computer so I can’t test out if typing them all like pacman -Fyx libavcodec.so libavformat.so libavutil.so would work or not. Never tried it before.

This will search the database to see which packages owns that file.

Edit: Just a very quick look, it looks like these 3 libraries were created ffmpeg… so it should just be within that package you’re building…? -is confused-

The problem is that vapoursynth wants specific versions of libav…

The ffmpeg package provides libavcodec.so=58-64
ffmpeg-full provides libavcodec.so

Which AUR helper are you using @casey ?

Just realized:

ffmpeg-full installs ffmpeg v4.4, whereas our repo has ffmpeg v4.3. Probably the libraries in ffmpeg-full are too new for vapoursynth in our repo? vapoursynth is looking for a specific version of the libraries instead of or a range.

v4.4 is in Arch testing currently, and should be in their stable soon, which also means vapoursynth's dependencies will be upgraded by then as well. But will have to wait until the packages gets into Manjaro repo too.

Anyone else have a solution for current time though?

Edit: @casey

  1. pamac build ffmpeg
  2. When it asks if you want to edit the PKGBUILD, press “e”
  3. Go to the line that says pkgver=4.4, and change it to pkgver=4.3
    3a. The PKGBUILD pulls the package directly from the ffmpeg website with: https://ffmpeg.org/releases/ffmpeg-${pkgver}.tar.xz, so it’ll pull version 4.3 for you
  4. Install

So I tried changing to 4.3 and still no luck. Same error.

One more solution… reinstall ffmpeg from our repo, THEN try to build ffmpeg-full?

Other than that… I am out of ideas :confused:

ffmpeg is what provides those libraries.

At the moment AMD hardware encoding in handbrake is not working on my machine

I am the maintainer of the AUR pkgbuilds handbrake-full and handbrake-git which are the only ones to have (experimental) AMD encoding enabled (VCE), about ffmpeg; handbrake is incorporating its own version and necessary flags are enabled

Installing amdgpu-experimental package and rebooting is needed


About and installing ffmpeg-amd-full; you need to first build the package and then to install it, for this task AUR helpers are usually not well suited

Looking at both pkgbuild you can see that also ffmpeg Arch pkgbuild provide libavcodec.so

ffmpeg-amd-full pkgbuild

This is because soname version will be assigned in destination info files when the package is builded, not in the pkgbuild

1 Like

Wait so my reading of the documentation seems to suggest that handbrake displays the encoders it thinks are available, and handbrake uses ffmpeg as its encoder. I thought before hardware encoding could be utilized by handbrake it needs to be enabled by ffmpeg

Handbrake is incorporating its own build of ffmpeg, it don’t use the system version

Ooo I thought it used the systems! Ill try the handbrake -full version and see if I can get that working

by the way you need to also install the package amdgpu-experimental and reboot

I forgot to write in the previous post

Ok I’ll give it a try and update, I’ve honestly invested a good amount of time into this im pretty committed to getting it working

edit:
Still no luck I installed the experimental gpu divers and handbrake-full and handbrake does not show any VCE encoders available