- Video codec
A video
codec is a device orsoftware that enablesvideo compression and/or decompression for digital video. The compression usually employslossy data compression . Historically, video was stored as an analog signal onmagnetic tape . Around the time when thecompact disc entered the market as a digital-format replacement for analog audio, it became feasible to also begin storing and using video in digital form, and a variety of such technologies began to emerge.Audio and video call for customized methods of compression.
Engineers andmathematicians have tried a number of solutions for tackling this problem.There is a complex balance between the
video quality , the quantity of the data needed to represent it, also known as thebit rate , the complexity of the encoding and decoding algorithms, robustness to data losses and errors, ease of editing, random access, the state of the art of compression algorithm design, end-to-end delay, and a number of other factors.Applications
Digital video codecs are found in
DVD (MPEG-2 ),VCD (MPEG-1 ), in emerging satellite and terrestrial broadcast systems, and on the Internet. Online video material is encoded in a variety of codecs, and this has led to the availability of codec packs - a pre-assembled set of commonly used codecs combined with an installer available as a software package for PCs.Encoding media by the public has seen an upsurge with the availability of
DVD-writers . Since commercially available DVDs are usually dual-layer, and hence bigger than the more common single layer writable DVDs, it is often the case that the material has to be compressed again, sacrificing quality so that the media will fit onto a single layer disc.Video codec design
Video codecs seek to represent a fundamentally analog data set in a digital way. Because of the design of analog video signals, which represent luma and color information separately, a common first step in image compression in codec design is to represent and store the image in a
YCbCr color space. The conversion toYCbCr provides two benefits: first, it improves compressibility by providing decorrelation of the color signals; and second, it separates the luma signal, which is perceptually much more important, from the chroma signal, which is less perceptually important and which can be represented at lower resolution to achieve more efficient data compression. It is common to represent the ratios of information stored in these different channels in the following way Y:Cb:Cr. Refer to the following article for more information aboutChroma subsampling .Different codecs will use different
chroma subsampling ratios as appropriate to their compression needs. Video compression schemes for Web and DVD use make use of a 4:2:0 color sampling pattern, and theDV standard uses 4:1:1 sampling ratios. Professional video codecs designed to function at much higher bitrates and to record a greater amount of color information for post-production manipulation sample in 3:1:1 (uncommon), 4:2:2 and 4:4:4 ratios. Examples of these codecs includePanasonic 's DVCPRO50 and DVCPROHD codecs (4:2:2), and thenSony 's HDCAM-SR (4:4:4) or Panasonic's HDD5 (4:2:2). Apple's new Prores HQ 422 codec also samples in 4:2:2 color space. More codecs that sample in 4:4:4 patterns exist as well, but are less common, and tend to be used internally in post-production houses. It is also worth noting that video codecs can operate in RGB space as well. These codecs tend not to sample the red, green, and blue channels in different ratios, since there is no perceptual motivation for doing so.Some amount of spatial and temporal
downsampling may also be used to reduce the raw data rate before the basic encoding process.The most popular such transform is the 8x8discrete cosine transform (DCT). Codecs which make use of awavelet transform are also entering the market, especially in camera workflows which involve dealing with RAW image formatting in motion sequences. The output of the transform is firstquantized , thenentropy encoding is applied to the quantized values. When a DCT has been used, the coefficients are typically scanned using a zig-zag scan order, and the entropy coding typically combines a number of consecutive zero-valued quantized coefficients with the value of the next non-zero quantized coefficient into a single symbol, and also has special ways of indicating when all of the remaining quantized coefficient values are equal to zero. The entropy coding method typically uses variable-length coding tables. Some encoders can compress the video in a multiple step process called "n-pass" encoding (e.g. 2-pass), which performs a slower but potentially better quality compression.The decoding process consists of performing, to the extent possible, an inversion of each stage of the encoding process. The one stage that cannot be exactly inverted is the
quantization stage. There, a best-effort approximation of inversion is performed. This part of the process is often called "inverse quantization" or "dequantization", although quantization is an inherently non-invertible process.This process involves representing the video image as a set of
macroblocks . For more information about this critical facet of video codec design, seeB pictures .Video codec designs are often standardized or will be in the future- i.e., specified precisely in a published document. However, only the decoding process needs to be standardized to enable interoperability. The encoding process is typically not specified at all in a standard, and implementers are free to design their encoder however they want, as long as the video can be decoded in the specified manner. For this reason, the quality of the video produced by decoding the results of different encoders that use the same video codec standard can vary dramatically from one encoder implementation to another.
Commonly used standards and codecs
A variety of codecs can be implemented with relative ease on PCs and in consumer electronics equipment. It is therefore possible for multiple codecs to be available in the same product, avoiding the need to choose a single dominant codec for compatibility reasons. In the end it seems unlikely that one codec will replace them all. Some widely-used video codecs are listed below, starting with a chronological-order list of the ones specified in
international standard s.H.261 : Used primarily in older videoconferencing and videotelephony products. H.261, developed by theITU-T , was the first practical digital video compression standard. Essentially all subsequent standard video codec designs are based on it. It included such well-established concepts as YCbCr color representation, the 4:2:0 sampling format, 8-bit sample precision, 16x16 macroblocks, block-wisemotion compensation , 8x8 block-wisediscrete cosine transform ation, zig-zag coefficient scanning, scalar quantization, run+value symbol mapping, and variable-length coding. H.261 supported onlyprogressive scan video.MPEG-1 Part 2: Used forVideo CD s, and also sometimes for online video. If the source video quality is good and the bitrate is high enough, VCD can look slightly better than VHS. To exceed VHS quality, a higher resolution would be necessary. However, to get a fully compliant VCD file, bitrates higher than 1150 kbit/s and resolutions higher than 352 x 288 should not be used. When it comes to compatibility, VCD has the highest compatibility of any digital video/audio system. Very few DVD players do not support VCD, but they all inherently support the MPEG-1 codec. Almost every computer in the world can also play videos using this codec. In terms of technical design, the most significant enhancements in MPEG-1 relative to H.261 were half-pel and bi-predictivemotion compensation support. MPEG-1 supports onlyprogressive scan video.MPEG-2 Part 2 (a common-text standard withH.262 ): Used onDVD ,SVCD , and in most digital video broadcasting and cable distribution systems. When used on a standard DVD, it offers good picture quality and supports widescreen. When used on SVCD, it is not as good as DVD but is certainly better than VCD due to higher resolution and allowed bitrate. Though uncommon, MPEG-1 can also be used on SVCDs, and anywhere else MPEG-2 is allowed, as MPEG-2 decoders are inherently backwards compatible. In terms of technical design, the most significant enhancement in MPEG-2 relative to MPEG-1 was the addition of support forinterlace d video. MPEG-2 is now considered an aged codec, but has tremendous market acceptance and a very large installed base.H.263 : Used primarily for videoconferencing, videotelephony, and internet video. H.263 represented a significant step forward in standardized compression capability forprogressive scan video. Especially at low bit rates, it could provide a substantial improvement in the bitrate needed to reach a given level of fidelity.Sorenson Spark: A codec that was licensed to Macromedia for use in its Flash Player 6. In the same family as
H.263 .MPEG-4 Part 2: AnMPEG standard that can be used for internet, broadcast, and on storage media. It offers improved quality relative to MPEG-2 and the first version of H.263. Its major technical features beyond prior codec standards consisted of "object-oriented" coding features and a variety of other such features not necessarily intended for improvement of ordinary video coding compression capability. It also included some enhancements of compression capability, both by embracing capabilities developed in H.263 and by adding new ones such as quarter-pelmotion compensation . Like MPEG-2, it supports bothprogressive scan andinterlace d video.DivX ,Xvid ,FFmpeg MPEG-4 and3ivx : Different implementations of MPEG-4 Part 2.MPEG-4 Part 10 (a technically aligned standard with theITU-T 's H.264 and often also referred to as AVC). This emerging new standard is the current state of the art ofITU-T andMPEG standardized compression technology, and is rapidly gaining adoption into a wide variety of applications. It contains a number of significant advances in compression capability, and it has recently been adopted into a number of company products, including for example theXBOX 360 ,PlayStation Portable ,iPod ,iPhone , theNero Digital product suite,Mac OS X v10.4 , as well asHD DVD /Blu-ray Disc .x264 : A GPL-licensed implementation of H.264 encoding standard, x264 is only an encoder.VP6 ,VP6-E ,VP6-S ,VP7 : Proprietary high definition video codecs developed by On2 Technologies used in platforms such as Adobe Flash Player 8 and above, Adobe Flash Lite, Java FX and other mobile and desktop video platforms. Supports resolution up to 720p and 1080p.Sorenson 3: A codec that is popularly used by Apple's
QuickTime , basically the ancestor ofH.264 . Many of the QuickTime movie trailers found on the web use this codec.Theora : Developed by theXiph.org Foundation as part of theirOgg project, based uponOn2 Technologies'VP3 codec, and christened by On2 as the successor in VP3's lineage, Theora is targeted at competing withMPEG-4 video and similar lower-bitrate video compression schemes.WMV (Windows Media Video):Microsoft 's family of video codec designs including WMV 7, WMV 8, and WMV 9. It can do anything from low resolution video for dial up internet users to HDTV. The latest generation of WMV is standardized bySMPTE as theVC-1 standard.VC-1 : SMPTE standardized video compression standard (SMPTE 421M). Based on Microsoft'sWMV 9 video codec. One of the 3 mandatory video codecs in bothHD DVD andBlu-Ray high-definition optical disc standards. Commonly found in portable devices and on streaming video websites in itsWindows Media Video implementation.RealVideo : Developed byRealNetworks . A popular codec technology a few years ago, now fading in importance for a variety of reasons.Cinepak : A very early codec used by Apple's QuickTime.Huffyuv : Huffyuv (or HuffYUV) is a very fast, lossless Win32 video codec written by Ben Rudiak-Gould and published under the terms of the GPL as free software, meant to replace uncompressed YCbCr as a video capture format. See Lagarith as a more up-to-date codec.Lagarith : A more up-to-date fork of Huffyuv is available as Lagarith.SheerVideo : A family of ultrafast lossless QuickTime and AVI codecs, developed by BitJazz Inc., for RGB [A] , Y'CbCr [A] 4:4:4 [:4] , Y'CbCr [A] and 4:2:2 [:4] formats; for both 10-bit and 8-bit channels; for both progressive and interlaced data; for both Mac and PC.Mobiclip, a codec created by
Actimagine , maximising mobile phone battery life when playing full length films on a smart-phone handset.All of the codecs above have their qualities and drawbacks. Comparisons are frequently published. The tradeoff between compression power, speed, and fidelity (including artifacts) is usually considered the most important figure of technical merit.
Missing codecs and video-file issues
A common problem when an end user wants to watch a video stream encoded with a specific codec is that if the exact codec is not present and properly installed on the user's machine, the video won't play (or won't play optimally).
Windows XP SP2 itself only has a very limited number of video and audio codecs installed; other than Microsoft formats, Intel
Indeo is the only available .avi Codec that is installed per default. All other codecs, such as DivX, Xvid or Theora, must be installed manually. [http://support.microsoft.com/kb/291948 List of the available/default codecs after a Windows XP Installation] [http://support.microsoft.com/default.aspx?scid=kb;en-us;899113 List of the available/default codecs after a Windows XP SP2 Installation]Some video files and codec analysis tools have been made available to provide a user-friendly way to solve this common problem:
[http://www.kcsoftwares.com/?vtb VideoInspector] : Analyzes most containers (AVI, Matroska, MPEG, etc.) and gives direct download links for missing codecs.
[http://www.headbands.com/gspot GSpot] : A pioneer in troubleshooting video applications, GSpot remains a useful tool despite missing some features present in other software.
[http://mediainfo.sourceforge.net MediaInfo] : Open-source alternative to GSpot.
[http://avicodec.duby.info AVICodec] : Another useful application.
[http://members.home.nl/vbtool/avi2clipboard.htm AVI2Clipboard] : An extension for the Explorer context menu to easily view and save information about videos with an AVI container.
MPlayer orVLC media player resolve many of these issuesFact|date=June 2008 because they contain many popular codecs in a portable standalone library, available for manyoperating systems , including Windows, Linux, and Mac OS X. This also resolves many issues within Windows in conflicting and poorly installed codecs.Fact|date=June 2008Video codec benchmarking
To benchmark video decoders, try the [http://haali.cs.msu.ru/mkv/ Haali TimeCodec] . You have to install the latest version of the Haali Media Splitter before using it.
Another method is using the internal audio and video decoders built into
TCPMP for both mobile devices and desktop PC's. See [http://blogs.shintak.info/articles/11359.aspx Shinos TCPMP benchmark page]See also
*
Video compression
*Video quality
*Subjective video quality
*Open source codecs and containers
*Comparison of video codecs
* List of codecsExternal links
* [http://ivms.stanford.edu/~dsc/wzcodingvideo Wyner-Ziv Coding of Video] describes another algorithm for video compression that performs close to the
Slepian-Wolf bound (with links to source code).
* [http://www.ripcode.com/prodForm.php 2007 IDC Report on On-Demand Video Transcoding]
Wikimedia Foundation. 2010.