Tuesday, January 27, 2009

H.264 vs MJPEG2000 vs MJPEG

Here's an interesting article:

It's interesting because it claims that MJPEG is better than H.264. This is a strange claim. If you want to do Intra-only coding (i.e. no motion compensation), you can use H.264 in Intra mode. Detlev Marpe demonstrated that H.264 in Intra mode has similar performance to Motion JPEG2000:

Note that Marpe includes actual results, unlike the article above. So, even in Intra mode, H.264 will significantly out-perform the older MJPEG standard. Using Intra and Inter coding (i.e. adding motion compensation) will increase the performance dramatically, even if there is a lot of camera movement and detail in the scene.

If in doubt about competing claims, ask for rate-distortion results and independent subjective test results. For example, see this site for some third-party codec comparisons:

Or send me an email - I will try and answer it and give you an impartial opinion.

- Iain.


Anonymous said...

While I agree that his article is mostly silly and he is mostly defending his companies inability to source the correct encoding chips, comparisons between different reference coders might not be the same as comparing compression between two embedded compression solutions (although the result would likely be similar). Doing a good h.264 on either an embedded cpu or ASIC is in some sense harder than doing a good JPEG implementation on the same hardware. Also the surveillance industry is slightly backwards in what kind of compression they find trustworthy, rebuilding the image from scratch every frame is considered less error prone in a sense so a lot (if not most) of the surveillance camera setups are configured at MJPEG even if the cameras has some sort of MPEG support. But hopefully that is about to change.

Anonymous said...

It is stupefying such absurdities (MJPEG is better than H.264) can be read on the net. I have been in charge of a compression lab for 10 years.

Stevo said...

Some good info on this site...thanks for sharing. I agree, H.264 really is quite fantastic.
However, based on my own experience, I think the IQEye written article, does have quite a bit of merit when you are talking about using H.264 for video surveillance. We got caught up the H.264 hype and moved away from M-JPEG security cameras, for a bit, but we are finding they are not producing the same results as M-JPEG in a number of installations. We've found, through trial and error, that M-JPEG seems to handle certain applications better than H.264. M-JPEG seems to perform better in really crowded scenes such as airports, stadiums and transport terminals. In these instances M-JPEG seems to produce more accurate results, especially when you extract stills from cameras. Stills from H.264 are more blurry for some reason. Also even when recording in Intra frame only, which we've tried, the H.264 stream seems to compress the moving/changing parts of the scene in very low resolution, so when extracting stills for the purpose of say, facial ID, it is not as clear as M-JPEG. We've also found it is not uncommon in sites where we have installed H.264 security IP cameras, we have needed to reset these back to M-JPEG simply because of the computational (decompression) costs at the recording server when we needed to add more cameras. It was a choice of lower the resolution, frame rate or buy a new server! I only install H.264 cameras now for streaming applications, but M-JEPG for video surveillance.

Iain Richardson said...

Following up on Stevo's comment - which is very interesting, thanks - it sounds like the H.264 codec you have been trying to use is not particularly well designed. If (for example) the bit-rate control mechanism is not carefully designed, you can certainly end up with the problems you describe (blurry images in highly active scenes). Fundamentally, H.264 (even in intra-only mode) *is capable of* producing higher-quality video than MJPEG. But you have highlighted two important points: 1. it needs a good implementation to actually show these benefits and 2. MJPEG can be significantly less computationally complex. - Iain.

Anonymous said...

Hello! we actually think IQEYE article has a lot of merit. This reflects a lot of the pain we've experienced out there in the field. H.264 is great for the Internet, but is no way a silver bullet for security applications. Requirements for video surveillance are very different than say video conferencing or watching movies on an iPAD or Blu-ray player. Being able to extract frames and view them individually, zooming in on the image, is where M-JPEG is unbeatable - this is the key requirement in security. M-JPEG is not affected by changes in frame speed like H.264. The problem is that H264 has many profiles. Baseline profile delivering the lowest quality of all the profiles, is the one that is most commonly used by the security camera manufacturers. We've found Baseline cameras to deliver pretty ordinary video. H.264 may be a standard, but the problem is that every IP camera vendors use varied implementation techniques, so the quality varies dramatically between the products. We usually setup to stream in H.264 but record in M-JPEG.

Anonymous said...

Neither compression is "better".

Both are good and bad, it really depends on where and how you use them.

btw if H.264 "Intra mode" was as good as JPEG, then why are all IP cams both h.264 & JPEG ready?

I prefer to use JPEG recording in poor lighting and H.264 in controlled lighting. H.264 is not so good in bad lighting or busy/high activity scenes. Some .264 are better than others.

JPEG is best for number plate recognition installs.

Thanks and have a good day y'all :0)