Skip to content

Instantly share code, notes, and snippets.

@ruario
Last active September 17, 2024 01:50
Show Gist options
  • Save ruario/bec42d156d30affef655 to your computer and use it in GitHub Desktop.
Save ruario/bec42d156d30affef655 to your computer and use it in GitHub Desktop.
How to enable HTML5 MP4 (H.264/AAC) video in Vivaldi for Linux, via an alternative FFMpeg library
@phd21
Copy link

phd21 commented May 17, 2019

Hi Everyone,

I just installed Vivaldi into my Linux KDE Neon user edition based on Ubuntu 18.04 Bionic. And I really like it, but I had trouble with x264/mp4 videos on the test page? After reading this thread, I checked to see if "chromium-codecs-ffmpeg-extra" was installed in "Synaptic Package Manager (SPM)" and it was installed version 75. I also ran vivaldi from the console terminal prompt which recommended installing an older version.

No suitable library for HTML5 proprietary media (MP4[H.264/AAC]) was found,
therefore only open codecs will play.

To add support for proprietary media, issue the following command and restart
Vivaldi:

curl https://launchpadlibrarian.net/414953672/chromium-codecs-ffmpeg-extra_73.0.3683.75-0ubuntu0.16.04.1_amd64.deb |\
tail -c+1077 | tar JxC ~ --wildcards \*libffmpeg.so --xform 's,.*/,.local/lib/vivaldi/,'

I thought I would just try copying the "libffmpeg.so" from "/usr/lib/chromium-browser/" into the Vivaldi "lib" folder which in my Linux KDE Neon is "/opt/vivaldi/lib/" and restarted Vivaldi and it works great; only vivaldi when run from the console terminal still show I need to install it?
This is the command I used to copy "libffmpeg.so" from the installed "chromium-codecs-ffmpeg-extra" package into Vivaldi's lib folder.
sudo cp -v /usr/lib/chromium-browser/libffmpeg.so /opt/vivaldi/lib/

Hope this helps ...

@victorpydev
Copy link

For my debian system tracking the testing distribution, the easiest of all to run h264 videos on vivaldi was to add a ubuntu repository and a preferences file to exclude all ubuntu packages other than chrome-ffmpeg-codecs-extra. This will also allow new versions of chromium-ffmpeg-codecs-extra to be found and installed in the normal manner used for all other packages.

/etc/apt/sources.list: added an ubuntu repository:

chrome-ffmpeg-extra-codecs from ubuntu to play H264 videos:

deb http://archive.ubuntu.com/ubuntu devel-proposed universe

/etc/apt/preferences.d: added a preference file to exclude all of ubuntu except for chrome-ffmpeg-codecs-extra:
Explanation: block all ubuntu packages
Package: *
Pin: origin "archive.ubuntu.com"
Pin-Priority: -1

Explanation: do not block ffmpeg-extra but lower priority than debian
Package: chromium-codecs-ffmpeg-extra
Pin: origin "archive.ubuntu.com"
Pin-Priority: 476

After installing chrome-ffmpeg-codecs-extra, videos from the test page http://www.quirksmode.org/html5/tests/video.html as well as videos from movies.yahoo.com, netflix and amazon all run well!

=> apt-cache policy chromium-codecs-ffmpeg-extra
chromium-codecs-ffmpeg-extra:
Installed: 55.0.2883.87-0ubuntu2.1328
Candidate: 55.0.2883.87-0ubuntu2.1328
Version table:
*** 55.0.2883.87-0ubuntu2.1328 476
-1 http://archive.ubuntu.com/ubuntu devel-proposed/universe i386 Packages
100 /var/lib/dpkg/status
55.0.2883.87-0ubuntu1.16.10.1330 400 ## package downloaded by the script and kept in local repository ##
400 copy:/usr3/Installs/DEB ./ Packages

<OBRIGADO procurei muito por isto -----> http://www.quirksmode.org/html5/tests/video.html

@ruario
Copy link
Author

ruario commented Aug 28, 2019

It's cool but I am not sure it is the easiest. Just start Vivaldi from a terminal and it gives you a one line command to enable H.264 and AAC

https://help.vivaldi.com/article/html5-proprietary-media-on-linux/#example

@ruario
Copy link
Author

ruario commented Aug 28, 2019

Oh and that quirksmode page is not maintained and does not work

Test cases have been removed at the request of my ISP; they were taking up WAY too much bandwidth.

The Vivaldi help page has it's own test video though

@DanMan
Copy link

DanMan commented Jun 12, 2020

On Fedora 32 you only need to install the GStreamer h.264 package which you can do from Gnome Software. I just did that. Videos work now.

@ruario
Copy link
Author

ruario commented Jun 12, 2020

@DanMan No that is incorrect. Vivaldi will not make use of that package. Vivaldi will fetch the files it needs itself and this document and steps are no longer relevant or valid.

@yenaras
Copy link

yenaras commented Oct 26, 2021

for kde neon, all I had to do was
sudo apt install ubuntu-restricted-extras

@ruario
Copy link
Author

ruario commented Oct 26, 2021

@brandon82890 Nope. That does absolutely nothing for Vivaldi whatsoever.

@yenaras
Copy link

yenaras commented Oct 26, 2021

If you say think so, but it worked for me. It installs the mp4 codecs and also the chromium-codecs-ffmpeg-extra.

https://packages.ubuntu.com/bionic/ubuntu-restricted-addons
https://en.wikipedia.org/wiki/Ubuntu-restricted-extras

@ruario
Copy link
Author

ruario commented Oct 26, 2021

@brandon82890 I am a Vivaldi employee and the person who wrote the code that Vivaldi uses to decide which lib to load to support more codecs. I am telling you that you are completely wrong. Sorry to be blunt.

Why am I so blunt? Because I do not want to sow more confusion amongst other users who might see your message and think this is a solution. It is not.

Vivaldi corrects the situation itself. On install (or startup if that fails) Vivaldi fetches a package in the background and installs a file from it to handle a wider variety of codecs. It will not look at any of the libraries in the packages you listed. Most likely you believe you fixed it because on first start the support file had not yet been fetched by Vivaldi. Vivaldi then initiated the process to fix the situation. You then installed what you thought was a package that would fix the situation. This had no effect at all but on restart, the file Vivaldi fetched was then used. Remove ubuntu-restricted-extras and associated dependencies and you will find that Vivaldi still works.

@yenaras
Copy link

yenaras commented Oct 26, 2021

Oh wow, you're right, I did sudo apt remove ubuntu-restricted* and then restarted the browser. It still works fine. Sorry for the misinformation. It must have been a coincidence like you said.

@MDAR
Copy link

MDAR commented Jul 28, 2022

@ruario

Vivaldi corrects the situation itself. On install (or startup if that fails) Vivaldi fetches a package in the background and installs a file from it to handle a wider variety of codecs. It will not look at any of the libraries in the packages you listed. Most likely you believe you fixed it because on first start the support file had not yet been fetched by Vivaldi. Vivaldi then initiated the process to fix the situation. You then installed what you thought was a package that would fix the situation. This had no effect at all but on restart, the file Vivaldi fetched was then used. Remove ubuntu-restricted-extras and associated dependencies and you will find that Vivaldi still works.

Would you be kind enough to ask your team to look into why Vivaldi on DietPi V8.7 (Debian based) on an Odroid C4 doesn't load the required files in order to play H.264 videos?

I have restarted the app a number of times and still get the same message.

Re - MichaIng/DietPi#5300

I have had to look for an alternative to Chromium because we just can't get it to run in a kiosk mode in an Xinit session any more.
Something upstream has been changed and now all we get is "Stack Smashing"

Vivaldi loaded and ran perfectly without any issues, other than the H.264 playback.

I'm happy to try anything your team suggests.

@ruario
Copy link
Author

ruario commented Aug 1, 2022

@MDAR I know why H.264 is failing for you and hope to get out a fix soon. In the mean time I can give you a work around.

If it is armhf

wget -O- https://launchpadlibrarian.net/614082413/chromium-codecs-ffmpeg-extra_103.0.5060.134-0ubuntu0.18.04.1_armhf.deb | tail -c+1157 | tar xOJ ./usr/lib/chromium-browser/libffmpeg.so > libffmpeg.so.5.3
sudo install -m755 libffmpeg.so.5.3 /opt/vivaldi/libffmpeg.so.5.3

If it is arm64

wget -O- https://launchpadlibrarian.net/614041844/chromium-codecs-ffmpeg-extra_103.0.5060.134-0ubuntu0.18.04.1_arm64.deb | tail -c+1157 | tar xOJ ./usr/lib/chromium-browser/libffmpeg.so > libffmpeg.so.5.3
sudo install -m755 libffmpeg.so.5.3 /opt/vivaldi/libffmpeg.so.5.3

@MDAR
Copy link

MDAR commented Aug 1, 2022

Thanks @ruario

wget -O- https://launchpadlibrarian.net/614041844/chromium-codecs-ffmpeg-extra_103.0.5060.134-0ubuntu0.18.04.1_arm64.deb | tail -c+1157 | tar xOJ ./usr/lib/chromium-browser/libffmpeg.so > libffmpeg.so.5.3
sudo install -m755 libffmpeg.so.5.3 /opt/vivaldi/libffmpeg.so.5.3

That certainly works with an Odroid C4 to get the video to load and be manually played.

In chromium, there is a setting I need to adjust in order for it to AutoPlay.

Settings
Privacy
Sound = Allow

I have checked that this setting is ON in Vivaldi, but the video won't autoplay, if a websocket command is received to load and play a video.

Videos will play if I click on the Play button (as per your test page)

I'm very happy to open a port so you can access the machine I am generating the content with.

FYI
I'm trying to get this working, with Vivadli instead of Chromium
https://youtu.be/FinliWWOBOU?t=157

Best wishes,
Stuart

@MDAR
Copy link

MDAR commented Aug 1, 2022

@ruario

Small update.

If I start the browser in kiosk mode, it will display the video, but NOT play it.

Until

I press F11 Twice

After that, it behaves perfectly.

The only issue is that I can't automate that button press

Have you any ideas on how I can get around this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment