Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to enable HTML5 MP4 (H.264/AAC) video in Vivaldi for Linux, via an alternative FFMpeg library
@AngryPenguinPL

This comment has been minimized.

AngryPenguinPL commented Oct 17, 2015

Thanks for this solution for all :) I have one question. Why we need use custom libffmpeg? We cant use default ffmpeg?

@ruario

This comment has been minimized.

Owner

ruario commented Oct 19, 2015

Chromium patches FFMpeg. The default FFMpeg provided on distros does not include these patches and hence it is incompatible. There is also the issue that the system version is often a different version (older or newer) so would probably be incompatible anyway, in addition to the patches issue.

@skobkin

This comment has been minimized.

skobkin commented Oct 27, 2015

@ruario What do you think about this conversation with Opera developers?

Seems like Chromium can be patched to use system ffmpeg/libav.

@kohlrabi

This comment has been minimized.

kohlrabi commented Dec 26, 2015

On my Debian machine I had to install several dev-packages before being able to build the ffmpeg lib:
sudo apt-get install libcups2-dev libatk1.0-dev libgtk2.0-dev libxtst-dev libexif-dev libxss-dev libpci-dev libdbus-1-dev libgconf2-dev libgnome-keyring-dev

For pulseaudio support:
sudo apt-get install libpulse-dev

@BlackIkeEagle

This comment has been minimized.

BlackIkeEagle commented Mar 16, 2016

@matsbtegner they are being updated from time to time so the herecura links are mostly only usefull for Arch Linux users

@ruario

This comment has been minimized.

Owner

ruario commented Mar 16, 2016

@matsbtegner Thanks, indeed I have not maintained this page as well as I would hope. Though it is up to date as I write this

@titilambert

This comment has been minimized.

titilambert commented Mar 16, 2016

@ruario do you have any web page to validate the installation ?

@JuanCAlpizar

This comment has been minimized.

JuanCAlpizar commented Mar 16, 2016

just a dumb question: if there are sources and can be installed right in place, why is the support not included in the snapshots and the beta by default? just tried the herecura repos from Fedora 23 using the latest vivaldi snapshot and it works fine

@ruario

This comment has been minimized.

Owner

ruario commented Mar 16, 2016

@titilambert I linked to a suitable page several times in the instructions, (see my statements: "You can then test support on this page"). Use the first video labelled H.264/MP4. If is plays, all is good. ;)

P.S. If you just want to test audio support, this page is also handy.

@ruario

This comment has been minimized.

Owner

ruario commented Mar 16, 2016

@JuanCAlpizar Not a dumb question. If you are unsure, it is always best to ask.

HTML5 media (audio and video) allows for the use of several different codecs. The most common ones (H.264, MP3 and AAC) are what I would call "proprietary" media codecs because they are patented and hence require various licenses to distribute software that can decode them. Each user costs the person distributing the software money. To an extent, these costs reduce as you gain more users (e.g. the licensor for H.264 gives discounts over certain numbers of users and you eventually hit a cap where these is no additional cost) but at our current size it is not viable for us to pay for a license for all our users and still fund the development of the browser.

The repositories I have linked to (that include binaries capable of decoding these codecs) are not associated with us. In addition, I am not a lawyer and cannot give legal advice but if I was to guess as to how they are able to distribute, I would assume that in the case of the Ubuntu repositories, they either paid for the licenses or they have some reason why they believe that they do need to pay for licenses. In the case of the herecura repo, it is maintained by a single individual in Europe, where software patents are not valid (to the best of my knowledge), so again I guess he should be fine.

@DMKrow

This comment has been minimized.

DMKrow commented Mar 18, 2016

I needed to install the sysroot (Debian Wheezy) with
./build/linux/sysroot_scripts/install-sysroot.py --arch=amd64
prior to ./build/gyp_chromium, after that, things seemed to work fine - thanks.

@ghost

This comment has been minimized.

ghost commented May 2, 2016

With some x86 Linux it happend that Vivaldi on my Netbook MSI WInd U110 wont play MPEG4/H265 videos, even after installing package chromium-codecs-ffmpeg-extra or adding libffmpeg.so from herecura.

I opened vivaldi://gpu and discovered that GPU section is all shown as Software, but then CPU should render the videos. But that did not work. Video was Black or White, only with sound.

I could workaround the problem by starting vivaldi from shell as vivaldi --disable-gpu

@noy88

This comment has been minimized.

noy88 commented May 16, 2016

Vivaldi will not open once the stable releases have been installed to /opt/vivaldi/lib/libffmpeg.so. Have to install the default libffmpeg.so to get it to launch again.

Anybody else getting this to work for stable Vivaldi?

EDIT: Nevermind, I was using the wrong bit version...

@xchronox0

This comment has been minimized.

xchronox0 commented May 17, 2016

links are outdated.

@chewi

This comment has been minimized.

chewi commented Jun 22, 2016

On Fedora 23, I have Chromium installed as well from the "Russian Fedora" repository. If you have that then you can just create a symlink pointing to /usr/lib64/chromium/lib/libffmpeg.so.

@jimdigriz

This comment has been minimized.

jimdigriz commented Jul 19, 2016

Some systems will not do hardware video decoding unless you route things via a suitable VDPAU driver, I have put together instructions for Debian jessie with an integrated Intel GPU which may help others.

@DesertOutlaw

This comment has been minimized.

DesertOutlaw commented Aug 26, 2016

Thanks jimdigriz. However, the directory in your instructions does not exist.

Everything worked fine in Vivaldi on Ubuntu until the latest snapshop. None of the other suggestions above work either. The flash recommended by https://help.vivaldi.com/article/install-flash-player-for-vivaldi/ can be installed but is disabled without any means to enable it. The suggestion at https://vivaldi.net/en-US/forum/vivaldi-browser-for-linux/14100-ubuntu-flash#71518 does not work either so its back to using Firefox unless I want to use Chrome itself or the chrome clone Opera. ... sign Oh well, maybe in the future if Vivaldi grows, licensing will not be an issue. Regardless, thanks for all the suggestions posted above.

@ruario

This comment has been minimized.

Owner

ruario commented Dec 20, 2016

@matsbtegner @xchronox0 Thanks I finally updated the links

@DesertOutlaw for Flash use this. For H264 the document is now updated and Vivaldi has been made more robust in accepting a wider range of library versions.

@lmariscal

This comment has been minimized.

lmariscal commented Feb 1, 2017

Thanks for all, btw just some advice. The AUR version seems to be having some problems when compiling so use the herecura one ;)

@JRetire

This comment has been minimized.

JRetire commented Feb 13, 2017

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

@argorain

This comment has been minimized.

argorain commented Mar 29, 2017

Hi! I tried to install ffmpeg library to latest stable (Vivaldi 1.8) but it is not working. I tried to use more recent chromium (57.0.2987.99 to be exact) but it failed on this error during gyp phase:

$ touch chrome/test/data/webui/i18n_process_css_test.html
$ ./build/gyp_chromium --depth . -Dcomponent=shared_library -Dffmpeg_branding=ChromeOS -Dclang=0
gyp: usage: gyp_chromium [options ...] [build_file ...]                                                                               
                                                                                                                                      
gyp_chromium: error: no build_file

Any ideas what is going on?
Thanks

@ruario

This comment has been minimized.

Owner

ruario commented Mar 30, 2017

I would avoid against compiling your own replacement libffmpeg.so unless you are a package maintainer on a distro and want to offer a supporting package for your users. It is a lot of effort for little reward. Far better to run the attached script, which will fetch a suitable libffmpeg for you from Ubuntu and place it in a location Vivaldi will find it.

I have re-written most of the script. You no longer need root/sudo/superuser privileges to run it as the file is places in a user owned location.

@tphecca

This comment has been minimized.

tphecca commented Apr 3, 2017

The script worked great for me on OpenSUSE Tumbleweed with Vivaldi 1.8. Thanks!

@ruario

This comment has been minimized.

Owner

ruario commented Apr 4, 2017

@tphecca great. Nice to hear it

@spokendotcpp

This comment has been minimized.

spokendotcpp commented Apr 17, 2017

Wow, just thank you :)

Works on Solus !

@mx1up

This comment has been minimized.

mx1up commented May 2, 2017

on opensuse leap, you can also install vivaldi-ffmpeg-codecs (though I did have to create a symlink /usr/lib64/vivaldi/lib/libffmpeg.so pointing to /opt/vivaldi/lib/libffmpeg.so)

@mx1up

This comment has been minimized.

mx1up commented May 3, 2017

i also tested the latest-proprietary-media.sh script now on opensuse leap 42.2. works flawlessly (netflix also tested). ruario, you rock :)

@xioustic

This comment has been minimized.

xioustic commented Jun 4, 2017

Worked for me in Fedora 25 today; thanks!

@Lgofk

This comment has been minimized.

Lgofk commented Jun 5, 2017

Works on Ubuntu 16.04, thanks!

@SolarLune

This comment has been minimized.

SolarLune commented Jul 28, 2017

Hey, thanks a lot! This fix works on Solus OS, as well.

@blackjackshellac

This comment has been minimized.

blackjackshellac commented Aug 31, 2017

Woot! Worked on Fedora 25. Last hurdle to switch to vivaldi from firefox.

@Firescar96

This comment has been minimized.

Firescar96 commented Sep 11, 2017

Works on Debian 10

EDIT:
I had to delete its files from $HOME/.local/lib/vivaldi/ and rerun the script after reinstalling my OS.

@ruario

This comment has been minimized.

Owner

ruario commented Oct 11, 2017

With the slow death of Unity it seems like the chromium-codecs-ffmpeg-extra is now (once again) the most likely source of this lib to be updated (for a while there it was oxideqt-codecs-extra), so I have updated this gist accordingly. If you were having issues, try again!

@powerman

This comment has been minimized.

powerman commented Nov 29, 2017

May worth to change this line to:

LOUD_DL="wget --config=/dev/null"

in case someone has dir_prefix = ~/download/ in ~/.wgetrc.

@ruario

This comment has been minimized.

Owner

ruario commented Dec 7, 2017

I am a little bit uncomfortable with doing that @powerman as they might have other options in their ~/.wgetrc that they would be suprised to have ignored (e.g. logging). The types of people who make these changes are likely to be the ones who could debug such a problem. You are the first person ever to mention such an issue on any one of my scripts and indeed, you have the solution, which kind of proves the point I feel. ;)

@ruario

This comment has been minimized.

Owner

ruario commented Dec 19, 2017

I added ARM support to the latest-proprietary-media.sh script

@danielfreittas

This comment has been minimized.

danielfreittas commented Jan 6, 2018

I just runed the sh file.
Works on opensuse Tumbleweed. Thank you.

@m3ntor

This comment has been minimized.

m3ntor commented Feb 2, 2018

Thank you. Well done.

@blackjackshellac

This comment has been minimized.

blackjackshellac commented Feb 12, 2018

Any chance you can add a username to the path for STAGINGDIR? With multiple system users I have to manually wipe that directory before I can run the script for another user, something like this,

$ diff -u latest-proprietary-media.sh latest-proprietary-media.new.sh 
--- latest-proprietary-media.sh	2018-02-12 09:43:17.654358020 -0500
+++ latest-proprietary-media.new.sh	2018-02-12 09:43:12.829289893 -0500
@@ -37,7 +37,7 @@
 TMP=${TMP:-/tmp}
 
 # Set staging dir
-STAGINGDIR=$TMP/$LOGNAME/chromium-codecs-ffmpeg-extra-staging
+STAGINGDIR=$TMP/chromium-codecs-ffmpeg-extra-staging
 
 # Setup Arch
 case $(uname -m) in
@chewi

This comment has been minimized.

chewi commented Mar 8, 2018

I should have mentioned this a while back but the Arch method of building your own libffmpeg.so is really slow, overcomplicated, and requires downloading the huge Chromium source tarball. Everything you need is in the FFmpeg sources, you just have to build it in a certain way. I wrote a patch for this, which was rejected by FFmpeg upstream, but we use it in Gentoo. Include the new Makefile in the top-level Makefile and do this:

./configure --disable-shared --enable-static --enable-pic --extra-cflags="-DFF_API_CONVERGENCE_DURATION=0"
make libffmpeg
sudo make install-libffmpeg
@ruario

This comment has been minimized.

Owner

ruario commented Apr 27, 2018

@blackjackshellac why don't you just define $TMP to be somewhere else locally?

@ruario

This comment has been minimized.

Owner

ruario commented Apr 27, 2018

@chewi I will investigate, thanks

@feilee

This comment has been minimized.

feilee commented Apr 30, 2018

@chewi, i am a gentoo user and i tryed to use the generated libffmpeg.so with ffmpeg sources but the current vivaldi-snapshot does not detect the generated lib. And if i force the library, replacing the original in vivaldi-snapshot, it just broke the video reproduction.

@ruario

This comment has been minimized.

Owner

ruario commented May 2, 2018

@feilee Thanks for confirmation. I was just about to try myself. This makes sense to me as ffmpeg within Chromium is heavily patched, i.e. AFAIK this could not be a true statement

Everything you need is in the FFmpeg sources

So I was suprised anyone claimed it worked

@tarzan73

This comment has been minimized.

tarzan73 commented Sep 17, 2018

The script works with fedora 28 too. Thanks!

@fiddybux

This comment has been minimized.

fiddybux commented Sep 24, 2018

Just a quick thanks for the script...been banging my head on the wall with this one trying everything else I can think of. Works like a charm in bunsenlabs with vivaldi stable.

@mattst

This comment has been minimized.

mattst commented Oct 16, 2018

ATTN: Linux Mint 17 64 (Qiana, based on Ubuntu 14.04) users:

I downloaded chromium-codecs-ffmpeg-extra_69.0.3497.81-0ubuntu0.16.04.1_amd64.deb, clearly this is the chromium-codecs-ffmpeg-extra file for Ubuntu 16.04.

wget http://security.ubuntu.com/ubuntu/pool/universe/c/chromium-browser/chromium-codecs-ffmpeg-extra_69.0.3497.81-0ubuntu0.16.04.1_amd64.deb

I manually extracted the libffmpeg.so file from the .deb file (using Archive Manager) and placed it in: /home/USER_DIR/.local/lib/vivaldi/libffmpeg.so

After restarting Vivaldi all videos played perfectly.

@crocket

This comment has been minimized.

crocket commented Oct 23, 2018

I wrote a patch for this, which was rejected by FFmpeg upstream, but we use it in Gentoo. Include the new Makefile in the top-level Makefile and do this:

The patch doesn't work. https://bugs.gentoo.org/653448

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