Comparing VP9 AND x265 HEVC
In case you didn't know, x265 (HEVC) and VP9 are two different video codecs that are supposed to achieve the same perceptual video quality at half the bit-rate (thus half the file size and required bandwidth) of x264 content. Most of your video content is likely to be in x264 encoded mp4 or mkv files, unless you're still in the 90s and using wmv, ogg, or avi files.
After finding out about VP9 which is comparable to HEVC in compression (file-size vs quality), and discovering that my Nexus 10 was able to play content that was encoded with it (unlike HEVC), I decided to look much further into it. If good enough, this might be worth re-encoding my media content to from h.264 so that I can save storage space, whilst still being able to watch movies in bed with my tablet.
The comparisons I make are typically based on encoding film and 3D animation videos with 2-pass encoding in ffmpeg with a non-overclocked i5-4670k, at 3000kbps "average" bit-rate using the ffmpeg guides for the other parameters such as tiles (6) and parallel frame (1) etc. I found that 3000 kbps was high enough that I wasn't concerned about losing quality in film content, but low enough to get a small enough file-size (the sweet spot). The bit-rate required for Anime content is likely to be much lower, and screen recordings even less than that.
VP9 is open and royalty free unlike HEVC (see here). I must confess that I'm not quite sure what this really means as I'm able to download VLC and ffmpeg for free and decode/encode HEVC with them. I guess that's because "HEVC Advance made an exception that specifically waives the royalties on software-only implementations (both decoders and encoders) when not bundled with hardware." - Wikipedia
If your computer has more than 4 threads, which fairly easy now with Ryzen 7, you will be disappointed to find out that for 1080p content, VP9 encoding can only make use of 4 threads. x265 can make use of all of them, so encoding a single video at a time, will be much faster. However, if you are running your own video site, such as a Netflix or a Youtube spin-off, then you are going to want to bulk transcode multiple files at a time, each on a single thread, then this problem doesn't matter to you.
Time To Encode
If you compare encoding at the same thread count (see previous point), then both are in the "stupidly long" and "go to bed" time periods at 4 threads which is roughly 6-7 seconds to encode per second of video. This is noticeably longer than the "go make a cup of tea" duration that x264 requires. However, I found that a Ryzen 7 1700 was able to encode HEVC content slightly faster than 1 second per second of video (takes less time to encode than it does to watch). This gives HEVC a significant edge in my book as I am likely to encode only 1 video at a time. I saw a talk on youtube from VLC that stated that HEVC was a little faster, but I wouldn't sit around waiting for either. If you want to process a lot of videos, you need to build a compute cluster, and/or look into using GPUs to encode (something I have never done).
I decided to see which tool was better at handling screencasts that I had recorded at 60fps using the simple screen recorder tool. Screen recordings, unlike movies, have a lot of non-moving content where most of the pixels remain exactly the same. Not only that, but there is a lot of "perfect" movement, such as dragging a window across the screen. This means that it should require a much lower bit rate to achieve a high quality compared to a movie where there is a lot of movement, lighting changes, changes in focus etc. I found that at just 500 kbps, the VP9 content was noticeably better than the HEVC content (especially around text).
Decoding / Playback
If you're using a tower, you are unlikely to have any issues playing back either of these formats. However, I found that with VP9, there is a significant lag with being able to resume playback after skipping around compared to HEVC. obviously this is more noticeable on a mobile device, and especially noticeable at higher bitrates (I'm typically using 3000kbps for both video types).
I found that VP9 playback noticeably works better using the chrome browser rather than using VLC or MX Player. This is a shame because I really like being able to swipe the screen to skip forward/backward in these players which can't be done in Chrome.
Nexus 10 (Tablet)
The Nexus 10, which is pretty old now, is able to play back "acceptable" bitrate level (1500kbps) VP9 content in the chrome browser, and completely unable to play HEVC content. However, at 3000 kbps, it does appear to struggle.
Moto G4 (Phone)
The Moto G4 is able to play back HEVC content in Mxplayer and VLC much better than it is able to play back VP9 content in a chrome browser. I am guessing this is due to better decoding support in the SoC for HEVC. I think this is likely to be a trend going forward.
The Raspberry Pi 3 appears to be unable to play back 1080p videos encoded with either of these codecs. I was really disappointed to find this out as I had thought it would be able to play VP9, giving it an edge due to the popularity of the PI for HTPC machines. I'd be surprised if the next Pi to come out didn't have hardware accelerated HEVC decode support.
I only tested using the Kodi image instead of using Raspbian with a chrome browser which may or may not be better at handling VP9.
Youtube has supported VP9 for quite some time now, but does not support HEVC. This makes sense for two reasons:
- VP9 is developed by Google which owns youtube.
- You are probably watching youtube videos in chrome, which excels at playback of VP9 content (although this is likely to be because chrome also belongs to Google, and they have probably heavily optimized it).
If you use youtube-dl -F [video url] then you will see that you can download high quality VP9 content. I find it odd that you often see larger file sizes for the VP9 files than x264 based mp4 files because VP9 should get the same quality at half the bitrate of x264. If anything you would expect lower filesizes for VP9 as you are supposed to be making a trade-off between getting a lower file size for the more grunt required to decode at the same perceived video quality.
As much as I really wanted to love and use VP9 because I love things that are "open", due to the issues I found with not being able to skip around quickly at higher bitrates, and its lower playback performance in android players (MX Player and VLC), I have decided to stick with HEVC and just upgrade my tablet at some point in the future. I will continue to use VP9 purely for screen recordings, and uploading to youtube.