H.265/HEVC (High Efficiency Video Coding) Status and How-To Encode Videos to H.265

Orange Pi Development Boards

Now H.264 is the main standard used for video compression, and most devices that can support video playback feature an SoCs capable of H.264 hardware video decoding. Since 2004, however, work has been done to improve H.264, and a new standard called High Efficiency Video Coding (HEVC), also referred to as H.265, will eventually replace H.264, even though this will take a few more years to really gain traction.

H.265 Logo

HEVC will be able to double the data compression ratio compared to H.264 with the same quality, or improve the quality using the same bitrate, and it can support 8K UHD (Ultra High Definition) with a resolution of 7680×4320 (4320p). This new video codec is a big deal for those who pay for video bandwidth (80% of internet traffic according to Ericsson), and it should also be welcomed by consumers, as it will magically double their storage device capacity, and they may say farewell to buffering messages while watching online videos. I still have to watch YouTube videos @ 360p to get a reasonable experience here…

The High efficiency video coding (HEVC) standard will be ratified in January 2013, but Qualcomm already showcased H.265 decoding on a SnapDragon at MWC 2012, Ericson unveiled the SVP 5500 H.265 Encoder for broadcasters at IBC2012, and a few other companies also announced H.265 solutions.

Fully optimized solutions should be available at the end of 2013, and broad use is bound to take a few more years, as was the case when content moved from MPEG-2 to MPEG-4/H.264. Ericsson uploaded an interesting video about the new standard, explaining why HEVC was being developed, and Jacob Strom (Ericsson Research) compares several images encoded with H.264 and H.265 using the same bitrate, and it clearly shows improved quality with the new codec.

You can read Overview of the High Efficiency Video Coding (HEVC) Standard. (19 pages PDF), If you are interested in the theory and technical details behind HEVC/H.265.

If you are adventurous, Fraunhofer provides reference software capable of encoding and decoding to/from HEVC. The main goal of this software is to provide a tool to experiment by the new codec, and it’s not particularly efficient or speedy, as you’ll discover below. As a user, it is actually a complete waste of time to do that, since, AFAIK, the most used players do not support the standard yet. But let’s go for it anyway.

All information you need is on Fraunhofer’s High Efficiency Video Coding (HEVC) page, but to get started with the software, you just need to download the documentation. I’ll document the steps I’ve followed to encode a short sample of Big Buck Bunny to H.265 in Ubuntu 12.04. You can also build and run the programs in Windows if you prefer.

First, checkout the code, and build the reference software:


The build should complete within a short time, and you’ll have 8 binaries in ../../bin directory, but we’ll only use 2:

  • TAppEncoderStatic – The release version of the H.265 / HEVC encoder
  • TAppDecoderStatic – The release version of the H.265 / HEVC decoder

Before we can use the tools, we need a video file in YUV format. If you don’t have one, you can convert any video file (I’ll use big_buck_bunny_480p_H264_AAC_25fps_1800K_short.MP4) to YUV with ffmpeg  avconv (ffmpeg is deprecated, and we should use avconv instead).

First, install the package containing ffmpeg/avconv, if you don’t have it already:


Convert the file to YUV, and get the width, height, framerate and number of frames with avconv:

avconv -i big_buck_bunny_480p_H264_AAC_25fps_1800K_short.MP4 big_buck_bunny_480p_25fps_short.yuv

Now let’s encode this yuv file to h.265:

./TAppEncoderStatic -i big_buck_bunny_480p_25fps_short.yuv -wdt 856 -hgt 480 -fr 25 -f 100 -c ../cfg/encoder_intra_main.cfg

Where:

  • wdt – Indicates the width of the video (avconv reports 854, but since  frame width must be a multiple of the minimum CU size, I’ve set it to 856).
  • hgt – Indicates the height of the video
  • fr – Sets the frame rate
  • f – Number of frame
  • c – Refers to the config file to be used. You main noticed config file name with “main” and “he10”, those correspond the “main” and “main 10” profiles of the standard, which allows respectively 8-bit and 10-bit color depth (Over one billion colors)

Encoding took 966 seconds with this config file, which corresponds to around 10 seconds per frame on my machine (Intel Core 2 Duo @ 1.8 GHz). The file name is str.bin by default, but if you want to set your own file name add something like “-b big_buck_bunny_480p_HEVC_25fps_short.h265”. I also tried another config (encoder_lowdelay_P_main.cfg) which took 1 hour for 50 frames. So I’d recommend just using a few frames (even just one) for testing. The resulting HEVC file was bigger than the original H.264 file most probably because of different quality settings. There are many settings, and you may have to spend some time to understand them.

Now let’s decode our file back to YUV:


Decoding was much faster as it just took 12 seconds for 100 frames.
Now let’s check the encoding/decoding process worked properly, by downloading YUV Player and opening big_buck_bunny_480p_recontructed.yuv.

Big Buck Bunny Frame Encoded to H.265, Decoded to YUV, displayed in YUV Player
Big Buck Bunny Frame Encoded to H.265, Decoded to YUV, displayed in YUV Player

Nice! It works!

There’s also x265 project, an implementation that targets “embedded, FPGA, GPU and MultiCores systems”, but it has recently been suspended due to lack of free time of the developer.

19
Leave a Reply

avatar
19 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
9 Comment authors
RolandHandbrake 0.10 Supports H.265 and VP8 Video EncodingMediaTek MT8127 SoC to Bring H.265 Video Support to Mid-Range Android TabletsPractical Applications and Benchmarks of GPU Computing via RenderScript and OpenCL with ARM Mali-T6XX GPUvedelll Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Member

What about the patent situation?

So7t
Guest
So7t

@Ian Tester
Good question!

Nani
Guest
Nani

How to select the prediction method weather its intra or inter.
And on what basis we select the prediction method.

trackback

[…] and all ARM SoC providing multimedia capabilities support it. However, a new codec called H.265 (aka HEVC) is coming with twice the compression ratio with the same quality saving a lot of money for those […]

James
Guest
James

hello, I executed my encoder and it displays the following warning before starting encoding process.. please could any one help. I am a newbie in this field but so much interested.

HM software: Encoder Version [10.0][Linux][GCC 4.7.2][32 bit]
******************************************************************
** WARNING: –SEIDecodedPictureHash is now disabled by default. **
** Automatic verification of decoded pictures by a **
** decoder requires this option to be enabled. **
******************************************************************

trackback

[…] compression ratio. There’s a already some experimental implementation that allows to (slowly) decode and encode H.265 on your PC, as well as some HEVC implementations optimized for ARM SoCs. At least two other codecs […]

trackback

[…] wrote an introduction to H.265 (aka HEVC) at the end of last year, including instructions showing how to encode videos to HEVC using the reference implementation. It worked but since it was not optimized for speed, it was […]

Guillaume FORTAINE
Guest
Guillaume FORTAINE

x265: Open-Source H.265/HEVC Video Encoder

http://www.phoronix.com/scan.php?page=news_item&px=MTQxODY

m][sko
Guest
m][sko

you are right about Rockchip with sw decoder
http://www.youtube.com/watch?v=99sXlKHHDzs
it is nice that quadcore can handle ( 848×360 25fps)
I would like to see cpu load.
I checked libav/ffmpeg for h265 decoder
and current implementation don’t use any NEON instructions
only SSE.
I hope that we will see rockchip contribution to libav 🙂

m][sko
Guest
m][sko

I just did some benchmarks on ARM cortex-9 dual core 1,5GHz

libav with h265 support from
https://github.com/OpenHEVC/libav

and
./avconv -threads 1 -benchmark -i ~/test/Sintel_272p_logo.265 -f null /dev/null

Stream #0.0: Video: hevc, yuv420p, 640×272, 25 fps
frame= 1550 fps= 48 q=0.0 Lsize= 0kB time=62.04 bitrate= 0.0kbits/s

threads=2
frame= 800 fps= 94 q=0.0 Lsize= 0kB time=32.04 bitrate= 0.0kbits/s

test files
http://www.elecard.com/en/download/videos.html

m][sko
Guest
m][sko

benchmarks with 720p25 content

./avconv -threads 2 -benchmark -i ~/test/surfing.265 -f null /dev/null
frame= 126 fps= 8 q=0.0 Lsize= 0kB time=5.12 bitrate= 0.0kbits/s

than PAL(720×576) should be fine on dual core

vedelll
Guest
vedelll

@James

Hey James,
Actually I fall into your same problem. So may I know if you managed to pass it and if yes, how?
Thank you in advance.

trackback

[…] HEVC aka H.265 is the next generation codec providing twice the bandwidth with the same quality compared to H.264. The problem is that most SoCs today don’t have VPUs supporting this new standard, and the CPU are not quite powerful enough for 1080p decoding, and software decoding via CPU will require a lot of energy, and quickly drain battery. […]

trackback

[…] support for HEVC (H.265) video playback, and targets “super-mid” range Android tablets. HEVC/H.265 video codec will allow to half the required bandwidth and/or storage for a given quality compared to H.264, or […]

trackback

[…] at less than than real-time. So even if there’s been great progress compared to previous H.265 video encoding tools,  personally, I would not rush to transcode my video library (Handbrake supports batch processing) […]

Roland
Guest
Roland

That logo HEVC…….. the text ‘Efficiency’ spelling is all wrong !?!?