HW x264 decoding In Firefox 116

Looking around some I do not see any support for AML in my ffmpeg and the only support I saw on the net was many years old and not maintained.

I had a couple of issues also. I have been testing the latest 116.0.2-1 that has been out for a couple of days. I have no clue why it is not in our unstable branch yet.

Install it direct:

sudo pacman -U http://nj.us.mirror.archlinuxarm.org/aarch64/extra/firefox-116.0.2-1-aarch64.pkg.tar.xz

116.0.1

  • Fixed an issue which caused chart elements to render incorrectly for Windows users.

116.0.2

  • Fixes an issue that was causing keystrokes to be scrambled for users using ZoneAlarm anti-keylogger.

Thanks. Too bad the newer ffmpeg doesn’t seem to support AML.

rebuild ffmpeg-rpi-4.4.4 form ALARM’s PKGBUILD.
mpv seems play good --hwdec-codecs=h264_v4l2m2m-copy, although none of word b4l2m2m showed.
but, didn’t have firefox-117bx to test?

From what I am seeing here mpv uses the ffmpeg (v6.0-8) package. If you force uninstall it you get this:

[ray@jellyfin ~]$ mpv
mpv: error while loading shared libraries: libavcodec.so.60: cannot open shared object file: No such file or directory

rebuild ffmpeg-rpi-4.4.4 & rebuild mpv, after only depes error is chromium.

OK. It shoud say using hardware decoding in the terminal when you start it up. If not it is probably defaulting to software decoding.

I have added a little more to my learning curve today. It appears firefox uses a version of ffmpeg starting with the highest version installed first. Firefox does not seem to be required to be compiled with ffmpeg as it does not retain what version of libs used after compile as I did compiling with only the libs/headers with ffmpeg-rpi from ARCH installed. I can get 117 and 116 to play the big buck bunny mp4 on youtube if I only have ffmpeg-rpi (v4.4.4-2) installed.

https://youtu.be/L-Tts8MkE-w?t=13

Since the 117 snap is a mounted read only squashfs I can run firefox outside of the mounted environment by running firefox from /var/lib/snapd/snap/firefox/3006/usr/lib/firefox/ and it picks up the ffmpeg-rpi libs installed on the system when no other version of ffmpeg is installed.

Supposedly under firefox Edit → Settings there is a checkbox to enable/disable HW decoding when checked I see that HW is forced and mp4 vids will not play. If you uncheck it and then uncheck the new Force HW if available then mp4 vids will play with SW decoding.

settings

Here the box is checked and the vid plays with only ffmpeg-rpi installed:

bbb-mp4

Is it actually using HW I do not see anything in the terminal to indicate that it is or is not to be sure. This version of ffmpeg-rpi has v4l, v4l-requests and m2m but it was really built for vlc to run outside of a DE like kodi-rpi does for HW. Somehow in the back of my mind I believe we need to come up with the right ffmpeg version with the right options compiled in and force firefox to use the libs.

Playing around some more I see that the package ffmpeg-m2m (v4.4-4) in our repo will play a mp4 vid if it is the only ffmpeg installed also like ffmpeg-rpi from ARCH.

2 Likes

ffmpeg-rpi & ffmpeg-rpi-bin, whats different?
which should install or both?

ffnpeg-rpi: libs and headers only
ffmpeg-rpi-bin: ffmpeg, ffplay, docs, man and files need to run ffplay/ffmpeg

Installing both packages give you a full install of ffmpeg 4.4 which will conflict with anther full ffmpeg install. Installing ffmpeg-rpi only allows programs that were compiled with ffmpeg 4.4 to use its libs and still have another full install of another ffmpeg version.

Device GT King Pro (S922X), confirm with ffmpeg-m2m, Firefox 116.0.1 can stream https://youtu.be/L-Tts8MkE-w?t=13 but I don’t think it is vpu hw accelerated based on the CPU resources used.

QT_QPA_PLATFORM=wayland GDK_BACKEND=wayland MOZ_ENABLE_V4L2=1 M
OZ_WAYLAND_USE_HWDECODE=1 MOZ_ACCELERATED=1 MOZ_ENABLE_WAYLAND=1 MOZ_WEBRENDER=1 f
irefox --private

Tried to stream the same Buck Bunny mp4 on the latest Vivaldi-Stable (ffmpeg-m2m) result with error.

Vivaldi-Stable on Manjaro-Arm-KDE-linux-aml-6.1.42-1 with ffmpeg-m2m

What does it take to make Firefox 116 enable vpu hw acceleration?

Installing both packages give you a full install of ffmpeg 4.4 which will conflict with anther full ffmpeg install.

Installing ffmpeg-m2m conflict with full ffmpeg-6.0-8.

Installing ffmpeg-rpi only allows programs that were compiled with ffmpeg 4.4 to use its libs and still have another full install of another ffmpeg version.

Am interested to test ffmpeg-rpi on my device. Where can I download this ffmpeg-rpi? Objective is to see whether it can work with mpv-0.36.0-1 with “–hwdec=v4l2m2m-copy”.

Oops, you might have already answer this question above, that mpv-0.36.0-1 expect to work with ffmpeg-6.0-8.

Can’t find ffmpeg-rpi on repo.manjaro.org.

I was at that point yesterday but had to leave for the rest of the day. Today I can confirm there is HW decoding by comparing ffmpeg6 SW and ffmpeg-rpi 4.4 in htop.

I am seeing about a 50% drop in cpu usage with the big bunny vid with ffmpeg-rpi. I believe it is like when I was using MMAL (opensource) years ago on the 32bit pi image where it was using HW at a higher level where the omxplayer was able to directly access the vpu directly using the code.

ffmpeg6 SW:

ffmpeg-rpi 4.4:

I do not know much about Vivaldi but maybe it is not suited for V4L like the new firefox 116.

Most likely it has to have a ffmpeg specially patched for the vpu you are using.

All ffmpeg versions has to be forcefully removed first as firefox will try to use the highest ffmpeg libs.

I have not had time yet to compile mpv with 4.4 to test.

ffmpeg-rpi is patched especially for the rpi vpu so have no clue how it would work but remember to uninstall all ffmpeg versions first then install ffmpeg-rpi then recompile mpv using the ffmpeg-rpi libs/headers.

Install direct:

sudo pacman -U http://fl.us.mirror.archlinuxarm.org/aarch64/alarm/ffmpeg-rpi-4.4.4-2-aarch64.pkg.tar.xz

so, add export PATH=$PATH/usr/lib/ffmpeg-rpi into .bash_profile, does it necessary?

Do not believe that is the correct connotation to export libs.

Uninstall all ffmpeg versions first then install ffmpeg-rpi and firefox will pick up what it needs. /usr/lib/ffmpeg-rpi is not the only directory ffmpeg-rpi installs libs.

@JFL I tried to compile mpv and ffmpeg-rpi seems to be missing libavcodec. I can not find their PKGBUILD since they removed the community repo to see how it can be included so at a standstill for the moment.

On my device Manjaro-Arm-KDE-linux-aml-6.1.42-1 ffmpeg-m2m and Firefox 116.0.1 streaming Big Buck Bunny mpv, the CPU resources used is a bit lower.

1 Like

Your 6 cores vs my 4 overclocked @2150. lol

Based on memory, on the previous mpv-hwdec version and ffmpeg-m2m, streaming 1080p/60 mp4 with vpu hw acceleration, the cpu resources used is similar or lower than above case. Which lead me to assume NO vpu hw acceleration on Firefox 116 with ffmpeg-m2m as the resolution of Big Bug Bunny mp4 is only (640x480) significantly lower resolution compared to 1080p/60.

For your info, Fedora 38 Workstation Firefox 116.0 with ffmpeg-6.0 would not stream Big Buck Bunny mp4 – same result as Vivaldi-Stable with ffmpeg-m2m.