Home » Codec Algorithms

Codec Algorithms


Raw uncompressed video as you see uses a tremendous amount of data. In the gaming environment we want to transmit and store, many simultaneous camera images on as few a servers as possible. In order to accomplish this task practically and efficiently the data requires compression before it can be transmitted or recorded.

Compression is performed when an input video stream is analyzed and information that is indiscernible to the viewer is discarded. Each event is then assigned a code – commonly occurring events are assigned a few bits and rare events will have more bits. These steps are commonly called signal analysis, quantization and variable length encoding.

The more the images are compressed, (meaning more information has been discarded), the lesser the quality. The challenge becomes to have the maximum amount of compression yet retain a certain standard of quality. Obviously, at some point if the video is compressed too much you end up with unusable video.

Older technologies, which use “simple” codecs, cannot do this efficiently. The newer codecs are “complex” and can intricately analyze an image resulting in better video transmission, smaller file sizes and superior image quality.  Newer codecs can efficiently compress video more than 100x.

There are 2 types of compression; hardware and software. It is actually a case of compression and decompression.

When using hardware compression there are minimal loss of efficiencies, as all the work is being done on the DVR capture card by hardware components designed for that specific function. That is of course if you have all the right components.

Software compression utilizes software to instruct the computer’s processor and memory to perform specific operations. As encoding and decoding functions are very intense, the processor and memory are taxed to their limits and beyond. It becomes further exacerbated when the computer is asked to perform multiple tasks simultaneously and there is just not sufficient power to perform. As the processor is being stressed it generates heat and accompanying noise. This leads to concerns of overheating and instability.

This is why we talk time and again about the system being designed to perform the function it is being asked to do; which explains why many DVR’s are only capable of performing certain minimal tasks. Meaning, trying to record and display high quality real time images on multiple cameras simultaneously is not going to happen on low-end DVR’s running software compression.

Codec Comparison

The Codec, which stands for co mpression- dec ompression,” is a program or algorithm that lies at the heart of the DVR/video capture encoder card. The quality of the codec being run on your video capture card can make or break your system’s visual and overall performance.

Poor Codec Compression Vs. Good Codec Compression

Not unlike computer processors and other digital technology, codecs have evolved rapidly over a relatively short period of time and continue to evolve and improve as we write these words.

The algorithm underlying the older codecs such as MPEG4, MPEG2 and wavelet is the Huffman Algorithm, which dates back to the 1950’s. The more current H.264 codec uses both the old Huffman algorithm and the new Arithmetic technology.

One of the headaches legacy security companies have is, they are accustomed building a black box that they can sell for years. Not so the case in IT. It is a continuous process that requires constant updating and modification to stay current; which is why many leave it to the IT savvy companies to produce, while they merely market.

In the information technology (“IT”) world we often speak of 180 days as one lifetime. Think about when you buy a PC – how long is it before the next greatest model is on the market? Every Christmas there is something new and usually at some point in between there are other advancements. So think about using an algorithm that dates back 50 years. Processing speeds of DSP’s have increased almost 50% in the last year alone.


One of the oldest Codecs still in use. MJPEG (Motion JPEG) is usually found in the least expensive and lowest performance DVR’s. While capable of providing decent image quality, MJPEG is inefficient, resource intensive and requires massive amounts of storage space. It hogs bandwidth, which impedes network transmission. It has little use in an enterprise environment.


MPEG2 is a very common codec and has been in widespread use for more then a decade. It has a good reputation as a stable codec and, up until a few years ago, was the choice of most broadcast professionals. While smaller in file size then MJPEG it is still larger and more difficult to transmit across networks then newer codecs. MPEG2 dates back to the mid 1990’s.


MPEG-4 (Part 2) is an object-based compression. In MPEG4, individual objects – rather than a scene of objects – are tracked separately and compressed together to create a data packet. This results in more efficient compression than MPEG2 or MJPEG and it is scalable, from low bit rates to very high. MPEG4 is approximately twice as efficient as MPEG2. MPEG4 dates back to the late 1990’s.


Most recently H.264, also known as MPEG-4 Part 10 (Advanced Video Coding), has emerged as the leading codec for commercial video compression technology. Offering still significantly greater compression than its predecessors, H.264 provides up to 25% better compression then the current MPEG-4 ASP (Advanced Simple Profile). It also has the best image quality, smallest packet size, provides DVD-quality video and transmits video more efficiently over networks than any of the previous technologies. Unlike the previous codecs it is able to negotiate rapid complex images and provide razor sharp quality. H.264 is the first of what is known as a complex codec. The following chapter compares the different compression technologies.

Be very skeptical of people who say they have a proprietary codec and that it’s not MPEG or whatever. Codecs are incredibly complicated to develop and are created by consortiums of some of the world’s leading companies. The amount of years it takes to develop these applications with the number of people and companies involved make it highly unlikely anyone can develop a proprietary codec.
Where this is misleading is, each DVR manufacturer needs to modify the standard codec slightly in order to secure the data, so it may not be easily manipulated. This is important with respect to court admissibility. So technically speaking, each manufacturer’s solution is in a way proprietary but based on the standard codec.