Home » » H.264 and MJPEG compression basics

H.264 and MJPEG compression basics

Written By dfd on Monday, November 10, 2014 | 12:02 PM

The essential difference between MJPEG and H.264 video compression methods is the algorithms used. The MJPEG image is compressed sequentially, frame by frame, and it is transmitted like that through the network. Each transmitted frame is processed independently, so it is sent frame by frame to the destination and then connected into one flawless video.  Positive features are the ease of compression and processing speed. Such compression does not require extensive coding and decoding resources. Negative – high video resolution requires huge amount of data transferred, which raises the requirements of network bandwidth and the size of video archive.
IQeye Alliance mxH.264 or MPEG-4 part 10 (AVC) is the latest video compression format used in vast variety of video equipment. Fundamental principles are similar to predecessor MPEG-4: relatively full or Key frames are transmitted periodically and between them information is transmitted only on the changed part of the image. However, this process uses a lot more sophisticated and complex algorithms than the older version of the MPEG-4, for video decoding it uses not one, but few reference frames. These unique features  significantly reduces the amount of transmitted and recorded data while maintaining a similar quality to MJPEG, but at the same time requires a significant amount of CPU resources for video encoding and decoding. It is for this specific reason H.264 compression format encountered skepticism in beginning, but because of the rapid development of today’s CPU’s the H.264 standard is used very widely, from mobile phones to digital high-definition television. It should also be noted that into H.264 video stream you can integrate audio, so generally speaking, to code the audio stream into the H.264 compression profile from any source, microphone or any external source.
So it seems that the benefits of H.264 compression method are obvious, so why still we need MJPEG?
H.264 considerations
As for video surveillance systems, system requirements should be defined and planned as precise as possible. Not in all cases the H.264 advantages are significant. Normally a video surveillance’s goal is visual confirmation of some event (or lack of it) with the ability to identify objects involved in it (identifying people, reading vehicle plate numbers and etc.). In case of general observation identification is not necessary, but when the video becomes evidence in a court or other institutions you need highest possible quality, so sometimes it is worth paying more for Ethernet traffic or bigger capacity of hard drives for the belief that the necessary information will be transmitted and recorded.
The most common problem in the design and implementation of systems with H.264 format cameras is prediction of the amount of network data rate. It can fluctuate in quite large range, depending on the intensity of image change, environmental conditions and camera features. Usually the average data rate is selected or sometimes even worse- the needed  minimum, and on that basis required network bandwidth and archive size is calculated. Worst case happens when bandwith limits for camera are set on that calculated minimum values basis. In case of a radical change of image and the need to transfer larger amounts of data, depending on camera settings it has two alternatives: a) reduce image quality (resolution), b) reduce the number of frames. Both of these actions will reduce image quality and instead of the expected result you will get a low quality video. Practice shows that in most situations exactly that video record is needed for evaluation.
Factors affecting the size of the H.264 stream can be various: rain, snow, strong wind, low illumination (especially important for cameras that have a lower noise reduction or sensitivity) or the camera mounting instability. In all of these cases it is needed to calculate what maximum bandwidth will be achieved and on that basis it is recommended to plan your storage and network traffic. Another option can be choosing MJPEG format, which  bandwidth is more predictable and varies in small range.
H.264 profiles
As for H.264, it should be noted that this standard is very broad and includes many tools and features that can be used or not. The mere mention of the H.264 in specifications not always guarantees all of advantages offered by this format. According to these properties there are several sets of H.264 profiles: baseline (Baseline Profile, BP), extended (Extended Profile, ET), main (Main Profile, MP) and high (High Profile, HiP), each of these can be divided further in details. BP profile is mainly used for video conferences and in mobile devices, where high compression is necessary and where devices have limited computing resources. MP profile has been used in standard-definition digital TV broadcasts and other video applications which require good image quality and data compression rate. HiP profile is used for high-definition digital television broadcasts, as well as video recording and playback of HD DVD and Blue Ray format files. Most of the IP video surveillance camera manufacturers use the BP profile, and only the few, including IQinVision – MP (main profile). MP profile for video compression ensures excellent image quality and reduces Ethernet data bandwidth (compared to MJPEG).
Recommended fields of application – video surveillance in a friendly environment, where significant image resolution and a large number of frames per second are needed, and also in situations when an audio recording or two-way audio communication is needed, benefits of this format are particularly clear in such cases.