Introduction to Video CODECs : MJPEG, MPEG-4, H.264

By: John Honovich, Published on Jun 13, 2008

CODECs are a critical element of choosing, designing and using video surveillance systems. CODECs can lower the price of overall systems and increase the usability of systems. As such, having a basic understanding of what a CODEC is and why CODECs are used is important.

Fundamental Principle of CODECs

The most important factor to understand in video CODECs is that CODECs help balance off different costs.

For instance, let's say you want to go to the mall and to the supermarket. A few years ago, when gas was cheaper, you might have done this in 2 separate trips. Now that gas prices have increased dramatically, you might want to combine those trips. What's happening here is that as gas has become more expensive, you are willing to trade off lower convenience for savings in cash.

Likewise, using CODECs is a balance between the cost of storage, bandwidth and CPUs. Specifically:

CODECs reduce the amount of bandwidth and storage needed at the expense of using more CPU cycles.

As such, selecting a CODEC always requires you to understand the tradeoffs in cost between using less bandwidth and storage or using less CPU cycles. Generally CPU cycles are cheaper than bandwidth and storage so more advance CODECs save you money. Sometimes, CODECs can be too demanding, especially with megapixel cameras and can potentially cost you more in CPU than you save in bandwidth and storage.

Please read our basic bandwidth tutorial for a review of it's impact on video surveillance.

CODECs Overview

Video must be digitized for it to be used and viewed on a computer. CODECs are means or choices in how we make the video digital.

CODECs or compression / decompression technologies are used to modify the video that is being digitized. Similar to how you might ZIP files on your PC, the video is compressed on its way into the computer. And just like with opening a ZIP file, the video is decompressed before you use or view the video. Unlike ZIP files, the compression of video losses some of the information (engineers refer to this as lossy compression). However, with the appropriate settings, a user cannot tell the difference visually.

Get Notified of Video Surveillance Breaking News
Get Notified of Video Surveillance Breaking News

Just like in the movies or TV, video is a series of images that are displayed rapidly one after the other. In the US, TV consists of displaying a series of 30 images per second. When we view these 30 images per second, it's “video” and it looks smooth. The fact that video is made up of a stream of images is quite important for understanding CODECs.

When you use a CODEC, you can compress the video in two fundamental ways:

  • Compress the individual image by itself
  • Compress a series of images together

When you compress an individual image by itself, you simply take the image, run the compression and output the saved file (technically called intraframe compression). Just like when you use Microsoft Paint and save as a JPEG, video compression of individual images works quite similarly. The difference with video is that you need to do these for a continuous stream of images. As such, rather than simply being a JPEG, it is called Motion JPEG or MJPEG.

The benefit of MJPEG is that it requires very low CPU use. The downside is that storage and bandwidth use can be quite high.

When you only compress an individual image, you ignore what's going on between multiple images in a sequence and often send redundant information. If you are streaming video at multiple frames per second, you often are sending basically the same image over and over again. This can be quite wasteful. It's similar to someone calling you up every minute to tell you nothing changed. It would be far better for the person to only call you when news occurred. You can simply assume during the rest of the time that the status is the same.

When people talk about the benefits of MPEG-4 and H.264, not sending repetitive information is the core source of their strength. Evey so often these CODECs will send a whole image (often called an i frame). The rest of the times they only send updates describing what parts of the image have changed (technically called interframe compression). Since it is common that large parts of the image remains the same, this can result in very significant reductions in storage and bandwidth. For example, where MJPEG may send image after image at 100 KB, codecs like MPEG-4 or H.264 may send the first image at 100 KB but the next 3 or 4 images at only 10 KB each. This can approach can reduce bandwidth and storage use by 50 – 90%.

The downside with this approach is that it takes more work for the computer to do this. When you are simply compressing individual images, you do not need to worry about what happened before or what the next image will contain. You simply apply the compression rule and execute. With MPEG-4 or H.264 you need to examine groups of images and make complex calculations of what changed and what did not. You can imagine this can become very complicated and consume lots of CPU resources.

H.264 and MPEG-4 are similar in that they both reduce bandwidth and storage by examining groups of images when they compress video. A key difference with H.264 is that it uses much more complex and sophisticated rules to do the compression. Because H.264's rules are more sophisticated, they can reduce bandwidth and storage even more than MPEG-4. However, the trade-off is that it takes more CPU cycles to do it.

Looking at Current Video Surveillance Systems

The general trend in video surveillance has been a continuous movement to CODECs that save bandwidth and storage. Historically, you have seen products move from MJPEG to MPEG-4 to H.264. The reason why this has happened is because the cost of CPUs to compress the video has decreased faster than the cost of bandwidth and storage. Most experts expect this trend to continue.

Recently, the biggest challenge using CODECs in video surveillance systems has occurred with the rise in megapixel cameras. For years, the maximum resolution of security cameras was constant.However, with megapixel cameras, the resolution of security cameras has increased by 400% or more. The greater the resolution, the harder the CPU needs to work and the more cycles that need to be allocated.

The huge increase in resolution is similar to the jump in gas prices. It has changed the economics of CODECs. Whereas historically, for standard definition security cameras, CPU cycles were cheaper than bandwidth and storage. Now, since so much more CPU cycles are needed, it can cost way more in CPU than what you save in bandwidth and storage. As such, most commercial megapixel cameras use MJPEG, especially if they are multi-megapixel (more than 1.3 MP).

One of the most important elements in the next few years will be the development of new approaches and use of new CPUs to reduce the cost of using H.264 for megapixel cameras. Much like alternative energy development hopes to bring the cost of energy down, new approaches are being sought to reduce the use of CPU cycles in compressing megapixel camera feeds.

Conclusion

Related Reports

Bosch Budget 3000i Cameras Tested on Dec 05, 2019
Bosch has long had a hole in its lineup for, as it describes, "competitively-priced cameras". Now, Bosch has released its 3000i series cameras...
Top 2020 Trend - AI Analytics on Nov 22, 2019
170+ Integrators answered: What do you think will be the top industry trend in 2020? Why? For the 4th year in a row, AI/video analytics was...
Axis "Best Of The Best" 4K Camera Tested (Q1798-LE) on Nov 21, 2019
Axis has released their "best of the best" Q1798-LE bullet camera, touting "4K without compromise" with a large Micro 4/3" image sensor, custom...
Rhombus Cameras, VMS and Analytics Tested on Nov 06, 2019
Rhombus boasts they have created "the new standard in Enterprise, cloud-managed video security" and told IPVM in January 2019 they offer twice the...
100+ Companies Profile Directory on Nov 06, 2019
While IPVM covers the largest companies in the industry regularly (like Axis, Dahua, Hikvision, etc.), IPVM strives to do a profile post on each...
Pelco Sarix Pro3 Camera Tested on Oct 16, 2019
Pelco has released their Sarix Professional Series 3 cameras, claiming "more security detail in challenging scenes with excellent low light and...
Last Chance - Register Now - October 2019 IP Networking Course on Oct 10, 2019
Last Chance - Register Now - Fall 2019 IP Networking Course. The course starts next week. This is the only networking course designed...
Network Optix NxWitness 4.0 Tested on Oct 10, 2019
Network Optix released Nx Witness 4.0, proclaiming new features like a deep learning analytics metadata SDK, increased H.265 support, and UX...
'Bunker Busting' Wireless Access Startup: Sure-Fi Profile on Oct 03, 2019
An access startup is claiming its 'bunker busting' wireless Wiegand radios can punch through 'any obstruction'. We examine their offering,...
Vivotek 4K S-Series Camera Tested on Sep 30, 2019
Vivotek's highest-end S-series camera claims "Supreme Night Visibility", "Smart IR II", "Smart Stream II", "WDR Pro for unparalleled visibility in...

Most Recent Industry Reports

Disruptor Wyze Releases Undisruptive Smartlock on Dec 06, 2019
While Wyze has disrupted the consumer IP camera market with ~$20 cameras, its entrance into smart locks is entirely undisruptive. We have...
Bosch Budget 3000i Cameras Tested on Dec 05, 2019
Bosch has long had a hole in its lineup for, as it describes, "competitively-priced cameras". Now, Bosch has released its 3000i series cameras...
Anixter Resisting Takeover From Competitor on Dec 05, 2019
Mega distributor Anixter is going to be acquired but by whom? Initially, Anixter planned to go private, being bought by a private equity firm....
Security Sales Course 2020 - Last Chance Save $50 on Dec 05, 2019
This sales course is customized for the current needs and challenges specific to professionals selling video surveillance and access control...
Ireland National Children's Hospital Chooses Hikvision End-to-End With Facial Recognition on Dec 05, 2019
The world's most expensive hospital project ever, the New Children's Hospital in Ireland, has chosen an all-Hikvision surveillance system including...
AVTech ~$70 IP Cameras Tested Vs Dahua and Hikvision on Dec 04, 2019
Taiwanese manufacturer Avtech is taking direct aim at low cost leaders Dahua and Hikvision with ~$70 starlight and white light illuminator...
Ultinous European Analytics Startup Company Profile on Dec 04, 2019
European analytics-startup Ultinous pitches customers to "Have your own video analysis service!" We spoke to Ultinous to better understand their...
Access Startup Multi-Mount Aims To Streamline Reader Installs on Dec 03, 2019
Startup Multi-Mount claims it makes installing access readers 'Fast', 'Secure,' and fit 'any size frame.' The company states its bracket 'fits most...
Resideo CEO To Step Down on Dec 03, 2019
Resideo's CEO, Mike Nefkins, is stepping down, just 18 months after being brought in to lead the now plagued spin-out. Inside this note, we...
Arcules CEO Retracts False GDPR Claim + Dahua and Milestone Claims Examined on Dec 03, 2019
Arcules CEO has retracted a false claim about his organization being a "fully compliant GDPR company" after IPVM reporting (Arcules CEO Threatens...