Ubuntu + FFMPEG + H265 - Getting Started

High Efficiency Video Coding (HEVC), which is more commonly known as h265, since it is the successor to H.264, has been out for a while now, and ffmpeg added it on the 12th of February 2014. I have had a little bit of practice with it now, and whilst my first reaction was to be blown away by the initial results of the compression (less than 10% initial file size), I have come to realize that video encoding really is a fine art, so this post will be a "dummies" post on getting started with doing a basic conversion with default settings, and being able to play the result. Readers can then delve deeper into mastering the art in an upcoming post.

H265 will not work with HTML5 in Firefox or Chromium (currently 15th August 2014).

[ Initial conversion from h264 (bottom) to h265 (top) ]

Installing FFMPEG

Here is how to install FFMPEG on Ubuntu 14.04
sudo add-apt-repository ppa:samrog131/ppa -y
sudo apt-get update
sudo apt-get install ffmpeg -y

Conversion Command

This is an incredibly simple conversion command that converts the video to h265 and just copies the audio, all bundlded within a Matroska file.

ffmpeg -i $inputFile -c:v libx265 -c:a copy $outputFile.mkv
One can specify settings to override the defaults for improving speed/compression/quality, but that is beyond the scope of this post.

Play H265

Unfortunately, the default VLC for Ubuntu 14.04 (2.1.5 Rincewind), does not appear to have h265 support.
We will need to run these commands to be able to play any h265 videos.
sudo apt-add-repository ppa:strukturag/libde265 -y
sudo apt-get update
sudo apt-get install vlc-plugin-libde265 -y

Summary

H265 can produce amazingly small filesizes with a little reduction in quality, or halve the filesize with no detectable change in quality. This could already be having a massive effect on internet based video. As it stands, 1 out of every 3 bits flowing on the internet is video, mostly in the form of Netflix and Porn. Reducing this to 25%-50% means that not only will these files be able to fit more easily onto your mobile devices, but they will be able to stream there a lot more quickly and cheaply, although we will probably just increase resolutions instead.

It did take a lot longer to convert than I'm used to but maybe now I can reclaim some space on my BTRFS RAID 10 NFS. I will now keep two copies of each video, a single 480p x264 for streaming to my tablet, and a 1080p or higher copy in x265 for my desktops.

References

3 comments:

  1. Still a no-go. Running Ubuntu 14.04, add the PPA, update and try to add ffmpeg says there is no installation candidate.

    ReplyDelete
  2. I want to convert HEVC back to MPEG-4. How to do accomplish that?

    ReplyDelete
    Replies
    1. ffmpeg -i $inputFile -c:v libx264 -c:a copy $outputFile.mp4

      Delete