What is a codec?
A codec, also known as coder/decoder is an encoding tool that processes video and stores it in a stream of bytes. Codecs use algorithms to effectively shrink the size of the video or audio file and then decompress it when needed. There are dozens of different types of codecs and each use a different technology in order to encode and shrink your video for the intended applications. Popular codecs including Xvid, Divx, MPEG-4, H.264, etc.
What is compression?
With codec, you can encode files in two ways: lossy compression or lossless compression.
Lossy compression commonly used to compress multimedia for delivery and the data you have compressed in such as way will loss some of the original data but achieves much small file sizes. And the key when using lossy compression is to settle on the highest quality compression format for your intended use, so that you can make a balance between loss of quality and file size. Lossless compression is usually used by film industry and video editing.
Lossless compression is just the opposite. It works much like compressing and decompressing a ZIP or RAR file . With this compression algorithms, the file doesn’t loss much quality. However, it is not an efficient way to store large files since there isn’t much compression. In addition, lossless compressed files will take up much bandwidth to make it viable compression option.
What is a container?
A multimedia file usually end up with, for example: .mov, .ogg, .wmv, .flv, .mp4, .mpeg, etc…These extensions defines the video file format. And these video files are packed in an container or wrapper, which contains all the information such as video stream, audio stream, metadata, subtitles, chapter-information, synchronization, etc needed to preserve the video. To stream multimedia data, they should be encapsulated together in a container format. Common file container format including Flash (.flv, .swf), MKV, MP4, etc.