The difference between MJPEG and H264/H264+/H265/H265+, and how to use them in Xeoma
Read also: All methods of reducing CPU load
Canon and Nikon, iPhones and Androids, Macs and PCs – these are just a few of lifelong rivals that are essentially different in some ways (thus each having their own fans) yet oh so similar in their nature. Count in also various camera image streaming formats that fit in into this eternally battling sides.
Xeoma video security solution can work with a variety of cameras of various make, type and image streaming format.
Sometimes the camera stream format does not make any difference to a user – like in USB cameras.
But more often than not a camera’s image streaming format can influence your choice of network cameras and equipment that you will be using for a video security solution. The right format can help you save on processor units, disk arrays, or even simpler than that, the right format can allow the system work in conditions where other formats do not work (e.g. limited network bandwidth or unavailable powerful equipment). Contemporary cameras tend to have compressed formats like H264/H265 as their main streams while cameras that only have MJPEG are almost entirely outdated in the modern world.
If you want to get the best of Xeoma and do the finest configuration in it, this comparison article of the two major representatives of camera image streaming formats – MJPEG and H264/H265/etc.
MJPEG is basically a series of pictures combined into a stream. That’s why parameters like resolution (dimensions of each image within the stream) and fps (frames per second rate that determines how many such pictures will 1 second of video contain) play a greater role in MJPEG stream characteristics.
This is one of the earliest image streaming formats in network cameras thus so simple.
Although there is a slight compression of those pictures that constitute an MJPEG stream, it is so much smaller than that of H264/H265/etc. streams that it can be ignored and an MJPEG stream can be called uncompressed compared to H264 streams.
Advantages of MJPEG streams:
+ Less CPU-intensive (processor doesn’t have to do as much decompressing work on the fly as it does with H264 streams)
+ Simple to use
Disadvantages of MJPEG streams:
– Requires more network bandwidth to get streams into Xeoma as compared to H264/H265 stream with the same settings;
– Requires more disk space to store recordings as compared to H264/H265 stream with the same settings;
– Considered outdated by many makers, so are usually used as an additional stream in a camera at best. High resolution MJPEG streams are frequently to be found only in older IP camera models.
H264 compressed format has emerged as an in improvement of once reigning MJPEG streams as a solution to requirements that using of MJPEG streams has raised. For example, in many systems network capacity is a challenge that even big investments cannot resolve. The industry needed such compressed format, and by its development pace you can tell that it is in great demand.
H264+, H265, H265+ followed, and they all brought basically the same type of improvement: more compression which means you can get more quality with the same bandwidth its predecessor offered (or, if you look at it at another angle, you can have the stream spend less bandwidth to maintain the same quality).
H264’s advantages and disadvantages stem from its compressed properties:
Advantages of H264/H265/H264+/H265+ streams:
+ Requires less network bandwidth to get streams into Xeoma as compared to an MJPEG stream with the same settings;
+ Requires less disk space to store recordings as compared to an MJPEG stream with the same settings;
+ Very wide-spread;
+ Great potential for future development.
Disadvantages of H264/H265/H264+/H265+ streams:
– Much bigger CPU load as compared to MJPEG because processor has to do rapid decompressing work on the fly;
Requires more network bandwidth to get streams into Xeoma as compared to H264/H265 stream with the same settings;
– Many options might be hard to understand.
Visual comparison of MJPEG and H264/H264+/H265/H265+
|Network load||CPU load||Storage space required|
Uncompressed thus requiring more network bandwidth
Uncompressed thus requiring less processor capacity to work with
Uncompressed thus requiring more disk space for storage
Compressed thus requiring less network bandwidth
Compressed thus requiring more processor capacity to work with
Compressed thus requiring less disk space for storage
How to use both MJPEG and H264 to your advantage
Luckily, Xeoma employs special techniques to combine advantages of compressed H264+ streams with MJPEG’s low CPU usage – it is called Xeoma’s direct saving to the archive based on cameras’ dual streaming capability.
Read more about dual streaming here
Read more here on how it should be set up in Xeoma
Formats of recordings in Xeoma
Xeoma video security solution has various ways of saving video footage from cameras. Main ones are the “Preview and Archive” module used by default and providing its own embedded viewer; the “Save To File” module with which you can get recordings of needed length and more formats; the “Email Sending” module can save pieces of video through messages; and the “FTP Upload” can push records to an FTP server of yours.
Format of recordings: .xem (MJPEG) and .mkv (MPEG-4, H264, H265, H264+, etc.) only. Earlier versions of Xeoma had .mp4 for MPEG-4, H264, H264+, etc. instead of .mkv.
Format of recordings: MJPEG, VP8, VP9, MPEG-4, WMV as per your choice*
*if anything other than MJPEG is selected, decoding will be engaged which might give additional CPU load
How do I know what format my camera is streaming in?
The easiest way to check format and stream format and other characteristics for a network (IP) camera is to check that information in the camera web admin page in the Video or network tab. It will look something like this:
If yours is a USB camera Xeoma will get such camera stream in the MJPEG format. That means that recordings will be in .xem (MJPEG) if the Preview and Archive module is used for doing recording, and the ‘direct saving to archive’ feature will be unavailable. If ‘Save to File’ is used, other formats for recordings are available (see above).
For analog cameras the video stream format will depend on how such camera is connected:
– analog cameras connected through capture cards, TV tuners or USB dongles/em> will be seen and working in Xeoma as USB cameras. See above for more on USB camera stream and recordings format
-analog cameras connected through DVR devices can work in Xeoma either in H264/H265+ or MJPEG depending on what the DVR device offers.
You can check the specs for the cameras found in Xeoma in the “Universal Camera” module settings just above the URL fields.
As you can see, each of the two streaming format types does have its pros and cons. H264 and its ancestors are a salvation in VS systems with many cameras yet very limited network bandwidth that simply cannot be extended no matter the cost – while the requirement for powerful processor unit can be easily met with proper funds. Also, many video security solutions are obliged to keep video footage for 30 days minimum, which in systems with thousands of cameras can mean petabytes of storage required. Compressed streams help here a lot, allowing to reduce the storage requirements.
While MJPEG is a simple and wonderful solution in systems where it’s the processor capacity that is critical, not network or disk space.
Choose what’s best for you – Xeoma got you covered in any case!
7 May 2021
Reducing CPU load: full guide