Adding H.264 video support to Opera for Linux

The following was originally on GitHub but as it is effectively a blog post I decided to move it here.

Opera for Linux, version 25 and higher, supports a variety of HTML5 audio and video codecs out of the box. However, it does not have built-in support for H.264 video or MP3 audio. If your system has a correctly compiled version of FFmpeg version 2.6.x, it can be used by Opera to display H.264 video and play MP3 audio. Users of older Ubuntu-based systems should read this handy guide. Alternatively, you can build and install FFmpeg for yourself. The following is a quick and simple guide. Most of the steps are automated, so don't be put off!

Install a basic build environment and build dependencies

If you use a distro where compiling packages is commonplace (e.g. Arch, Gentoo, Slackware, etc.), you will most likely already have everything you need and more. Otherwise, the following will install enough development tools to produce FFmpeg libraries suitable for running H.264 video and MP3 audio, in addition to the default formats supported by Opera.

Open up a terminal and input the following to create a basic build environment (you can cut and paste the text below to ensure accuracy):

Ubuntu, Debian & Mint

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


Issue the following:

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

(Note: Older Fedora releases use yum instead of dnf.)


Issue the following as root:

zypper in -t pattern devel_basis  

Other Distros

Install the following packages:

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

Build and install

The quick route

Download and run this script locally (see below also), then follow the instructions printed when it completes.


Manual method

Fetch FFmpeg and extract it

The following will help you fetch the correct version of FFmpeg for your Opera install. Input the following command in your terminal:


(Note: If wget is not installed on your system, either install it or you can use curl -O instead).

Now unpack the tar archive and change directories, into the folder you've just extracted:

tar fx ffmpeg-2.6.3.tar.bz2  
cd ffmpeg-2.6.3  

Build FFmpeg

To build FFmpeg, input the following:

./configure --build-suffix=-opera \
            --enable-shared \
            --disable-programs \
            --disable-doc \
            --disable-debug \
            --disable-encoders \
make install  

Install FFmpeg

To install the compiled libraries, issue the following—on distros where sudo is not configured, use root:

sudo cp -Pv /tmp/opera-ffmpeg/lib/*.so* /usr/lib/x86_64-linux-gnu/opera/lib  

Note: For Opera beta and developer, 32-bit systems or non-standard installs, check the install location—listed in opera://about—and adjust "/usr/lib/x86_64-linux-gnu/opera/lib" accordingly.

You're all set! Restart Opera and you should have working H.264 and MP3 support. \o/

Second machine?

You can also make a backup of your self-compiled FFmpeg libs, to allow you to install on your other machines, without having to recompile.

To create a backup archive:

tar fvcJ ffmpeg-2.6.3-opera-binaries.tar.xz lib/*.so*  

To install from the backup archive:

sudo tar fx ffmpeg-2.6.3-opera-binaries.tar.xz -C /usr/lib/x86_64-linux-gnu/opera  
comments powered by Disqus