Opera for Linux ffmpeg codec hell

I really don’t understand what the full issue is with opera and video codecs, but every few weeks, it will stop playing videos on facebook, twitter and sometimes even youtube. People will surge into the forums to complain and largely be ignored. Here’s what I’ve been able to piece together. 

The problem

The short reason for the problem is that Opera is based on a slightly time delayed version of Chromium. If the version of Chromium that Opera is using and the version of the libffmpeg.so library don’t match, then problems ensue. [The bit I can’t figure out is why Opera can’t match these up. But moving on …]

The Solution

OK so first of all you need to find out what version of Chromium your browser is using. You can find this out from the User Agent String. Visit this site to find out what yours is. From there you’ll get something like Chrome/70.0.3538.102 as your version. 

Now you need the correct codec. This will depend on your OS (Ubuntu, Redhat, Mandriva, whatever), your architecture (amd64, i386 etc), and your OS version. In my case the correct Ubuntu codec came from here. I’m running Ubuntu 18.04, amd64, and I wanted the 70.3538.102 codec. Get as close as you can to your particular circumstances and download the package file. 

Extract the codec from the package file. Package files are usually just tarred, gzipped files and you can open them in your normal archiver program. The codec in my case was found inside the archive file at /usr/lib/chromium-browser/libffmpeg.so. You may have to look around for it depending on your OS. Extract the file to somewhere in your home directory

Now you need to copy it to the correct location. The following command may help you find it. Your location may vary due to OS, architecture etc … 

sudo find / -name 'libffmpeg.so' 2>&1

On Ubuntu 18.10, amd64 the location was /usr/lib/x86_64-linux-gnu/opera/. So I ran the commands as follows, to make a backup of the opera codec first just in case, and copy the extracted file into place. And all this needs to be done as root/sudo. 

sudo cp /usr/lib/x86_64-linux-gnu/opera/libffmpeg.so /usr/lib/x86_64-linux-gnu/opera/libffmpeg.opera
sudo cp ~/Desktop/libffmpeg.so /usr/lib/x86_64-linux-gnu/opera/libffmpeg.so

Restart Opera and all should be good. You might want to consider running “sudo apt-mark hold opera-stable” to stop it upgrading automatically. 

Leave a Comment