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.
This didn't work for me. Opera won't even load anymore after I switched to the latest codec for my system.
Do I have to have Chrome installed? I only have Opera and Firefox.
Just install Chromium and find the path to it, and the path to Opera folder.
(/usr/lib/chromium-browser and usr/lib/x86_64-linux-gnu/opera for example)
Then open file manager with root and copy libffmpeg.so from chromium folder to opera folder
Thanks for writing this, I found it helpful.
Just wanted to add that you can also place the "good" libffmpeg.so into /usr/lib64/opera/lib_extras/ (I had to create this directory) and videos still work for me. This allows you to preserve the original libffmpeg in case it's good for anything else.
I'm also thinking/hoping that it won't get overwritten when opera updates which means that you won't have to repeat this process every few weeks as you mentioned.
On Ubuntu 19.10, libffmpeg from chromium is no longer available via apt. You need to install chromium-ffmpeg via snap, then you can symlink the latest version to the opera lib_extra folder. I use these commands in a terminal:
If you don't already have lib_extra created:
sudo mkdir /usr/lib/x86_64-linux-gnu/opera/lib_extra
Snap installs multiple versions of libffmpeg, use this to soft-link to the "latest" version of libffmpeg:
sudo ln -fs `find /snap/chromium-ffmpeg/ -name "libffmpeg.so" | sort | tail -n 1` /usr/lib/x86_64-linux-gnu/opera/lib_extra/
Rerun above command after each update of chromium-ffmpeg to ensure the latest version is linked.
Restart Opera and it'll work again.
Almost three years later and this issue still persists \o/