Sub Stream Guide

  • Views Views: 10,948
  • Last updated Last updated:
  • Sub Stream Guide

    The not-quite-comprehensive guide to using sub streams in Blue Iris.

    Introduction

    Blue Iris is able to take advantage of sub streams to greatly reduce processing requirements starting with version 5.2.7 (May 1, 2020). Substantial improvements have been made since the feature was first introduced, so you should start with the latest version of Blue Iris.

    What is a sub stream?

    A sub stream is a secondary video stream provided by your IP camera. Sub streams are smaller (lower resolution and bit rate) and easier to process than main streams.

    Why use sub streams if they are lower quality?

    Sub streams typically reduce CPU usage by 5x to 20x and make a struggling system run great. The full quality main stream is still recorded and available when you need it.

    When you configure a camera in Blue Iris to use a sub stream, Blue Iris will pull video from both the "main" and "sub" streams. Each stream is used for different purposes.

    The main stream is used for:

    • direct-to-disc recording
    • single-camera live viewing and recording playback
    • audio

    The sub stream is used for everything else:

    • multiple-camera viewing
    • motion detection
    • alert snapshots
    • etc.

    How to configure a sub stream in the camera's web interface

    1. Resolution

      The most important part of configuring a sub stream is to choose a fairly low resolution. A "D1" resolution like 704x480 or 720x576 is available on most cameras and this is recommended for most users. Don't worry about the aspect ratio being wrong; Blue Iris should detect and correct this automatically. Some cameras offer HD sub streams, but using a high-definition sub stream would largely defeat the purpose.

    2. Frame Rate

      The Blue Iris developer has indicated that for best reliability, sub stream frame rate should be equal to the main stream frame rate. Blue Iris's frame pipeline is driven by the sub stream, so a slow sub stream will cause the main stream to be slow as well. Because sub streams are so efficient, it is often okay to ignore past advice about limiting frame rates to 15 FPS. Go as high as you want. Just make sure the main and sub streams have the same frame rate.

    3. I-Frame Interval (keyframe interval or "GOP")

      Blue Iris developer's recommendations:

      • The i-frame interval should be equal to the frame rate (for best responsiveness and stability).
      • The i-frame interval should be not higher than double the frame rate (if improved compression efficiency is required).
      • The main stream and sub stream should have the same frame rate and i-frame interval.

      Blue Iris will still work if you ignore the above recommendations, but you may have more problems. If you wish to tweak the i-frame interval, you should first know these facts:

      • A short i-frame interval on the main stream will help the main stream load faster when you maximize a camera.
      • Shorter i-frame intervals on both streams (main and sub) allow Blue Iris to begin direct-to-disc recording sooner after recording is triggered, so you require less pre-trigger video buffer in Blue Iris camera properties > Record tab.
      • Shorter i-frame intervals yield worse compression (lower quality and/or higher file size). Higher i-frame intervals yield better compression. How much this actually matters is difficult to judge.

      In all cases, I recommend the i-frame interval be between one and four times the frame rate, where the exact value you choose is a balance that suits your individual needs.

    4. H.264+, H.265+, Smart Codec

      Certain advanced video encoding options prevent a short i-frame interval and should not be used with Blue Iris for compatibility reasons. These options are usually called "Smart Codec" or "H.264+" or "H.265+" (note the "+" sign), and they should be disabled.

    How to configure a sub stream in Blue Iris

    First, make sure you have enabled direct-to-disc for the camera, otherwise the sub stream won't be used.

    Important: After you configure the sub stream, you need to reconfigure motion detection.

    Go the the Network IP camera configuration panel and enter the sub stream path and parameters into the Sub stream box as instructed below:

    Dahua cameras

    1. Copy the Main stream text into the Sub stream box.
    2. Type a question mark (?) after the text you pasted in the Sub stream box.
    3. Copy the Params text into the Sub stream box after the question mark.
    4. Change subtype=0 to subtype=1 (or subtype=2 if using the second sub stream on a camera that has multiple).

    Dahua Configuration Screenshot

    Hikvision cameras

    My Hikvision cams don't use a Params section, so I just need to copy the Main stream text and change {CAMNO} to 2.

    Hikvision Configuration Screenshot

    Other cameras

    A similar procedure can be followed for most cameras. You just need to figure out which part tells the camera which stream you want. In some cases, there might not be a number or anything obvious, so you should google for the correct RTSP url format. ispyconnect often has a good list. Ex: "ispyconnect hikvision rtsp URL"

    Reconfigure Motion Detection

    If you use Blue Iris's motion zones, know that the motion zones are stored separately for each video resolution so they must be configured again after you activate the sub stream. When you open the motion zone editor, you will notice the zones have reverted to their defaults, which is for Zone A to be completely filled in with all the other zones empty.

    Other Information

    Recording

    Direct-to-disc must be enabled in order for sub streams to work at all.

    Main streams are shown when you view a recording.

    For timeline playback to work properly, Blue Iris DVR (BVR) file format must be used. It is strongly recommended that you keep enabled "Record dual-streams if available", so that both the main and sub streams are written to BVR files. Recorded sub streams are used during multiple-camera timeline playback in order to keep your CPU usage from ballooning out of control.

    Live Viewing

    When live viewing, the sub stream is used for cameras while they are in a grid view (e.g. "All cameras"). When you "solo" or "maximize" a single camera, Blue Iris will transition to the main stream so you can view with full quality. This causes a temporary increase in CPU / GPU resource consumption. A shorter i-frame interval on the main stream will help the transition happen faster.

    How much CPU savings to expect

    This table lists common IP video stream resolutions and their relative size compared to other resolutions. This is roughly equivalent to the amount of work Blue Iris must do to process a video stream of this resolution (assuming the same frame rate and video codec is used).

    Resolution Compared to 4K Compared to 4 MP Compared to 2 MP Compared to 1 MP Compared to D1 - PAL Compared to D1 - NTSC
    3840x2160 (4K) 100% 203% 400% 900% 2045% 2455%
    2688x1520 (4 MP) 49% 100% 197% 443% 1008% 1209%
    1920x1080 (2 MP) 25% 51% 100% 225% 511% 614%
    1280x720 (1 MP) 11% 23% 44% 100% 227% 273%
    704x576 (D1 Sub Stream - PAL) 5% 10% 20% 44% 100% 120%
    704x480 (D1 Sub Stream - NTSC) 4% 8% 16% 36% 83% 100%

    For example, a D1 resolution sub stream is about 4% or 5% as much work as a 4K main stream. To read it another way, a 2 MP stream is 5 to 6 times as much work as a D1 sub stream.

    Attachments

Top