Codec and Containers in simple terms

Codec:-

              – this can be classified as two terms

1)Hardware Codec

2)Software Codec

1)Hardware codec:—Coder and Decoder

Our computer or smartphone’s etc.. such devices can only understand only 1’s and 0’s (of course surprisingly the whole computing world is running on 2 states 0 and 1 –of course Quantam computing is a newly emerging technology which depends on states of atoms which is for different purpose like we can use it for fields which involves large computations but for regular works combination of 0 and 1 is best.

so now coming back to our original topic as a computing device can only understand 0 and 1 we need to convert analog signals to 0’s and 1’s and feed for processing . this task is done by a chip on your mother board which is hardware codec.

A hardware decoder consists of DAC(digital to analog converters)  and ADC (analog to digital converters) as there names suggests their purpose is.

—in nutshell

encoder will:

1)take video frames

2)produce a valid bit stream

decoder will:

1)take that valid bitstream

2)reconstruct the video frames from it.

2)Software Codec:–

can be considered as Compression and Decompression

This type of codec is nothing but an algorithm which compress or decompress the above obtained raw bits from hardware codec’s  using particular documented standards.

e.g:–MPEG-2, H.264, HEVC,MPEG-4 part2,Windows Media Video from MS etc…

Note :- that “MPEG” can refer to both codecs and containers, as you will see below. This adds to the confusion, but just know that “MPEG” alone doesn’t mean anything, e.g. I have a file in MPEG format is really confusing.

–> so why do we require many codec’s ..why can’t we have one single codec from single manufacture?

the answer to this question can be :-

1)High quality

2)Better Playback

3)Low Latency (time delay)

4) or else any other purpose

as seen different codec’s(software codec’s) are meant for different purposes. some are built to achieve first purpose some for second etc…

To find it practically try downloading a HD video from youtube..,  may be it is 500MB but this is a compressed one.., (i.e implemented using codecs).the raw “bit stream” may be around 10GB (who knows :p) so u cant download the later.so we commonly use lossy compressions (though some data is lost,fidelity is taken care) rather than lossless compressions which will be of large sizes.

Containers:-

Now  as mentioned in the above paragraph “bit streams ” we can watch a video only with a bitstream but practically we wont because if we have only video bitstreams it is useless because video without audio is useless .

so we need to also have audio along with video

       but till now what codec’s did ?

they managed with video bitstreams (i.e compression and decompression or analog to digital is done) but nothing about audio is done

this is done using containers.

1

so as seen a container like AVI or MKV or MP4 or FLV are used for this purposes. they contain a number of codec’s ,,metadata,subtitles(optional) and audio files.

we need containers because :-

1)Maybe you want some audio along with the video

2)Maybe you want to skip to a certain part in the video

3)Both audio and video should be perfectly synchronized

4)etc,, like even for transferring in networks

also JPEG MP3 are containers but with only single file types unlike AVI or MKV which have multiple file types

 you can look at comparison of video container formats

Comparison of video container formats

there is also some confusion in terms like hardware decoder and software decoder (mostly in smart phones ) what is the difference ?

hardware decoder or software decoder both are used for same purposes but:-

Generally, if you can view your movies using hardware, it will use less battery than software. You need to use software when the video you are trying to view is not supported in hardware.but generally software will be more accurate

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s