How-to: h264 etc. Support for Firefox (including ffmpeg install)

Looking at proc maps (i.e. what files firefox is loading), it shows this.

7f2b32240000-7f2b3226b000 rw-p 00cf4000 08:03 4850011 /usr/local/lib/libavcodec.so.58.54.100
7f2b39866000-7f2b39867000 rw-p 00094000 08:03 4850020 /usr/local/lib/libavutil.so.56.31.100
7f2b4a11f000-7f2b4a122000 r–p 00000000 08:03 4850014 /usr/local/lib/libswresample.so.3.5.100

It is loading the shared libraries. The static build contains no libraries, therefore is no replacement for these instructions to build ffmpeg to override the CL provided version.

You could try putting the files in /usr/local/bin instead as they are binaries and ensuring that /usr/local/bin is in the PATH variable. (Putting them in /usr/local/lib does nothing as they aren’t libraries). If firefox wants the libraries (which means the static version won’t work with the binaries in /usr/local/bin), then ignore the static version and build it via the instructions provided.

The static version will only work where the program runs the ffmpeg binary directly (then libraries don’t matter), while most programs will want the libraries.

1 Like

I understand, thanks for the clarification. :grin:

Is there a way to statically compile and install those lib*.so shared libraries — and make them easily available for the community — in the same copy-paste way of the static ffmpeg binary?

The end result needs to be a shared library. To prevent the need of those shared libraries you would need to rebuild every application that uses ffmpeg (including firefox and maybe that doesn’t even like a static version).

If you statically link a shared library, you build the library’s dependencies into it. Given the only soname likely to change is libva.so.2 (and not very often) this is not of great benefit and you would need to build the static library for libva to statically link it in (so more work).

Realistically, the only way to avoid this build would be if someone distributed the libs created from following these instructions with a matching version to what is in CL. This would still need to be manually updated from time to time from both users and distributor to get updates matching new versions in CL (I think MPV requires the same version of ffmpeg that MPV was built with, so rebuilt every version update).

The build really doesn’t take that long, but it could possibly be cut down somewhat by only building exactly what’s needed.

uSING GRUB CHAINLOADING, YOU WILL BE ABLE TO DUAL BOOT. I am dual booting from Fedora, with a grub entry for clear Linux.
From time to time, CL does a kernel upgrade, and the UUID for the boot changes.
I then revise the chain loading file to point to the new UUID.
I will be happy to provide my chainloading file that I use with Fedora.
Or internet search chainloading. and follow those instructions.

I made this too but doesn’t work with Firefox. I’ll need compile and install manually.

1 Like

So I did a thing:

Installed a bunch of prereqs (look in the org.ffmpeg.FFmpeg.yaml for links) also lame, libogg, libtheora, libvorbis, opus but they are checked later in the configure script than nvcc and I had to reinstall cuda in the middle so I don’t have their links very straight forward.

I installed cuda, then linked it all up to /usr/local used this heckin good configure 1 liner:

PKG_CONFIG_PATH=/usr/local/lib/pkgconfig PATH=/usr/local/cuda/bin :$PATH ./configure --enable-shared --enable-libaom --enable-libmp3lame --enable-libopus --enable-libvidstab --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvorbis --enable-libtheora --enable-libfdk-aac --enable-gpl --enable-version3 --enable-nonfree --disable-podpages --enable-hardcoded-tables --enable-cuda-nvcc --nvcc=/usr/local/bin/nvcc --cc=gcc-8 --cxx=g++-8 --pkgconfigdir=/usr/local/lib/pkgconfig --extra-ldflags=-L/usr/local/lib --enable-libnpp --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib64

This yields all nvidia accelerated scale_npp, nvdec nvenc x264 x265 etc. as detailed here https://devblogs.nvidia.com/nvidia-ffmpeg-transcoding-guide/

I used https://github.com/FakeShemp/org.ffmpeg.FFmpeg ffmpeg as a blueprint.

Hopefully someone out there will find this a little helpful I’m not going to write a full write up.

2 Likes

Hello Chadwick,

Welcome to CL forums.

I haven’t found time to test your settings, but it looks promising!

1 Like

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

It worked. Thank you. It took more than half an hour.

Here we are in April 2020 and FF or something in the OS still requires this to be done. I did all the steps through the export to a filrefox.conf file (which didn’t even exist prior) and videos are working for me in Twitter while running Firefox. Thanks for the help.

1 Like

I made it and i have to reboot the system after last command and then works great!
Thanks a lot!!

1 Like

Hi

I am new to Clear Linux. I installed Firefox from flathub and is able to play videos which normally do not play in Firefox which is installed using swupd. Could someone please tell me about the differences between Firefox bundle and Firefox flatpak? Also I found that there is stuttering while playing videos in certain websites but not always. I am not sure about the codecs used for playback though.

Thanks in advance.

1 Like

fr. yt works relatively fine with my ff-flp. other’s not at all. this will change. your questions:

flatpak .

swupd .

bugzilla .

additional : experimental wayland - support :

flatpak override --user --socket=wayland org.mozilla.firefox

flatpak override --user --env=MOZ_ENABLE_WAYLAND=1 org.mozilla.firefox

or ( system versus user ) :

flatpak override --socket=wayland org.mozilla.firefox

flatpak override --env=MOZ_ENABLE_WAYLAND=1 org.mozilla.firefox

in firefox itself:

about:config

layers.acceleration.force-enabled = true

widget.wayland-dmabuf-vaapi.enabled = true

widget.wayland-dmabuf-webgl.enabled = true

widget.wayland-smooth-rendering = true

bugs will be fixed. we simply have to wait or contribute. if you experience stuttering and/or insane cpu - usage, copy the video-url to celluloid. if you use celluloid, use a mpv-config & set for example:

hwdec=auto

after you’re finished with celluloid-streams, you can : killall gvfsd-http

at least, i’m impressed. filesystem-permissions: xdg:download. additional stuff: gfx.webrender xy (only for nightly-builds; do not enable it if you’re on a stable/beta build).

ps: flatseal - permission - manager .

3 Likes

@ohmyfish Thanks for the detailed explanation. I wonder why no one has suggested installing Firefox from flathub instead of downloading from CL repos. I believe that it can save more time without downloading and compiling FFmpeg. Not everyone wants to compile FFmpeg just for viewing online videos properly.

Thanks again

1 Like

… the ff - flatpak support from mozilla itself is relatively new & this codec-thing buggy (bugzilla-link = much confusion). anyway, cl is giving us (of course) the choice - already (+ there are other possibilities). & just for fun: sudo swupd bundle-add lynx and/or even (per) docker ;).

Can someone make bash script to install all the codecs to make the life easier ? :slight_smile: it would be great.

I’ve written one

1 Like

Save yourself a lot of work uninstall Mozilla Firefox that came with org iso and reinstall Firefox using flatpak to install, " flatpak install flathub org.mozilla.firefox" dont use quotation marks than video clips on the internet will work as they should. It’s a no hassle fix!

1 Like

Please help!
I have built FFmpeg a few times. And now it broke some libraries.

For the first time, I just installed it as is with command
./config && make && sudo make install

Over time I have found this article and start to build it with these parameters:
./configure --prefix=/usr/local --enable-shared && make && sudo make install

But now, when I trying to start FFmpeg, it write an error:

ffmpeg: symbol lookup error: ffmpeg: undefined symbol: avio_protocol_get_class, version LIBAVFORMAT_58

Please help to fix it

have you uninstalled the ffmpeg in /usr?