Codec - (Compression-decompression algorithm) - A codec can be thought of as a list of instructions that identifies the method used to compress data into fewer bytes, as well as doing just the opposite, decompressing it. By following these instructions, applications such as encoders, decoders and media players can reliably compress and decompress data. Codecs are used to decrease digital media content file size and bit rate (the amount of data per second that's required to render audio and video content). With lower bit rates and smaller file sizes, digital media content can be stored and streamed over a network more quickly and easily.
A codec is applied to a file when the file is actually encoded or recorded. For instance, when you use an encoder to encode a live stream, or to create a file, or if you use player software like RealPlayer to copy a file, these files are encoded or compressed using a codec.
Most files one accesses on the Internet are at least to some extent already compressed. This saves bandwidth and increases delivery speed. This might not seem evident because you can easily download and play the file with no additional actions. Your computer can play any compressed file, provided that the codec it was compressed with is available on the computer's hard drive. Your computer uses the codec's instructions to decompress the file you want to play. If the codec is not on your computer, then a player such as Quicktime, RealPlayer or Windows Media Player will try to download the codec so that it can understand how to decompress the file. If the codec is not available, the player will let you know that it does not understand how to play the file. In this case, there's nothing wrong with the file; your computer just does not have the instructions on how to play that file.
Lossless Compression (Nonlossy Compression)