Codec 101

First of all what is a Codec?

"Codec" is a technical name for "compression/decompression". It also stands for "compressor/decompressor" and "code/decode". All of these variations mean the same thing: a codec is a computer program that both shrinks large movie files, and makes them playable on your computer. Codec programs are required for your media player to play your downloaded music and movies.

"Why do we need codecs?"

Because video and music files are large, they become difficult to transfer across the Internet quickly. To help speed up downloads, mathematical "codecs" were built to encode ("shrink") a signal for transmission and then decode it for viewing or editing. Without codecs, downloads would take three to five times longer than they do now.

First you must familiarize yourself to RFC and ITU-T standards... Yes, you must read those and prepare a lot of caffeine cause you will be dozing off after a few minutes...

http://www.itu.int/ITU-T/
http://www.ietf.org/

To Use a codec in your program, download the available codec provided by SUN Microsystems...
Below is a sample code of G711

http://www.koders.com/

Now what will you do with this codec? How would you use it in your program?

First you need to compile this to create the appropriate DLL files in which your application have a way to integrate with the DLL file to access its functionalities.

Codecs have different payload types. Ok so what is a payload type? Below is a sample of the available codecs with their corresponding payload types.

The primary purpose of the audio/video profile is to define the mapping from payload format to payload type number. Accordingly, the majority of the work needed to demonstrate interoperability consists of testing that media data is exchanged in an interoperable manner using the full range of codecs enumerated in the profile.

The following codecs are assigned static payload types. It should be verified that interoperable implementations exist for each static payload type:
  1.The 8kHz PCMU codec (payload type 0)
2.The 8kHz 1016 codec (payload type 1)
3.The 8kHz G726-32 codec (payload type 2)
4.The 8kHz GSM codec (payload type 3)
5.The 8kHz G723 codec (payload type 4)
6.The 8kHz DVI4 codec (payload type 5)
7.The 16kHz DVI4 codec (payload type 6)
8.The 8kHz LPC codec (payload type 7)
9.The 8kHz PCMA codec (payload type 8)
10.The 8kHz G722 codec (payload type 9)
And a lot more... See the internet draft

Almost all the availble codecs are written C++. The only way to check the functionalities and arguments in using the codecs are through its header files. And always check the comment cause it gives you the neccesary information for working with your codecs. (Taken from the link above).

Example for G711

/*
* linear2alaw() - Convert a 16-bit linear PCM value to 8-bit A-law
*
* linear2alaw() accepts an 16-bit integer and encodes it as A-law data.
*
* Linear Input Code Compressed Code
* ------------------------ ---------------
* 0000000wxyza 000wxyz
* 0000001wxyza 001wxyz
* 000001wxyzab 010wxyz
* 00001wxyzabc 011wxyz
* 0001wxyzabcd 100wxyz
* 001wxyzabcde 101wxyz
* 01wxyzabcdef 110wxyz
* 1wxyzabcdefg 111wxyz
*
*/


Now, you will have a way to interact with your codecs to be used on your application.

コメント

人気の投稿