For those of you into video, I suspect you're already very excited about the "next generation" H.265/HEVC encoding format. About a year back, I already made mention of the impressive results I was seeing with playback of HEVC on the Skylake HTPC I was putting together. A year down the road, we see the ongoing development of software harnessing the power of the new encoding technique - even lower bitrate for very high quality output.
As we say goodbye to 2016, I thought I'd just "shoot the breeze" a bit and meander down some related topics. Let's talk about video encoding, what I've been doing, what I've found useful/interesting, and some speculation of what I think would be in the not too distant future as it applies to high dynamic range (HDR) video...
Over the last number of months, I have been gradually transitioning my movie server (primarily my Blu-Ray movie rips) from 1080P AVC/H.264 to HEVC/H.265 with excellent results and substantial space savings. For more details have a look at this analysis from ExtremeTech in 2013 (the year that HEVC was formally ratified). Basically, we can expect around a 50% reduction in bitrate using HEVC compared to AVC of the same quality. At times, with very clean digital sourced movies like animations, this compression ratio could be much better even. This type of advancement is clearly meaningful as the world moves forward with delivery of media over network systems. Just think of the bandwidth saved for companies like Netflix, Hulu, Amazon Prime, Vudu to have video transitioned from MPEG2, VC1, and AVC to HEVC. Furthermore, the drive for higher resolutions like 4K will demand this kind of progress for even better lossy algorithms - much cheaper to upgrade the software than a network hardware infrastructure... One practical benefit for many home users including myself is that smaller bitrate also reduces the need for buffering and improves performance in fluctuating network conditions especially when streaming wirelessly (I have a wireless Roku 4 upstairs that handles HEVC better because of this).
Notice that in the video world nobody realistically expects lossless video! There's just way too much data if it were lossless! Video degradation is really not noticeable once you hit a reasonable bitrate, even more so when the encoder is allowed the intelligence and leeway to utilize variable bitrates as the situation arises for demanding scenes. I think it's important to keep this in mind when faced with irrational beliefs around lossy audio and that somehow quality is badly compromised even with reasonably high bitrates. I trust that by now, it's clear to readers here that lossy 320kbps MP3 or 256kbps AAC do sound fantastic and it would be odd for folks (like the extreme audiophiles) to claim they can "easily" hear a difference (remember the blind test we did here years ago). This is the great thing about digital encoding - the accuracy and flexibility of digital transmissions allow us to apply powerful and intelligent algorithms that push the limits of what is achievable.
For the "earlier adopters" (we're not that early any more!), I thought I'd discuss what I've been doing with my movie server in the last year. First, as noted above, I've been encoding all my movies to HEVC (using the Windows ecosystem). The two programs I have been using are Handbrake and DivX. My default is without question Handbrake which is free and for the most part trouble free using the open-source x265 project as the software encoding engine. I noticed at times that the current official release of Handbrake (0.10.5, getting old since Feb 2016) had issues with some judder in transcoded videos. This is when I would reach for DivX. So far, the "nightly" beta builds of Handbrake with newer versions of the x265 library have been very good (discussed below).
Already, standard 8-bit HEVC encodes look great, but in many corners of the Internet, we're seeing more people using 10-bit encoding. This started years ago (around 2011) with the introduction of 10-bit AVC Hi10P encodes among anime lovers. Since hand drawn and cartoon-type animation often consist of large portions of the frame filled by solitary colors with little noise, really fine gradients and slight color irregularities can result in "banding" from 8-bit quantization that might not otherwise be noticeable in natural image capture where noise, film grain, and fine details are expected. A 10-bit encode would expand the quantization by 4x (ie. maximum 256 shades of gray now increased to 1024 shades), plus with the enhanced color accuracy, hence no need to "hard encode" extra dithering, bitrate can actually decrease and still achieve improved quality. The problem with these 10-bit AVC's though is that the decoding "profile" ("High 10 Profile" AVC) used is typically beyond the specifications of most consumer hardware. This meant that at least back in 2011 or so, you needed a pretty decent computer running the software decoder; typically at least a Core 2 Duo or equivalent... But that was then and computing power is not really an issue now unless we're looking at low-power Intel Atoms and ARM SoC's like the Raspberry Pi.
These days, with the advancement of video hardware and computing speed, I think it's time to look ahead and I believe that 10-bit HEVC will be the next ubiquitous "standard" for high quality encoding for the foreseeable future (next 10 years).
Here is what I've been doing over the last couple months...
On the software encoding side, already, 10-bit HEVC for Handbrake is out there ready to try. Grab a copy of the latest "Nightly" build of 64-bit Handbrake for Windows. Then go here to grab and drop the x265/264 .dll files (you have to register for forum access) in the "Handbrake Nightly" directory like so:
Now when you run Handbrake Nightly, you'll see options for H.265 (and H.264) that can handle 10-bit and 12-bit color depths. Here's the typical setting I use for a 4K encode:
Pretty straight forward selection of the "H.265 10-bit (x265)" encoder. "Constant quality" level 24 looks great for 4K encodes (I'll typically use 22 for 1080P - lower number is higher quality, given the lower resolution and less leeway for noticeable quality degradation especially on my 75" Vizio P75-C1 TV). In the "Encoder Preset", I use "Medium" which slows down the encoding process by allowing the lossy analysis to have more time to optimise the search for interframe changes to improve quality. Also, notice that I've selected "High Profile" on the right which will not automatically downsize the image resolution when doing 4K/2160P.
Note that there is value in using 10-bit encoding even with 8-bit videos. The file size could be smaller for 10-bit video than 8-bit due to the extra precision available to represent each pixel in a "constant quality" encode. In my own tests, I typically find file sizes about the same (+/-10%) which is really insignificant difference. However, realizing that 10-bit encoding could reduce banding especially in situations with limited bitrate makes it worthwhile I think.
As a quick example, recently I ripped Ratatouille (2007) for my video server (for the kids of course! :-). The original Blu-Ray rip is a 19.5GB H.264 with 640kbps AC3, and english subtitles. I decided to keep the AC3 and english subs, only re-encoding to HEVC 10-bit, constant quality 22, Encoder Preset at Medium. The resulting file size was a mere 1.40GB! This is almost 1/14 the size of the original - remember, clean animated images compress beautifully:
|1:1 500x500 image crop comparing original H.264 vs. H.265 transcode. Handbrake Nightly, Constant Quality = 22, Encoder Preset = Medium. x265 10-bit encoder engine. Remember, the JPG file shown here is 8-bit color only and lossy compressed.|
Like many things in life, there is a price to pay for quality... Two main points to keep in mind:
1. HEVC software encoding is slow. Currently with software like Handbrake, expect to leave your computer maybe overnight or daytime at work for 1080P movies (and maybe a day for 4K). Typically, with my Core i7-3770K @ stock 3.5GHz, it takes me about 5 hours for a 2-hour 1080P movie. Expect at least 4x that for 4K video. Note that for newer generation processors with AVX2 instructions, the x265 encoder has optimizations to take advantage of these instructions. My "Skylake" i5-6500 machine in the home theater room actually is faster anywhere from 30-100% compared to my aforementioned stock "Ivy Bridge" i7-3770 workstation despite the lack of Hyper-Threading! Not unexpectedly, 10-bit video encoding does take longer compared to 8-bit - about 10-20% slower for me...
These are very rough estimates since it really all depends on the video itself like how dynamic it is, with action shots taking longer and more space to compress. Beware of very noisy video as well. For example the grainy, dark look of Batman v Superman really bogged down the rate of conversion compared to the "cleanliness" of Pixar movies which can be converted quicker with lower bitrates to achieve similar image quality.
While fast hardware encoding is possible (like with an nVidia Pascal GPU) and is becoming more common, I suspect HEVC 10-bit hardware encoding will go "mainstream" when Intel releases Kaby Lake next year and available to forthcoming CPUs. Since I recently got an ASUS nVidia GTX 1080 graphics card, I did a quick test using myFFmpeg encoding with nVidia's NVENC. The results were OK - almost real-time transcoding (20-30 fps) of high bitrate 4K 10-bit HEVC to 8-bit Y'CbCr4:2:0. At equivalent bitrates (say 4K video at ~10Mbps), the x265 software encoding does look better. This has been the general criticism of fixed hardware encoding - it's fast but typically will need a bit more bitrate to achieve the same quality as a good software encoder.
2. Make sure you have good HEVC (especially 10-bit) hardware decoding. No point saving all this storage space while maintaining excellent quality with the latest high-tech encoding technique if you can't play it back smoothly! Unlike in the world of AVC playback where 10-bit support is limited, 10-bit HEVC support is essential because "High Dynamic Range" (HDR) basically requires the extra bit depth to make it worthwhile. I mentioned a couple weeks back that I use an Amlogic S905X TV box for movie streaming. At this time, this is the most economical way I know of to decode HEVC "Main10" files in hardware. For ~$50, I bought an inexpensive Sunvell T95X box:
|Notice the Logitech Unifying receiver on the right; the device is controlled with my K410 keyboard/trackpad.|
With HDR being incorporated into essentially all new TVs, 10-bit hardware decoding will become standard whether the panel is actually 8-bits or not. Furthermore, Intel's Kaby Lake will include 10-bit HEVC support so 10-bit HEVC is about as much guaranteed to become mainstream and ubiquitous as any technology standard.
Lastly, not to be ignored, I think it's still worth keeping an eye on Google's royalty-free VP9 which they've outfitted with 10-bit/HDR capability through "Profile 2" and rolled out officially with the recent Chromecast Ultra and YouTube HDR:
I took the picture above about three weeks ago since I was curious to see HDR YouTube myself... My Vizio P75-C1 already can do standard 4K casting but not 10-bit VP9, so likely no YouTube HDR support. I popped down to the BestBuy down the street to pick up the device. Strangely, I could not get this thing working in HDR10 mode plus I couldn't even get Dolby Vision working on Netflix despite not having any issues with the TV's built-in casting function. This is obviously very disappointing, especially since the Chromecast Ultra's advertising claims DV compatibility. Oh well, I didn't feel like fooling around with it further and got my refund. Who knows, maybe there's a firmware upgrade as I heard that others have been troubled with the lack of Dolby Vision success as well. A little surprised I couldn't even get HDR10 working easily through my Yamaha RX-V781 receiver even though the cheap S905X TV box above worked!
Let's talk audio for a little bit...
For those of you with a library of multichannel files like 5.1 FLACs ripped from DVD-A/Blu-Ray/SACD's, I have found no better way to stream multichannel than with the ODROID-C2 or Amlogic S905X TV box using the free Kodi software through the HDMI interface to my Yamaha receiver as multichannel PCM. I just point Kodi to the multichannel music directory on my NAS under the Music tab and away it goes to identify and grab album artwork. Phenomenal! Here's what my TV screen looks like when streaming the 5.1 DVD-A rip of Queen's A Night At The Opera in multichannel 24/96: