How to configure H.265/HEVC in Linux? - Tutorial

Updated: February 8, 2017

Recently, I've come across a small, possibly innocent problem. I tried to play a full HD video that was encoded with H.265, and for the first time ever, VLC complained that it did not know what to do. I tried this in Trusty, and I was surprised by the error. It said: No suitable decoder module: VLC does not support the audio or video format "hevc". Unfortunately, there is no way for you to fix this.

Ha, ha! The joke is on you! Of course I'm going to fix this. So without spending too much time on pointless introductions, let us. This will be one of my shortest articles, and I'm sort of struggling with the concept, but we'll do fine. We will fix for Ubuntu first, but then we will also provide a solution for other distributions, too. Follow me.

H.265 / HEVC error

Solution (Ubuntu)

What we need to do is, we need to add the H.265 codecs to our platform. At the moment, they are not natively available in the existing repositories, so we will need to add a new PPA. There are inherent risks in this, but this is an interim solution until we get full, integrated support in VLC builds for Ubuntu. In fact, by the time you are reading this article, the fix may already be in place. Then again, you wouldn't be reading unless there is a problem, now would you? To wit:

sudo apt-add-repository ppa:strukturag/libde265

The next step is to update the system and install the missing plugins:

sudo apt-get update
sudo apt-get install vlc-plugin-libde265

After this step is complete, start or restart VLC. You should be able to play the video clips without any problem. Please note that you might encounter an odd glitch here and there, and the support may only be partial or experimental. However, officially, VLC does support H.265, so it's only a matter of time before this becomes a non-issue.

Other details (still Ubuntu)

If you're interested in the full background story around this issue, you may want to consult the libde265.org guide for all the gory data. Furthermore, this may not work, and you may get a VLC dependency issue if your VLC is too old. You will first need to fully update the system. The libde265 plugin only works with VLC 2.2 and above.

Then, the repository also offers Gstreamer plugins for other applications, too, like Totem, for instance. If you want to have a full 4K support for all your software, then you may also want to optionally install the following two packages - please note the difference between the two frameworks (Gstreamer 0.10 AND Gstreamer 1.0), similar to what I've outlined in my Fedora 24 pimping guide.

sudo apt-get install gstreamer0.10-libde265
sudo apt-get install gstreamer1.0-libde265

Non-Ubuntu solution

Speaking of Fedora, Google Chrome store also has the H.265 / HEVC player extension available, by the same team that has developed the PPA above. You can use it to play 4K videos, too. This solution also extends beyond the immediate Ubuntu support, although I expect a native fix across the board very soon. Anyhow, I tested the player in Fedora 24 and also Fedora 25, and it seems to work just fine.

Chrome Extension, in Fedora 24

Go to chrome://apps, launch the player, simple.

Conclusion

Here we go, a quick article with a quick and simple fix. At the moment, the resolution for the VLC not being able to play H.265-encoded videos is to add a new repository and install a missing plugin. The error message is misleading, which is why you should still search online to figure out if there are any useful tips or tricks. In general, as a rule of thumb, if it's VLC or Linux, we should be able to solve it quickly. Gstreamer gives us what we need for other applications, and Chrome gives us the support for non-Ubuntu releases.

Anyhow, we're done. I hope you learned something useful today. If you have any other VLC-related issues, or any issues, do ping me. Happy media streaming, and stay tuned for a handful of fresh new tutorials on media stuff, coming soon.

Cheers.