If you are trying to choose a video compression methodology, get ready to be confused. The confusion starts right away with an alphabet soup that includes H.264, MJPEG and MPEG4. Now, wade through the tons of marketing hype associated with each manufacturer telling you why their preferred compression is "perfect for every application," and you will be just about ready to scream.
The reality, whether we like it or not, is one size does not fit all. No one compression can be the optimal compression for the many and varied demands of all the applications out there.
Frame-by-Frame and Temporal Compression
As you probably know by now, there are two basic types of compression: frame-by-frame and temporal. Frame-by-frame compression, like MJPEG, takes a full picture for each frame. Temporal compression, such as H.264, periodically takes a full picture and uses sophisticated algorithms to interpret what is happening between those full picture frames.
MJPEG, H.264, and MPEG4 are all good, and all have their place. MPEG4 is used for low-quality, low-bandwidth video while MJPEG and H.264 work with higher quality HD/Megapixel video. Since we are primarily talking about surveillance applications where you need to capture detail, we will limit this article to the higher-quality MJPEG and H.264 compressions.
For High-Detail Surveillance: MJPEG and H.264
MJPEG is the simplest to work with, it is non-proprietary and the variance from one manufacturer to the next is typically minimal. It can deliver the highest quality video and takes very little computer processing power to decode and display. It is also highly predictable: regardless of how much activity there is or what the lighting conditions are, the bandwidth use varies only slightly. The trade off is, under certain conditions, it can use a lot of bandwidth and storage.
H.264 is the up-and-comer. It can deliver excellent quality video, approaching MJPEG, while consuming substantially less bandwidth and storage. H.264 hardware is continuing to improve both in price and performance. For these reasons, it is fast becoming the compression methodology of choice. Since it is more complex than MJPEG, there are a few things you should look into before making a final decision on whose H.264 cameras to use.
H.264 in Greater Depth
The first factor to consider is that with H.264 there can be a huge difference in performance from one camera manufacturer to the next. H.264 has eight categories, or "profiles." Each of these profiles can have hundreds of variations, making it difficult to do an apples-to-apples comparison between manufacturers. Each manufacturer selects their implementation of H.264 based on several things like available processing in the camera and the cost to implement one profile vs. another. Buyer beware: in many cases, the lower cost-implementations do not deliver good quality in real-life applications.
The chart on page 38 lists the eight H.264 profiles, showing the tradeoff between video quality and bandwidth required. For a frame of reference, think of High Stereo Profile as IMAX movie theatre-quality and Baseline Profile as similar to what you see on You Tube.
Speaking of You Tube, another thing to consider with H.264 is latency. Because H.264 has to collect a bunch of pictures (remember: some full picture frames, some prediction frames) before it begins processing them, there can be a few seconds between when something happens and when you actually see it on your monitor. H.264 is great for streaming recorded video where you have a few extra seconds - think of You Tube and the progress bars. As in the screen capture (above right), the round marker shows what you are currently viewing and the translucent red bar shows what H.264 video has already transpired and is being buffered and processed in order for you to be able to view it.
Latency should have no impact on your system if you are not viewing the cameras live, which is most of the systems out there. However, for applications where real-time live viewing is critical like transportation, prisons, casinos and large retail, latency can be problematic.
Another factor to consider with H.264 is the computing power you need to decode it. The number of cameras a server can decode depends on the specific type of H.264 being used. Baseline and Constrained Baseline H.264 cameras use less server processing but, in turn, deliver lower quality images. Main Profile H.264 cameras deliver very good video quality with slightly higher processing requirements. Everything above Main Profile delivers very high video quality, however the processing required to decode those profiles can be prohibitive. Fortunately, the cost of processing continues to drop, thus making H.264 a good solution in more and more applications.
Finally, if you are designing a network for H.264 cameras make sure to account for "worst-case scenario" traffic. A perfect example to illustrate this is for school surveillance. During class there is no-one in the hallways and that is where H.264 really shines. During periods of little or no activity, it delivers excellent video using a fraction of the bandwidth of MJPEG cameras. However, when a class lets out, there will be a significant increase in the bandwidth needed. It should still be less than MJPEG bandwidth, so you are still getting the bandwidth benefit - but do not get caught designing your network for "best case scenario." If you design your network using the bandwidth for when the hallways are empty and that fire-alarm goes off and all the classes rush into the hallways at once, you could bring the network to a grinding halt and lose all that video.
MPEG: "I'm not dead, yet"
So, while H.264 is a strong choice and getting stronger, MJPEG is not dead yet. It is very predictable and works well in LAN environments where video is stored locally. While it does consume more storage, nowadays a terabyte is less than $150 - so, storage is much less of an issue than in the past and the increased storage cost may be less than the increase in servers required to process high-quality H.264 video.
H.264, on the other hand, can really save storage in applications where there is very little activity or motion - in some cases as much as 60 percent - while delivering video quality that is almost as good as MJPEG.
And the Winner is...
So, which compression is best for your application? It depends! It depends on a wide range of factors including amount of motion, scene lighting, weather conditions, etc., in the areas under surveillance. In LAN installations where there is constant activity and you need to view images live, MJPEG may be the better choice as the bandwidth, processing and storage requirements will be predictable. In WAN environments, where you are only recording - no live monitoring - and bandwidth is at a premium, H.264 is probably the better choice.
Unfortunately, there are no online calculators that objectively compare one compression against another to help you make this important decision. Therefore, my recommendation is to arrange with your integrator and/or manufacturer to test drive your preferred camera candidates before you buy and measure the performance for your unique application.
As for the eventual winner, the consumer market is driving huge investments in H.264-compatible hardware, so that each year the technology's quality and efficiency is improving and the costs are dropping. Today, I see MJPEG and H.264 as neck-and-neck, however as specifiers and integrators become more experienced in designing H.264 systems, it will increasingly be difficult for MJPEG to keep up.