Monday, June 23, 2014

Video coding: a historical timeline of standards and formats

Back to the main Vcodex site: video compression and streaming resources. Register with Vcodex for free to read the full version of this article.

Iain Richardson and Abharana Bhat, June 2014

Who should read this?



Video coding standards are a fundamental part of many codecs in use today. If you are learning about video codecs or involved in codec development, it is important to know what a video coding standard is and how the existing standards have evolved. Newer video codecs such as H.264/AVC and HEVC have a basic structure that is similar to older codecs such as MPEG-2 part-2. This blog begins by describing a video coding standard and the need for standardisation. The process of standardisation is briefly explained. The timeline of development of popular video coding standards and video coding formats is outlined.


What is a video coding standard?



A video coding standard is a document describing the bitstream structure and the decoding method for video compression. The standard does not define the encoder; rather it defines the output structure that an encoder should produce. Video coding standards typically define a toolkit, a set of tools to coding video. Not all pieces of the toolkit need to be implemented to create a standard compliant bitstream. However, decoders conforming to the standard must implement some subset of the toolkit.


Why standardise?



Standardisation enables encoders and decoders from different manufacturers to work together across a range of applications. Standardisation allows for decoding of bitstreams from previous and emerging standards. There is also a greater freedom for consumers to choose between manufacturers. For developers of standard-compliant video coding systems, the published standard is an essential point of reference as it defines the capabilities that a video codec must conform to in order to successfully interwork with other systems.

The standardisation process


The main steps towards the finalisation of a standard are shown in Figure 1.


Slide2.png
Figure 1. The standardisation process (Copyright: Vcodex Limited)


In the first phase, the requirements for a specific application or a field of applications are identified. Example for a field of applications includes video data exchange via communication networks. The next phase involves the development of different algorithms by various laboratories. The developed algorithms are compared and a set of basic techniques which forms the core of the standard is selected and refined in a joint effort during the collaboration phase. At the end of this phase a draft standard is issued, which has to be validated by compliance testing based on computer simulations or hardware tests and field trials. After successful validation and refinements, the final standard is published.

The timeline


Two standardisation bodies, the international standards organisation (ISO) and the international telecommunications union (ITU), have developed a series of standards that have been central to the development of the media industry. Popular ISO coding standards include MPEG-1, MPEG-2 and MPEG-4 standards. ITU-T has published the H.26x line of coding standards including H.261, H.262, H.263 and H.263+. Other video coding formats include Theora, VPx and Daala. The timeline of some major standards and video formats over the last 20 years is shown in figure 2.


Slide1.png
Figure 2. Timeline for various video coding standards and formats (Copyright: Vcodex Limited)


Many of the basic concepts of video coding such as transform coding, motion estimation and compensation and entropy coding, were developed in the 1970s and 1980s.


For more information on these popular video coding standards and formats, register with Vcodex (for free) and download the complete article.







Monday, May 5, 2014

HEVC and VP9 video codecs - try them yourself


Abharana Bhat and Iain Richardson, May 2014

High efficiency video coding (HEVC) and Google’s VP9 are new codec formats designed to support HD and ultra HD streaming and broadcasting. This article explains how to start experimenting with HEVC and VP9 encoding. This is a short summary of the full article available at http://www.vcodex.com/h265.html

1.    HM reference software for HEVC

The HM software codec is a reference implementation of the HEVC coding standard developed by the Joint Collaborative Team on Video Coding (JCT-VC). It is suitable for experimenting with the various features available in the HEVC coding standard and/or for checking compliance, but may not be suitable for real-time implementations. The following steps will show you how to build and run the HM codec.

Step 1: Get the source code
Step 2: Build the software according to the instructions here:
Step 3: Using the encoder

The HEVC encoder requires three inputs:
·       uncompressed (raw) YUV or Y4M file,
·       codec configuration file
·       sequence specific configuration file
For example, the following command line runs the HM encoder with codec configuration file encoder_randomaccess.cfg and sequence configuration file jockey.cfg.
./TAppEncoder -c encoder_randomaccess.cfg -c jockey.cfg
Step 4: Decoding and playback

The encoder will output two files: a compressed .bin file and a reconstructed .yuv file. The YUV file can be played back using a YUV player such as GLYUVPlay. GPAC’s Osmo4 player can playback the .bin file if you change the file extension from .bin to .mp4.

2.    x265 encoder for HEVC

x265 is an open source software and library for HEVC encoding and decoding developed by a consortium led by MulticoreWare. It is available under the GNU General Public License. 
The software can be used as a standalone tool or with FFMPEG as a library. The download and installation instructions are as follows:

Step 1: Get the source code and install instructions from https://bitbucket.org/multicoreware/x265/wiki/Home.

Step 2: Follow the install instructions. Check if installation is successful by typing x265 at the terminal.

Step 3: The command line to run the encoder is

x265 [options] infile [-o] outfile

whereinfile” is an uncompressed source file (YUV or Y4M) and “outfile” is a compressed HEVC bitstream.

Step 4: Use x265 as a library in the FFMPEG framework

To use the x265 encoder via FFMPEG, install x265 by following steps 1-4 and re-configure FFMPEG with -enable-libx265.
The command line for using x265 library via FFMPEG is:
ffmpeg -i [input] -c:v libx265 [options] output[.265/.mkv]

FFMPEG currently does not support the MP4 file format for HEVC files. You can use MP4Box to convert .265 to mp4 format.

3.    Webm VP9 codec

Step 1: Download and install the vp9 codec from the WebM project website: http://www.webmproject.org/code/ 

Step 2 Type vpxenc at the command line to see if the installation was successful.

Step 3: Example command line for running the vp9 encoder using vpxenc.

vpxenc --codec=vp9  --profile=0  --fps=50000/1001 --static-thresh=0 --drop-frame=0 --good --auto-alt-ref=1  --kf-min-dist=50 --kf-max-dist=50 --min-q=32 --max-q=32 --max-intra-rate=50 -threads 4 -w 1280 -h 720 --limit=500  in_to_tree_420_720p500.yuv -o in_to_tree_420_720p500_vp9_qp32.webm

Step 4: Decoding and playback

Option 1: convert to uncompressed YUV video using FFMPEG for playback using the following command line:

ffmpeg -i input.webm -f rawvideo out.yuv

Option 2: use the latest version of VLC player to playback the webm file.

To find out more

Visit  http://www.vcodex.com/h265.html for a full version of this article and for more resources on HEVC, VP9 and other video codecs.

Wednesday, January 15, 2014

Comparing HEVC and H.264 : Update

I've updated this post to include instructions for HEVC / H.265 playback using VideoLAN's VLC player.

This post explains how you can compare the quality of the new High Efficiency Video Coding (HEVC) standard with its predecessor, H.264/AVC. I've uploaded three versions of the same sequence:
a. Encoded using HEVC / HM10
b. Encoded using H.264 / x264 at twice the bitrate of a.
c. Encoded using H.264 / x264 at the same bitrate as a.

To compare H.264 and HEVC / H.265:

1. Download and install VLC version 2.1.2 or later : http://www.videolan.org/vlc/
Or: download and install the latest version of GPAC, which includes the Osmo4 player:
2. Download the following test sequences:
a. Kristen and Sara, 720p, 10 seconds, 60 frames per second, HEVC / HM10 Anchor (Random Access, QP=32), approx 420 kbps.
b. Kristen and Sara, H.264 / x264 / veryslow preset, QP=31, approx 810 kbps. https://www.box.com/s/is2sdqh7tqdiuc1i76g6
c. Kristen and Sara, H.264 / x264 / veryslow preset, QP=37, approx 440 kbps.

3. Play back each test sequence using the VLC or Osmo4 player.

Things to look out for:
- At the same bitrate (~420kbps), is the quality of the HEVC sequence (a) significantly better  than the H.264 sequence (c)? In my view, yes.

- At half the bitrate (420kbps vs. 810kbps), is the quality of the HEVC sequence (a) as good as the H.264 sequence (b)? In my view, the HEVC sequence displays smoother motion, but loses some fine detail.



To experiment with other test sequences:

1. Download + install GPAC, as described above:
This package includes the Osmo4 player and the MP4Box utility.

2. Download an encoded HEVC anchor bitstream (.bin) from:
ftp://ftp.kw.bbc.co.uk/hevc/
(I chose "Kristen and Sara, QP=32" from the HM10 / Random Access folder for the above examples).

3. Rename the downloaded bitstream: from (name).bin to (name).265

4. Package as an .mp4 file. Open a command prompt and type:
mp4box -fps (fps) -add (name.265) (name).mp4
- where (name.265) is the renamed bitstream file and (fps) is the number of frames per second of the original sequence.

(Here's an example of the command line for the Mac, your path may be different: /Applications/Osmo4.app/Contents/MacOS/MP4Box -fps 24 -add Kimono1_qp32.265 Kimono1_qp32.mp4)

5. Open with VLC or Osmo4 and play back.

Notes

Windows: Playback of 720p HEVC sequences is a little jerky but works reasonably well. Playback of higher-resolution sequences is very jerky on my PC.
Mac : Playback of 720p and 1080p HEVC clips on my Mac (10.8.3, 2.9GHz) is reasonably smooth.

Quality is subjective

Video quality is, of course, highly subjective. Do you think the 420kbps HEVC sequence (a) is as good as, or better than, the 810kbps H.264 sequence (b)?

- Iain Richardson

Friday, November 15, 2013

MPEG Internet Video Coding

MPEG is working on a standard for Internet Video Coding. The aim is to develop a standard that includes a royalty free Baseline Profile, with performance that is comparable to the Baseline Profile of H.264/AVC.

The plan is to develop a final draft of the standard by July 2014. You can read the Call for Proposals here:
http://mpeg.chiariglione.org/standards/exploration/internet-video-coding/call-proposals-internet-video-coding-technology

and a draft of the Test Model (an early working version of the proposed standard) is available here:
http://mpeg.chiariglione.org/standards/exploration/internet-video-coding/internet-video-coding-test-model-itm-v-60

The Test Model includes familiar elements such as 16x16 macroblocks, a DCT-like transform and motion compensated prediction, with multiple reference pictures, bidirectional prediction and multi-hypothesis prediction.

We'll keep you posted as the IVC standard continues to develop.

- Iain Richardson

Monday, August 19, 2013

Visiting DC this week

Delighted to be heading to Washington DC this week to give an invited talk to technical staff at the Smithsonian Institution. I'll be talking about recent developments in video coding formats, including the new HEVC standard, and what implications these developments might have for the Smithsonian.

Wednesday, June 26, 2013

Video: introduction to coding video

A short, easy introduction to video compression or video coding, by Iain Richardson, author of "The H.264 Advanced Video Compression Standard". Find out:
- why video coding is important
- why video codecs keep getting better
- what are the building blocks of a video codec
- how do partitioning, prediction, transform and entropy coding work
- how much can HEVC compress a video clip.

Play on Youtube

Monday, June 24, 2013

HEVC resources: update

Recent HEVC / H.265 resources:

1. An introduction to High Efficiency Video Coding (PDF)

2. HEVC walkthrough: taking you through some of the features of HEVC 
using the Elecard HEVCAnalyzer (Youtube or Vimeo).

High Efficiency Video Coding (HEVC) Walkthrough by Vcodex from vcodex on Vimeo.

3. Getting started with HEVC : how to download + play back HEVC clips

Comments and feedback are always welcome.

- Iain