Sunday, January 21, 2018

Which Codec Why does is Matter

Which Codec Why does is Matter


Choosing the right codec for your camera can be the difference between your camera network being fit for purpose and just being a waste of technology.
What codecs are out there and how do they work?:

Before we start this explanation it must be said this is my simplified view of theses codecs i have added links to fuller explanations should you want some bed time reading.

MJPG or Motion JPG this is essentially JPG one of the standard formats of images used on web pages due to its space saving compression applied to the image. The motion bit of MJPG is the same principle of cartoon drawing a rapid changing image with small changes equals motion. So MJPG is many JPG images displayed rapidly one image per frame.

MPEG4 or MPEG4 part2 is a block based video compression algorithm. What it actually does is it takes a view of the video stream rather than each individual frame then a comparison is made between frames and checks for changes between these frames, then only the block(s) that have changed are updated when sent to the end device. So the initial image is sent as a whole image called the key frame then only changes to the key frame are updated, unless the scene changes to such an extent that the sending of the changes would require more bandwidth than another key frame so a key frame is sent. It can be also said that the codec may also send key frames at fixed intervals to make for a smoother transition and better quality image. Compression is used to decrease the bit stream even further.

H.264/AVC or MPEG4 part 10 is just another version of MPEG4 i hear you say, well that is correct to a certain point but it is offered as an alternative to MPEG4. Its aim was to build on various standards of MPEG and greatly reduce the bit rate required for high quality video transmission/storage. It can achieve 50% or greater saving on standard MPEG4 bit stream through its greater compression and overall image interrogation algorithms.

MxPEG exclusively used by Mobotix cameras, mxpeg has been designed for surveillance cameras by a surveillance camera manufacturer. It builds on the best quality codec Mjpeg and uses the block change approach of Mpeg4, but only using Jpg compression. The result is significant reduction in the bit stream compared to Mjpeg but images of a high quality compared to H.264.

So Which Is Best?
Well there is no "best" codec, some favour reduction of the bit stream over quality of image and some favour quality of image over the reduction the bit stream. It all boils down to what you are trying to achieve. If you are performing analytics on the post event images then you would want best quality images. If you have limited band width you would want a reduced bit stream. The interesting thing about all of these codecs except one is they where not designed for IP surveillance cameras, instead they where aimed at broadcast of movies over the internet/networks. The odd one out being Mxpeg which was designed for surveillance camera streaming.

Individually then how do they stand on their merits:

MJPEG - Is high quality with limited compression, meaning you get the best image quality but at the cost of bandwidth, but because every frame is a key frame then each frame give or take a few bytes will be the same making it very easy to work out the load of a constant stream from each camera. Also because jpg compression is low the camera CPU can dedicate more cycles to other camera funtions.

MPEG4 - Is better at reducing the bit stream but at a slight cost to quality, also making your bandwidth calculation harder due to the none uniform size of the frames due to block change compression.

H.264 - Reduces the bit stream considerably but at a much greater cost to quality. The reduction in quality is noticeable and is reminiscent of analogue loss on recorded images as compared to live images.

Mxpeg - Is a lower bandwidth option better than MPEG4 but without loss of the quality from Mjpeg seen in H.264

So as you can see it matters which one you use. Here are some recommendations for various situations:

PTZ cameras on continuous patrol - In this situation it would be better for all aspects of the network to use Mjpg as each frame will be a key frame due to the motion of the camera, meaning the camera will not be running complex algorithms on each image only to decide to send the whole image. This also applies to very changeable images.

Live view of images - This is a tricky one but for the sake of bandwidth then MPEG4 would probably be best, very little is lost on transmission in the way of quality and the network load is reduced, with the caveat that the images seen are fairly static.

Limited storage facilities - I hate to say it but H.264 would be your best for reduction of storage needs but this flies in the face of IP surveillance since quality is the greatest gain and H.264 will reduce that. Also remember because of the high compression of this codec multiple streams to a server would mean a very high load on the CPU, to the extent that it causes the processing of images to back up and even drop frames.

I have not mentioned it yet but here goes Mxpeg would be the best overall codec to use in all surveillance situations, but sadly only Mobotix cameras to date use this. So if you can use Mobotix cameras then do so and reap the benefits of Mxpeg. Not to mention the high quality 3Mpx images and extended functionality of the cameras.

In Summary the right codec is dependant on what you are trying to achieve and often circumstance will dictate which codec is the right one to use. We must remember the aim of IP video surveillance is to deliver a high quality usable image that can be used rather than these fuzzy blurred out lines we are used to seeing from analogue systems. So the codec we use should try not to compromise the quality but at the same time not impact on other systems.

The ultimate best codec for surveillance in the perfect world would be Mxpeg but since only Mobotix cameras use it only people with these cameras reap its benefits. Who knows it may even become and industry standard one day and available to the masses.





visit link download