Besides being a Video Management System, Blue Iris is also a Streaming Server. This allows users to share their camera feeds externally. The best way to understand how to leverage BI's streaming services is via the following use cases.
Webcasting (video streaming) Pipeline
Standard streaming pipeline: IP Cameras -> Media Server -> Endpoint
- IP Cameras
The process starts with a video capture device otherwise known as a IP camera. The camera is dedicated hardware that usually captures 15-30 frames per second.
IP Cameras are high performance computers which is why they are so expensive. Compression algorithms are responsible for shrinking each frame to manageable chunks which can be transported over the internet. H.264 and H.265 are standard compression algorithms supported by Blue Iris.
Packaging involves bundling all the compressed frames into manageable sizes that can be transported over the network. Think of packaging as grouping 1-3s of video frames into one chunk of data that is transported across the network. HLS, MPEG DASH, RTMP and RTSP are all common protocols for video streaming. - Network: Responsible for moving the data from cameras to Blue Iris.
- Blue Iris. Media server + Video Management System
Blue Iris is also a media server. Media servers can take streams in one format, for example RTSP from a camera and convert them to another format, for example, RTMP so that users can, for example, share their camera streams elsewhere such as YouTube. Media servers are responsible for taking video/audio inputs and streaming the content to various endpoints. - Network
- And the final destination is the endpoint playing the video, for example a browser on a laptop, a mobile device, a TV, a gaming device etc.
Source -> Decode -> Encode -> Endpoint
- IP Cameras = Source
- Media server = Decode + Encode
- Endpoint = Endpoint
Web server
Global settings -> Web server tab
Every time a user accesses BI via a remote endpoint (mobile app, web browser), a connection is made between the BI web server and the endpoint.
Global settings -> Web server tab -> Advanced
BI allows for three types of streams from the web server.
Recommendations:
Streaming 0 profile: Leveraged by the UI3 endpoint. I would leave these settings as default.
Streaming 1 profile: LAN. Create a profile that works well in your LAN. Since these endpoints only sit on the LAN, you may want to provide a richer user experience via higher resolution streams.
Streaming 2 profile: WAN. Network bandwidth may be challenging on the WAN so you may want to make stream adjustments, e.g. trade-off resolution (small screen any way) for smooth video.
See mobile apps section below for some streaming recommendations.
Global settings -> Web server tab -> Advanced -> Configure button
H.264 Encoding Settings
- H.264 video encoding
- Hardware acceleration: Usually set to No. Many GPUs do a poor job of HA encoding which leads to streams that cannot be played by media players. Best to leave off.
- Quality: Value from 0 - 100. Lower the value, lower the quality. The marginal difference in quality after a certain point is minimal. For example, 100 does not produce an image that is twice the quality of a 50 setting. In most cases, quality = 50 is plenty good.
- Rate control: If selected, you are choosing a Constant Bit Rate (CBR). Choose if you have bandwidth concerns.
If unchecked, you are using a Variable Bit Rate (VBR). - Frame type layout
Maximum keyframe interval (GOP): 300
Maximum B-frames between P-frames: 0 (only applies to Main profiles or above) - Profiles: H.264 provides features that are encapsulated in profiles.
Baseline restricts the encoder to certain basic features only. Baseline can easily be played back on most devices. Main and High add features on top of Baseline. Baseline profiles were widely used for mobile devices. However, now more and more mobile devices support Main or High profiles.
Main: B frames (above) are only allowed in the Main profile or above. They can be used to save on bandwidth but harder to decode. Widely used for web streaming.
High profile is often used in broadcasting. Used on high definition TVs. Also adopted by the Blu-ray disc storage format. - Presets: Presets are a collection of options that will provide a certain encoding speed to compression ratio. A slower preset will provide better compression. This means that, for example, if you target a certain file size or constant bit rate, you will achieve better quality with a slower preset. Similarly, for constant quality encoding, you will simply save bitrate by choosing a slower preset.
- Audio: AAC or MP3
- Bitrate (kbps): 192
BI support M-JPEG, H.264 and other formats. The Http interface -> Direct image and video requests section in the Help file has details.
UI3 web endpoint
This is one of the most common ways to access cameras remotely from a web browser (laptop) or mobile browser (phone).
Hit the Help button from Global settings -> Web server tab for details.
The Blue Iris Web Interface webinar walks through the user interface and all its features/functionality.
See Web Interface (UI3) gotchas article for learnings from past tickets.
Large screen TVs
Many users are using TVs to display their cameras. Since these devices are usually on the LAN, they want to take advantage of their high resolution screens with high resolution video streams, since they know their network can handle the load.
With UI3, it is easy to experiment with higher and higher resolutions to determine what works best with your monitor. Simply choose different resolutions by using the gear icon in the lower right corner.
One final comment. If you have a monitor or TV that does NOT have internet connectivity a popular solution is to purchase an Amazon Firestick and run UI3 from there to the monitor. Firestick + Silk browser + UI3 interface is the goto solution for many resellers when trying to display the cameras on a TV or monitor.
The streams used by the mobile apps are set in Camera settings -> Web server tab -> Advanced page. See Web server streams section above for details. The default resolution for Streaming 0 is 720p.
If the request from the app (720p default) is <= the sub stream resolution, the sub stream is streamed. Below are LAN/WAN suggestions that generally deliver smooth video based on higher/lower network bandwidth.
LAN / WAN streaming profiles
What's great about BI is it allows the ability to assign different streaming profiles for the LAN / WAN. A common convention is to assign Profile 1 for LAN connections and Profile 2 for WAN connections.
Video Pipeline: Camera video / feed -> Decode -> Encode -> Endpoint (high resolution tablet / low resolution phone)
A tablet with a bigger screen and always connected to the LAN may have value in a higher resolution stream. Being on the LAN, the network considerations are usually not as stringent either.
However, a WAN profile may entail a lower resolution stream. Most WAN profiles are used by mobile phones with small screens. Why unnecessarily send a stream with a high resolution that provides no additional value on a phone screen and also adds unnecessary load to the network and perhaps results in choppy video.
LAN settings
As stated above, according to our convention, LAN settings would be assigned to Streaming Profile 1
To get high resolution, smooth video, try the following settings for one of your web server video streams.
- Use variable bit rate instead of constant bit rate. Unselect Rate control. Crank up Quality value. Gotcha: If network bandwidth too high, adjust.
- Profile = high Uses more bells and whistles such as b-frames to optimize bandwidth while delivering quality. Gotcha: If endpoint cannot decode, adjust.
- Preset = veryfast. Set to lowest to maximize quality. Gotcha: If CPU utilization is high adjust.
- Uncheck Resize output frame. Send the full camera resolution to the device. Gotcha: If network bandwidth spikes, adjust. If the player at the endpoint starts to choke, adjust
- b-frames are great for increasing quality and optimizing bandwidth. Gotcha: However, if you have a PTZ camera, b-frames can cause delays displaying the new view after a camera position changes.
Don't forget to choose the appropriate stream for the mobile app. Below is a reminder on how to do so.
Home tab -> Gear icon -> LAN. Profile 1 is the LAN stream.
WAN settings
The below settings generally provide a good user experience on mobile phones connected to the WAN (cellular network).
Differences between WAN vs LAN:
- Switch from variable bit rate to constant bit rate to reduce network load.
- Changed profile to superfast. Trade quality for lower CPU load and processing time.
- Resize frame. Reduce resolution since stream is going to a small screen any way.
Because BI is also a media server (RTSP server), you have the flexibility to pull video from one BI server to another.
Use case: Enterprises with large deployments may have multiple servers because they have >64 cameras. However, they may want to pull video from one server to another. Why? Because suppose five cameras belong to a user group and 3 cameras reside on Server A and the other two reside on Server B. In order to display all 5 cameras to the users belonging to this group, admins will pull the two cameras from Server B to Server A. The admin can then create a camera group for the corresponding user group, thus providing one pane of glass for all the cameras belonging to the group.
In order to pull a camera from one server to another, first confirm Webcasting is enabled for the camera.
Attain the following information for the remote server:
I was testing locally so IP address was 127.0.0.1. My web server is running on port 7000.
Embed video in your website
Use case: Enterprises with large deployments may have multiple servers because they have >64 cameras. However, they may want to pull video from one server to another. Why? Because suppose five cameras belong to a user group and 3 cameras reside on Server A and the other two reside on Server B. In order to display all 5 cameras to the users belonging to this group, admins will pull the two cameras from Server B to Server A. The admin can then create a camera group for the corresponding user group, thus providing one pane of glass for all the cameras belonging to the group.
In order to pull a camera from one server to another, first confirm Webcasting is enabled for the camera.
Attain the following information for the remote server:
- IP / Port of the web server
- Username / password for a user that has access to the camera.
- Pull camera or group stream
rtsp://ip:port/cam1 (camera)
rtsp://ip:port/groupname (group)
I was testing locally so IP address was 127.0.0.1. My web server is running on port 7000.
Many users like to share a camera on their website. Below are two code snippets showing how to do so.
Change url to meet your environment
<img src> tag
livestream.htm is a web page that loads a video player and feeds it an HLS stream from Blue Iris. This is the best thing to embed in an iframe if you want minimal user interface functionality. This method adds several seconds of video delay though, making it not ideal for all use cases.
The page source of livestream.htm includes the usage details. It takes different URL parameters than UI3.
livestream.htm supported URL parameters:
1. Authentication must be dealt with, either by enabling anonymous access or by turning off secure login and embedding credentials in the URL.
2. If the web site is hosted with HTTPS, the link to embed a video stream must also use HTTPS which will mean setting up stunnel or a similar secure proxy in front of Blue Iris.
Embed video in your website via RTSP.Live site
YouTube - Streaming
Change url to meet your environment
- server is a placeholder for the ip address or hostname of your BI server
- The web server listens on port 81 by default. Use the port you specified if different from 81.
- ADF_Cameras is a placeholder for the camera name or camera group name in your server.
Code: Select all
<iframe src="http://server:81/livestream.htm?cam=ADF_Cameras&audio=0" allowfullscreen="true" width="640" height="360" />
Code: Select all
<img src="http://server:81/mjpg/ADF_Cameras/video.mjpg?q=50&w=640" style="width: 640px; height: 360px" />
The page source of livestream.htm includes the usage details. It takes different URL parameters than UI3.
livestream.htm supported URL parameters:
- cam=short: Select camera or group with [short] name
- autoplay=0: Disables autoplay.
- audio=1: Unmute at startup. Also disables autoplay.
- mode=2: Hide video player controls
- mode=3: Use browser's standard video player controls
1. Authentication must be dealt with, either by enabling anonymous access or by turning off secure login and embedding credentials in the URL.
2. If the web site is hosted with HTTPS, the link to embed a video stream must also use HTTPS which will mean setting up stunnel or a similar secure proxy in front of Blue Iris.
Use case: Pushing Blue Iris live camera stream(s) to YouTube's media server via RTMP.
YouTube provides URLs to connect to 3rd party software such as Blue Iris.
BI setup is just as simple. Camera settings -> Webcast tab.
You do need to supply the correct stream settings that will work with YouTube.
- Audio: Set to AAC. 128 kbps
- Max bitrate (kbps): 2048. YouTube prefers 9500 kbps so go higher if network can support bandwidth.
- Maximum keyframe interval (GOP): 60
- Profile: main
- Preset: superfast
- Zero frame latency: Unchecked
- Resize output frame width x height: Checked. 1280 x 720. YouTube prefers 2560 x 1440 (double 1280 x 720) so go higher if network can support bandwidth and camera has the resolution. No point increasing the resolution if your camera is 1 MP (1280 x 720).
Pro tip 1: Leverage UI3 to help set optimal encoding settings on your mobile device
Global settings -> Web server tab -> Advanced tab
Encoder profiles: <streaming profile> Configure button.
The encoder dialog box is a bit daunting. What are good values for all those settings?
If like most, you are not well versed on encoder settings, use the UI3 interface for help!
The issue here is if you bring up a browser on your phone and go to the BI web interface, playback and live view work fine. When doing the same through the app, the streaming is choppy, jittery etc.
- Test 1: Need to make sure live stream and playback are first smooth on the BI Server. Garbage in = Garbage out.
- Test 2: If you open a browser on the phone/tablet and go to the BI web interface (UI3), are the live view and playback a good experience. If so, then you know the problem is not with the network.
Below are the changes from the default settings:
- First, I turned on Constant Bit Rate (CBR). This settings caps the amount of data going to the player at 1024 kbps.
- Next, I reduced the resolution to 856 x 480. You are streaming to a mobile device, so reducing the resolution will probably have no affect on your viewing experience. I played with "Retain aspect ratio within frame". On iOS devices, the setting seemed fine. But I noticed instability and crashes on some Android devices. It does not really change/help the user experience, so my conclusion was to just leave it off unless required for another reason.
- Finally, I set Hardware encode = No. The hardware encoding often will not play on mobile players. Best to encode using BI software.
So how did I choose the values for the bit rate and resolution?
I cheated and used the expertise of the BI development team! If you click on the gear icon in UI3 (lower right), you can select any predefined resolution and hit the pencil button up top. You then see the encoding settings for the selected resolution. I just copied those values into the encoder dialog on the console.
Once I made the stream adjustments, I went to the mobile app settings and chose the appropriate settings for my LAN and WAN connections.