Efficient Video Surveillance: quality-infrastructure balance

2021-10-29
Author
Max Lapshin
CEO of Erlyvideo

Choosing a hardware platform and appropriate bandwidth is inevitable when you are designing your video surveillance system for subscribers or a secured site. Having studied guides on the Internet along with the available calculation tools, you will find out that it is all about video quality. The higher the video quality, the “heavier” the video, i.e. the more disk space is required to store archive for the same period, more CPU capability for video processing and more network bandwidth for video transmission from cameras to the server and from the server to the end users.

Characteristics that depend on quality

Video quality is only defined by the problem you are planning to solve: for example, you probably do not need an ultra-high-quality camera to check what your cat is up to while you are out, but cameras used by police officers to solve crimes have strict and high requirements for quality and robustness.

Many brightest scientists have been struggling to find ways of “lightening” images and video without losing quality, and thanks to them we now have many methods to reduce the resource consumption of a video surveillance system while keeping video quality at about the same level.

Which parameters to take into account?

Video quality and, therefore, network load and disk space generally depend on the following parameters:

Parameters that affect quality

  • Frame resolution and color depth. Frame resolution and colour depth. Resolution is frame width in pixels multiplied by frame height. Colour depth is the number of bits used to define the colour of each pixel (usually 24 bpp in modern cameras, not adjustable). You should multiply these three numbers to calculate the size of one uncompressed frame. As an example, let’s calculate the size (S) of a frame with Full HD resolution, i.e. width (W) of 1920 pixels, height (H) of 1080 pixels in True colour, i.e. colour depth (D) of 24 bits.

    S = W × H × D = 1920 × 1080 × 24 = 49,766,400 bit ≈ 47.46 Мbit/frame

  • Frame rate (fps) is the number of frames the camera sends per second. The more frames the camera sends, the more resources are required to transmit and process them.

    For the above example with a Full HD frame, let’s calculate the required network bandwidth if we do not use compression and transfer frames at the most popular frame rate supported by most cameras of 25 frames per second. To do this, multiply the frame size by the number of frames to find out the amount of information transmitted per second i.e. the camera bitrate.

    To transmit a second of video, we need network bandwidth (BW) of

    BW = S × fps = 47.46 Мbit/frame × 25 frames/sec ≈ 1186.5 Мbit/sec

    That is, you would need more than 1 Gbps channel for transmitting a video stream from just one camera. Such capacities are completely irrational, while the frame resolution must remain high. Therefore, other parameters described below play an important role in modern video surveillance systems.

  • Compression (codec) is an encoding algorithm that reduces the amount of information required for video transmission. Analog (uncompressed) video is transmitted as is, pixel by pixel. Some compressors (like MJPEG) can fold each frame while with others (like H.264) only keyframes are fully transmitted, and the rest of the frames are built on the basis of keyframes. For example, if the camera field of view is about the same with relatively small objects moving in it, then the codec allows transmitting only the changing part of the image and calculating the background based on the previously received information.

    LLet’s take the H.264 codec as an example. The compression ratio is highly dependent on the profile being used; the most effective High Profile provides a compression ratio of up to 2000:1, i.e. 1 Gbps stream can be compressed to 512 Kbps under ideal conditions, e.g., when there is no movement and no small details in the frame. Under normal conditions, a compression ratio of 1000:1 can be considered. Let’s calculate the bitrate from our Full HD camera with a frame rate of 25 fps at a compression rate of qlow act. = 1/2000 and qhigh act. = 1/1000:

    BWlow act. = BW × qlow act. = 1186.5 Мбит/с × 1/2000 ≈ 0.6 Мbit/sec

    BWhigh act. = BW × qhigh act. = 1186.5 Мбит/с × 1/1000 ≈ 1.2 Мbit/sec

  • Scene activity means the presence of moving objects in the frame, for example, people, cars, trees moved by wind, etc. The effect of activity on quality, among other things, is due to the codec used: modern codecs can significantly reduce the video size at low scene activity and consume resources when necessary to transmit information about moving objects.

    Please find below the examples of the same scene with and without activity. There are no moving objects on the left frame and there are people moving on the right one.

    A scene with and without activity

    When calculating resources, you need to roughly estimate the period of time when there will be no movement in the frame. In the example above, the camera captures the office canteen, that is, there will be movement in the frame only during working hours with a margin of several hours before and after to take into account those who like to work in the morning or in the evening, let’s say it’s 11 hours. And it can be assumed that there will be no movement at night, i.e. during the rest of 13 hours a day (unless any abnormal situation occurs).

    Thus, we can calculate the size of the archive per day (3600 seconds in an hour):

    Arch = (11 hrs × 3600 sec/hr × 1.2 Мbit/sec) + (13 hrs × 3600 sec/hr × 0.6 Mbit/sec) = 75,600 Mbit ≈ 9.2 GB

  • Motion-based recording allows you to reduce your disk space requirements. In the above example, if you enable motion recording, you can save about 3.4 GB per day by excluding the second member of the sum.

In total, all these parameters determine the bitrate of the camera. The resource consumption depends on the bitrate of cameras and their number. For example, incoming network load depends on the bitrate and the number of captured cameras while outgoing load depends on the bitrate and the number of cameras viewed by users. The disk space required depends on the bitrate, the number of cameras and the required archive depth. As you can see, by reducing bitrate you can reduce resource consumption.

The bitrate grows proportionally to the resolution, frame rate and scene activity (if VBR, i.e. variable bitrate is used) and inversely to the compression rate. Thus, to some extent, the bitrate can be considered as a measure of quality. But wait, if they are the same, how do we lower the bitrate without losing quality? It is difficult, but possible: since quality is a subjective concept, you can change one or several quality parameters so that the image remains visually acceptable.

On top of it, Watcher provides additional tools that allow you to reduce the network load without adjusting the quality parameters.

How do these parameters affect quality?

So, we figured out how to calculate resource consumption depending on parameters that affect quality. Remember that video quality is usually understood as the subjective perception of the picture on the screen, i.e. how the video looks good or not. The above parameters may affect the video quality, but there is no standard numerical measure to assess the quality. You cannot determine the video quality by only one parameter: quality and resolution are not the same, the compression rate is not the only indicator of quality, etc.

At the camera side you can adjust the quality parameters to suit your conditions (see Camera Remote Setup via ONVIF):

  • Resolution. The higher the resolution, the clearer the picture and the finer details can be seen, but this requires a large bandwidth for video transmission and more disk space for storing the archive. Usually, HD or Full HD resolution is enough for video surveillance. For example, if users are not viewing video on an Ultra HD display, then there is no point in streaming the video in ultra-high definition, as it brings no benefit. Choose the resolution that suits the end-user.

  • Frame rate. The higher the number of frames per second, the smoother the motion in the video looks, but more bandwidth is required for transmission and more disk space for storage. A high frame rate is not always required in video surveillance systems. If there are no fast-moving objects in the field of view of the camera which can pass in a split second, then lowering the frame rate will not affect the quality. 15 fps should be enough for scenes with people, 30 fps or more for scenes with vehicles.

  • Codec. Choose a codec that allows higher compression rate. For example, H.265 will compress video better than H.264 but may limit the video viewing experience in a browser. Also, not all cameras support the H.265 codec, however you can be sure that our Bullet and Dome cameras support H.265. Please refer to Supported codecs for details on H.265 use in Watcher.

  • VBR (variable bitrate) or MBR (maximum bitrate) allow you to take full advantage of modern codecs..

    In VBR mode, the camera bitrate will decrease if there is no activity on the scene. For example, if the camera is installed at the entrance of a residential building, then the bitrate will be low when there are no residents in front of the camera. However, this mode will not give a significant improvement in cases where there is always movement in the camera’s field of view, for example, at a busy road intersection.

    With MBR, you can set the maximum allowable bitrate. However, the quality will decrease if there is a lot of activity in the frame.

At Watcher side you can make certain settings to minimize the load on the network and/or disk space consumption without changing the quality; however, they may impose some additional restrictions on the functionality of your video surveillance system:

  • Disable audio capture. Watcher captures the audio stream by default, if there is one on the camera. Of course, the audio stream does not put a significant load on the network, but there is no harm in disabling it if it is not needed.
  • Disable capture of unused substreams. Watcher captures all streams specified in the camera settings. Make sure that only the required streams are listed there.
  • Enable on-demand capturing. Watcher will not capture the stream if no user requests it, but no camera-related functions will be available when the stream is not captured.
  • To reduce disk space, enable recording of motion detected only.

You can adjust all of the above parameters in the camera settings in Watcher.

Other news

2023-11-23

30% OFF new license subscriptions

The Black Friday discount starts on November 23 and ends on November 30. Don’t Miss Out!
2022-08-03

Bullet vs Dome housings

There is no universally applicable approach to lower the bitrate without losing quality. However, in some cases, the quality parameters can be individually
2022-06-24

Night as bright as day with Flussonic StarVis cameras

The parking lot is illuminated enough to avoid IR illumination. There are no artifacts on the image even though the camera is filming through the glass.
2022-01-31

How to create your own mobile application with video surveillance in a very short time

Have you ever thought of making your existing app able to work with IP cameras or developing a brand new app with video surveillance functions?