How to Fix YouTube Videos Not Playing On Linux.
I often had this issue where random YouTube videos would not play in Firefox whereas they worked fine in Google Chrome. After doing a little googling, it turns out that videos that work with licensed codecs like HEVC-265 are not playable in open source web browsers like Firefox and Vivaldi. For example, I used Vivaldi and it only supports free and open source video codecs. Thus, it does not support MPEG-4 and HEVC-265. But there is a workaround for Chromium based browsers and here’s how to fix YouTube videos not playing on YouTube.
Which codec does not your browser support
Before we get into fixes, it’s important to understand the issue. YouTube recently moved from Flash video to embedded HTML5 video players. Thus, you no longer need Adobe Flash to display videos on YouTube. Your web browser must be HTML5 compliant and most of them support. But they don’t support all video codecs. To find out which codecs are not supported by your browser, go to the HTML5 test website.
On the right side, you will see all the video codecs supported by your browser. In my case, I am using Vivaldi and it does not support MPEG-4 and H.265, which can be seen from the HTML5 benchmark below.
How to fix YouTube videos not playing on Linux
1. Chromium-based browsers
You need to install a licensed codec. You can use the following command or simply launch Vivaldi from the command line if you are using the Vivaldi browser.
Go to the terminal, type “vivaldi” and press Enter. It will open a new browser window and tell you the found codecs in the terminal. Initially only open source codecs will be installed and you will be prompted to install a proprietary command. Use this command or you can directly paste the following command. sudo apt update && sudo apt install chromium-codecs-ffmpeg-extra
If the above command doesn’t work for you, you can also download the “.deb” file from this location. Once downloaded, double click the file and install additional codecs. After installation, restart your chrome browser. In my case, this is Vivaldi. Play the video and it should work now.
In the case of Firefox, all you have to do is update Mozilla Firefox to the latest version for your Linux distribution. But there is a small caveat. Firefox supports OpenH.264, which is different from the proprietary HEVC 264. So the particular video I tested played well on OpenH.264. However, not all H.264 videos will play on OpenH264, and there is no workaround to get proprietary H.264 and H.265 to work on Firefox.
If you have any questions or concerns regarding video codecs, let me know in the comments below.
Also Read: Best Download Manager for Linux