← Back to Articles

How to reduce CPU usage while working with rtsp (h264) camera

Read also: Dual Streaming in Xeoma VSS

If you use an h264 (rtsp) camera and would like to reduce CPU usage, you are welcome to try Xeoma’s option to store high resolution video streams directly into archive, without re-decoding the streams.

If you are using h264 (rtsp) camera or cameras, you might well be receiving many Mpix image from your camera and seeing it in the preview window. But as often as not, the priority is not the ability to view cameras real-time but to store high quality into the archive:

How to reduce CPU usage with Xeoma webcam software: High resolution RTSP camera stream, preview window

If the machine is slow or you have many high resolution rtsp cameras, it may cause high CPU usage resulting in image distortions like this:

Tip: you can see a distorted image on preview in Xeoma if the bitrate for preview URL is too high. You can lower it in the camera’s admin page in browser, Xeoma will pick up the changes.

How to reduce CPU usage in Xeoma: Image distortions in h264 camera

In both these cases we recommend to make use of the camera’s dual streaming and try the direct storing into archive without re-decoding. To do that, please go to the camera’s settings in Xeoma. You will see there that the regular URL to work with the camera is given in “Full URL for IP camera” field:

How to reduce CPU usage in Xeoma video surveillance software: Regular URL for RTSP stream

To establish direct saving into archive, paste the URL for hi res RTSP (h264) stream into “Full URL address of the RTSP (h264) video stream…” field. In regular “Full URL address for IP camera” you can specify a jpeg/mjpeg/rtsp URL for lower quality stream (for preview and detectors’ work):

How to reduce CPU usage in Xeoma software: URL for preview and URL for direct storing to the archive

You will see a lower quality picture in preview window.

How to reduce CPU load with Xeoma: Lower quality preview when the preview is not necessary

But you will get maximum quality footage stored into the archive at the same time:

How to reduce CPU load in Xeoma software: Maximum quality footage stored to the archive at the same time

If you don’t know the URL for a stream of lower quality, or simply don’t want to use it (when real-time view is not necessary), you can leave this field blank:

How to reduce CPU load with Xeoma: You can leave the preview URL field empty

You will know that the recording is on and going well by this sign:

This sign in Xeoma webcam shows that saving to the archive goes well

Even without lower quality stream shown in preview, you will get a high quality stream stored to the archive, and CPU load will be significantly lower. Also, you can tick ‘Use H.264/H.265/H.265+ stream (from Archive) in single camera view mode’ in the ‘Universal camera’ module’s settings to see archive URL in single camera view module (i.e. no image on preview, and high quality image in single camera view mode and archive recordings)

How to reduce CPU usage and still get high quality stream saved in the archive

From Xeoma version 19.11.26 there’s an option ‘Decode only keyframes’ available in the ‘Universal camera’ module’s settings.

It is shown when an H264 stream is used in the ‘Full URL address for preview stream from the camera (secondary, low resolution stream (mjpeg recommended))’ field (not available for H.265 (hevc), H.264+, H.265+, MJPEG and MPEG-4).

decode_only_keyframes_en

Check this box to decrease the processor load coming from decoding of compressed H264 streams by decoding only keyframes of the stream. The higher the resolution of the stream used “for preview”, the better this option helps to decrease the processor load. Might result in less smooth (more “jerky”) stream perception – depending on the key frames interval set in camera.
You can choose ‘Auto’ to let Xeoma choose when decreasing of the CPU load is needed (this way decoding will be on when it’s necessary), or ‘Activated’ to always use the decoding, or ‘Disactivated’ to turn it off.

This is how to reduce CPU usage in your video surveillance system while using h264 cameras and still get high quality recordings for forensic purposes or simply later view of events.

Check out our FAQ (Frequently Asked Questions) here.

I setup ‘Decoding only key frames’ in the ‘Universal camera’ module’s settings to reduce CPU load. This helps – reduces the load significantly, but only I’m not sure what effect it has on motion detection. Usually, if you choose ‘Decode only key frames’ option in the ‘Universal camera’ module’s settings, then Xeoma will decode only important “key frames” once in half of a second (or even more often). So Xeoma will not waste time and resources on recovering the rest of the frames (it reduces CPU load). This way detectors might receive fewer frames and there might be fewer attempts in search by motion.

But in general, Xeoma already detects movements no more than three times per second. Therefore, decoding only key frames option shouldn’t affect the quality of detection.


April, 28 2016
Updated: April, 14 2021

Read also:
Dual Streaming in Xeoma VSS
Xeoma User Manual: more about module ‘Universal Camera’ and its settings
Hardware acceleration
Layouts menu (grid, visualization, decoding settings)
Video surveillance minimum system requirements calculator