Skip to content

Instantly share code, notes, and snippets.

@cega
Forked from ruario/h264-vivaldi-linux.md
Created September 9, 2016 11:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cega/258ca210e4cd3f02cdca5b721b9045ba to your computer and use it in GitHub Desktop.
Save cega/258ca210e4cd3f02cdca5b721b9045ba to your computer and use it in GitHub Desktop.
Using H.264 in Vivaldi for Linux

How to use H.264, MP3 and AAC support ln Vivaldi for Linux, via an alternative FFMpeg library

Intro

The following is a quick guide to get this working on various Linux distros. As a side note, if you have Chrome installed alongside Vivaldi, Netflix should also work after making these changes.

Ubuntu

The following are steps for Vivaldi beta. If you are running the latest Vivaldi snapshot, please refer to the Vivaldi snapshot section under "Other distros".

Install chromium-codecs-ffmpeg-extra

sudo apt-get update && sudo apt-get install chromium-codecs-ffmpeg-extra

You will now need to restart Vivaldi. You can then test support on this page.

Arch

Install from the AUR

If you want to use the latest beta, install vivaldi-beta and vivaldi-beta-ffmpeg-codecs.

If you want to use the latest snapshot, install vivaldi-snapshot and vivaldi-snapshot-ffmpeg-codecs.

Install from the unofficial herecura repo

Alternatively, you can also get both of these packages from from the unofficial [herecura] repo.

After installing from the AUR or the linked unofficial repository, will now need to restart Vivaldi. You can then test support on this page.

Other distros

If your distro does not provide a package with a suitable lib, you can extract the required libs from one of these binary packages. There are steps below. However, the steps will need to be repeated (with new libs) every time we update our Chromium engine, otherwise video and audio may fail or worse, you will get frequent crashes!

Vivaldi beta

Fetch one of these packages

64bit Linux
wget http://security.ubuntu.com/ubuntu/pool/universe/c/chromium-browser/chromium-codecs-ffmpeg-extra_48.0.2564.116-0ubuntu1.1229_amd64.deb
32bit Linux
wget http://security.ubuntu.com/ubuntu/pool/universe/c/chromium-browser/chromium-codecs-ffmpeg-extra_48.0.2564.116-0ubuntu1.1229_i386.deb
Extract the lib from the package
ar p chromium-codecs-ffmpeg-extra_48.0.2564*.deb data.tar.xz | tar xJf - ./usr/lib/chromium-browser/libs/libffmpeg.so --strip 5

Note: ar is from the GNU binutils package.

Vivaldi snapshot

Fetch one of these packages

64bit Linux
wget http://repo.herecura.eu/herecura/x86_64/vivaldi-snapshot-ffmpeg-codecs-49.0.2623.91-1-x86_64.pkg.tar.xz
32bit Linux
wget http://repo.herecura.eu/herecura/i686/vivaldi-snapshot-ffmpeg-codecs-49.0.2623.91-1-i686.pkg.tar.xz
Extract the lib from the package
tar xf vivaldi-snapshot-ffmpeg-codecs-49.0.2623*.pkg.tar.xz opt/vivaldi-snapshot/libffmpeg.so --strip 2

Installing in the Vivaldi directory

Issue the following as root (or prefaced with sudo):

Vivaldi beta
install libffmpeg.so /opt/vivaldi-beta/libffmpeg.so
Vivaldi snapshot
install libffmpeg.so /opt/vivaldi-snapshot/libffmpeg.so

You will now need to restart Vivaldi. You can then test support on this page.

Building your own replacement libffmpeg.so

If you don't want to use the file in the package provided by Ubuntu (or the herecura repo), you can compile your own.

Installing build dependencies

Ubuntu, Debian & Mint

sudo apt-get update && sudo apt-get install automake build-essential libtool pkg-config yasm zlib1g-dev 

Fedora

sudo dnf install autoconf automake gcc gcc-c++ libtool make nasm pkgconfig zlib-devel 

openSUSE

zypper in -t pattern devel_basis 

Other distros

  • autoconf
  • automake
  • gcc
  • gcc-c++
  • libtool
  • make
  • nasm (or yasm)
  • pkg-config
  • the zlib development support files

Fetch and unpack the appropriate Chromium source archive

For Vivaldi beta, issue the following in a terminal:

CHRVER=48.0.2564.109

For Vivaldi snapshot, issue the following in a terminal:

CHRVER=49.0.2623.91

Now issue the following commands:

wget http://commondatastorage.googleapis.com/chromium-browser-official/chromium-$CHRVER.tar.xz
tar xf chromium-$CHRVER.tar.xz
cd chromium-$CHRVER

Fetch and configure Depot Tools

git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH="$PATH:`pwd`/depot_tools"

Build libffmpeg.so

touch chrome/test/data/webui/i18n_process_css_test.html
./build/gyp_chromium --depth . -Dcomponent=shared_library -Dffmpeg_branding=ChromeOS -Dclang=0
ninja -C out/Release ffmpeg

Note: On systems that don't use PulseAudio (e.g. Slackware), you should also include the define -Duse_pulseaudio=0.

Copy the lib into your Vivaldi install

Issue the following as root or prefaced with the sudo command:

Vivaldi beta

install out/Release/lib/libffmpeg.so /opt/vivaldi-beta/libffmpeg.so

Vivaldi snapshot

install out/Release/lib/libffmpeg.so /opt/vivaldi-snapshot/libffmpeg.so

Restart browser

You will now need to restart Vivaldi. You can then test support on this page.

Tips for package maintaners

If you repackage Vivaldi browser for your distro, you might want to consider making vivaldi-beta-ffmpeg-codecs or vivaldi-snapshot-ffmpeg-codecs packages containing a replacement ffmpeg library. It is suggested that you place this library in the directory /opt/vivaldi-beta/ or /opt/vivaldi-snapshot/ directories respectively.

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