Wednesday, March 7, 2012

Media Codecs, Containers and Formats: A Ready Reference

Digital Media is a revolutionary thing all over the world and is the cheapest source of entertainment as well as infotainment for a common person. In the last decade, the availability and emulation of digital media is so much increased. We can't stay away from our MP3 players, iPods and cellphones. MP3 music is the greatest invention for music industry and is very much easily available anywhere. The popularity of MP3 is mainly due to its flexibility, platform independence and its fine compression which can produce better quality audio at lower bitrates (usually 128 kbps is preferred). But still, there is somewhat confusion among people about the media formats, codecs and containers. Today, I am going to tell you everything about these things. Usually, the common audio formats that we use are .wav, .mp3, .aac, .amr, .wma, .m4a etc. On the other hand, the video formats are .mpg, .avi, .mp4, .3gp, .mkv, .wmv etc. Every format is developed for a particular purpose and is emulated on particular platform.
In the sense, digital media (audio or video) is compressed into relatively small files by a software known as ‘coder’ and is again reproduced into original media by the software called as ‘decoder’. The word ‘codec’ refers to the amalgamation of coder (co) and decoder (dec). We have to install a particular codec on our system to emulate or play particular format of media. Three type of codecs are 1. Image codecs, 2. Audio codes and 3. Video codecs.
MPEG (Moving Pictures Experts Group) is the standardization group of experts of ISO which develops and sets standards for video and audio compression and transmission. Another group of this standardization is VCEG (Video Coding Experts Group) which is formed by ITU (International Telecommunication Union).

Audio Codecs:
The consumer audio comes from music industry originally in ‘compact discs’ (CDs). This audio is in uncompressed format which provides very much good and surround quality of sound. A CD contains 80 minutes of this uncompressed audio. It doesn’t require any codec software for playback or emulation. This uncompressed audio requires a lot of space on disc. This space is not available on many systems. So, this uncompressed audio is ‘ripped’ on hard disc and compressed into small files by the ‘codec’ that we manually choose. These codecs compress the audio into very small-sized files (of few MBs) which are easier and better for playback. Let me summarize some of the main audio codecs:

1. PCM (Pulse Code Modulation): This is very basic method to represent analog voice signals digitally. It was invented in 1937. But, it is still the standard form of digital audio in computers, telephones and other systems. This is the lossless codec implies audio is not compressed in this format. Its filename extension is .wav.
2. MP3 (MPEG-1 Audio Layer-3): This codec was designed by MPEG and is patented by USA in 1993. It is the lossy method of audio compression implies during compression there is some loss. It reduces the amount of data required to represent an audio signal. Thus, gives the same quality of sound as that of CD. The MP3 file created is about 11 times smaller than original CD at bitrates of 128 kbps. Thus it is very efficient codec. Its filename extension is .mp3.
3. AMR (Adaptive Multi-rate Audio): This is audio compression codec designed especially for human speech recording. This is adapted by GSM and UMTS as their standard audio codec. Usually, digitally recorded audio is compressed using AMR which vomits the streams other than human speech resulting many hours of recorded speech compressed into few MBs. This was invented in 1999. Two forms of AMR are NB (Narrowband) WB (Wideband). This is used in real-time audio streaming on web due to its small size. Its filename extension is .amr.
4. MIDI (Musical Instruments Digital Interface): This is actually not a codec but is the method optimized for storing and reproducing instrumental music streams. This stream doesn’t contain actual audio signal but contains codes of particular instrument at a particular frequency. So, the whole music stream is stored in few KBs saving disc space. Its filename extension is .mid.
5. MP2 (MPEG-1 Audio Layer-2): This was developed by MPEG is now replaced by MP3 but remains dominant for audio broadcasting and is used on Video CDs. Its filename extension is .mp2.
6. AAC (Advanced Audio Coding): This format is successor to MP3. This is the lossy compression codec for storing digital audio and is now standardized by ISO. It achieves better audio quality than that of MP3 at similar bitrates. It is the default audio codec for Apple Inc. products. Apple Lossless format is the implementation of AAC. It is also adopted as the audio part of MPEG-4. Its filename extension is .aac or .m4a. .m4a refers to MPEG-4 audio stream.
7. WMA (Window Media ™ Audio): This was created by Microsoft Corporation and is the default audio codec for Microsoft Windows and their products.


Video Codecs:
The playback of digital video on computer system is not very simple because if video is uncompressed, it consumes a lot of GBs of hard disc and also volatile memory. So, video often comes in compressed form. Following are the most common video codecs:
1. Motion JPEG: This is the most basic video codec where each video frame is compressed as a stream of JPEG images. It is the lossy video codec. It is common in video-cameras.
2. MPEG-1: It is the lossy codec for video compression developed by MPEG. It is now a widely compatible video codec. This codec is used in Video CDs, digital cable/satellite broadcasting.
3. MPEG-2: This codec is successor to MPEG-1. It was primarily developed for ‘Digital Television Broadcasting’, cable and satellite TV. The first version of technology for DTH, DVB -1(Digital Video Broadcasting) uses MPEG-2 codec. MPEG-2 is the default video codec in DVDs. Its main feature is that it transports higher resolution and higher bitrate video much efficiently and provides very much better quality.
4. MPEG-4: This is the successor to both MPEG-1 and MPEG-2. This is referred commonly as ‘MP4’. It is the multipurpose version of MPEG having many applications regarding the needs of cellphones, pocket players, videoconferencing, broadcasting etc. There are again two parts of MPEG-4. These parts are 1. MPEG-4 Visual and 2. MPEG-4 AVC.
1. MPEG-4 Visual: This part has major two profiles namely, Simple Profile (SP) and Advanced Simple Profile (ASP). Simple Profile is used in situations where the low bitrate and low resolution is mandatory e.g. cellphone, pocket player, low videoconferencing etc. Advanced Simple Profile is commonly used on PCs or higher resolution systems. The video running on cellphone is usually MPEG-4 Visual Simple Profile. MPEG-4 Visual is similar to H.263 codec developed by VCEG of ITU. Streaming videos on YouTube mobile use this codec.
2. MPEG-4 AVC (Advanced Video Coding): I highlight this part because it is today becoming the widely compatible video codec having very high efficiency and compression capability. It delivers the high-quality of video at relatively lower bitrates. It saves upto 50% bitrates during compression resulting into smaller size of video file. As per my observation, a complete rip of movie is compressed in 750 MB in AVC format. It is mainly aimed at the distribution of high-definition (HD) video. Almost every HD video comes in this format. It is the official video codec on Blu-ray disc. The second version of technology used for DTH, which is DVB-2 uses MPEG-4 AVC. This is codec also aimed real-time high-quality video-streaming as well as videoconferencing. The streaming videos on YouTube and other websites use this video codec.
Actually, development of this video codec was the joint project of MPEG and VCEG. Thus, MPEG-4 AVC is also called as H.264 referring to successor of H.263.

5. H.263: This is a video codec originally designed for low-bitrate systems such as cellphones. The videocalls on UMTS or 3G network use this codec. This is also used on streaming videos on Internet. It was used on YouTube. But, with the arrival of H.264 or MPEG-4 AVC, many of the websites including YouTube have discarded this codec. The alternative to this codec is MPEG-4 Visual Simple Profile which is already explained.
6. H.264: This is same as MPEG-4 AVC. Literally, H.264 is another name for MPEG-4 AVC.

7. DivX (Digital Video Express): It is the most popular private video codec which is developed by DivX Networks Inc. Its main feature is to compress lengthy video segments into small-sized files at higher visual quality. It is supported on many DVD players. It actually implements both profiles of MPEG-4 Visual (SP and ASP). It is the video codec commonly associated with ‘ripping’ of DVDs.

8. Xvid: It is the competitor to DivX. It implements MPEG-4 Visual ASP. It is similar to DivX, also compresses lengthy video segments into small-sized files and associated with ‘ripping’ of DVDs. It is also supported on many DVD players. It is not a separate video format but is a ‘program’ to decode and encode MPEG-4 ASP videos.

9. WMV (Window Media ™ Video): This was created by Microsoft Corporation and is the default video codec for Microsoft Windows and their products. It is also adopted on Blu-ray discs.

10. HEVC (High-Efficiency Video Coding): Also referred as H.265, HEVC is emerging video codec having amazing efficiency of compression. This will be the successor to MPEG-4 AVC or H.264. The final drafting work on this will complete in 2012.


Containers:
Media container is the particular ‘file’ which bounds video and audio together using specified codecs. You can refer video container as video format. Every container has its own filename extension and can support many codecs at a time. Following table summarizes some of the popular video containers or formats.


Sr. No.ContainerDeveloped byFilename ExtensionSupported CodecsNotes
1.MPEG-TSMPEG.mpgMPEG-1, MPEG-2Widely Compatible
2.AVI (Audio Video Interleave)Microsoft.aviMotion JPEG, DivX, Xvid, AVCWidely Compatible
3.MPEG-4MPEG.mp4MPEG-4 Visual, MPEG-4 AVCBecoming Widely Compatible
4.3GPP (3rd Generation Partnership Project)3GPP.3gpH.263, MPEG-4 Visual Simple ProfileDeveloped specially for mobiles
5.FLV Flash VideoMacromedia Flash.flvH.263For video streaming on web
6.MatroskaMatroska.org.mkvMPEG-4 Visual, MPEG-4 AVC/H.264Stores number of subtitles, audio and video streams into single file. This format is getting very popular due to this unique feature. One can switch between audio and subtitles during runtime. Commonly used for storage of full-length movies and TV shows.
7.QuickTime MovieApple Inc..movMPEG-4 Visual ASP, AVCDeveloped for Apple products
8.DATVideo CD.datMPEG-1Container format for video on VCD
9.DVD-Video ObjectDVD.vobMPEG-1, MPEG-2Container format for video on DVD

And this was the sufficient information which may be required by you anytime. I think MP3 from audio and MP4 from video should the standard formats as they are widely compatible as compared to others.
I will always provide you updated information about this subject. Be in touch…
Thanks and Regards,
Nitish R. Muley

No comments:

Post a Comment