Subscriber Discussion

Very Confused About ONVIF / RTSP

UI
Undisclosed Integrator #1
Jan 12, 2017

I'm a bit confused, and I'm sorry if this sounds silly. I just need clarification on this.

When you connect a camera to a VMS, let's say Milestone, how do you know if it's connecting to the camera via HTTP, RTSP, or ONVIF? You don't specify, you just enter the credentials and it automatically connects. But with what method?

Let's say you want to connect a camera to Milestone with RTSP (I'm not sure why you would, but I guess I'm just trying to understand better) -- Would you be able to? Would you be able to stream it to Milestone, plus another RTSP stream somewher else?

Avatar
Josh Hendricks
Jan 12, 2017
Milestone Systems

I am a backline support manager for Milestone

Great question! You've listed a handful of interdependent technologies. So I'll start with the "least common denominator" - RTSP.

RTSP stands for Real Time Steaming Protocol and it's a widely recognized standard for streaming (audio/video). Related terms include RTP and RTCP or real time transport protocol and RTP control protocol. These all have to do with how to negotiate connections for, and streaming real-time data like audio and video. This is almost always how the camera streams are transported, regardless of whether you're using an ONVIF driver, universal driver, or a dedicated device driver.

ONVIF is a body of standards for hardware and software to use to communicate with each other. It's essentially a set of rules for how software should query devices for their names, settings, streams etc. There are ONVIF "calls" or messages which can be sent to a ONVIF compliant device and the device should return the RTSP address to retrieve the video via RTSP. Events, edge storage and PTZ are also handled with messages described in the ONVIF protocols.

Finally, most of this is built on the HTTP/S protocol which again defines a set of rules for communication. For example, if I want"index.html' I send "GET /index.html" along with some header information. The ONVIF protocol is built on the SOAP/xml communication standard which uses HTTP as a platform for sending the xml-formatted SOAP messages.

Streaming can be done via RTSP over either the TCP or UDP protocols, or sometimes it is helpful to stream RTSP tunneled through HTTP which can be helpful when port 554 cannot be reached on the camera for example.

When you add a camera and choose to autodetect the device type, Milestone software will start with upnp to try to identify the device. Depending on the response, we might use a dedicated device driver, or we might use the ONVIF driver. If there's no upnp response, we will start trying EVERY driver we've written against the device until we find a match. There's more to it than that, but that's the process in a nutshell.

If the device is not ONVIF compliant and we haven't written a driver for it yet, there's a chance you can manually add the device using the universal driver. This must always be done manually, and you must know or find out what the RTSP stream address or URI is. After telling the software where the stream is (ex. RTSP://192.168.1.100/h264/stream1) we can then simply ask for it and we will hopefully be able to receive and parse it.

(5)
(12)
U
Undisclosed #2
Jan 12, 2017
IPVMU Certified

If there's no upnp response, we will start trying EVERY driver we've written against the device until we find a match.

Yes, I love that you do that ;)

(2)
Avatar
Josh Hendricks
Jan 12, 2017
Milestone Systems

Wow, that is a powerful few lines of bash(?), thanks for the geek out!

UI
Undisclosed Integrator #1
Jan 12, 2017

This was a perfect explanation. Thank you Joshua!!

(1)
MT
Matt Transue
Jan 12, 2017

To add to Joshua's excellent explanation here, you had a comment about multiple streams, or streaming to multiple places.

This is almost always a function of the camera, not VMS or software related.

Meaning, the camera itself will or will not have the ability to send more than one stream. This is typically referred to as multistreaming.

A few years ago it wasn't as common to have a camera that supported more than one or two streams.  Each individual stream takes up resources from the camera.  Many cameras didn't have enough 'guts' to push multiple streams.  Today, however, I think it would be very difficult to find a camera that doesn't support at least 3 independent streams, likely many more than that (6, 10, 12 streams). Since more processing is easier and cheaper to put into a smaller package, cameras can do more within themselves.

Anyway, don't want to get too far off track, but it is very easy (and common) to have multiple streams going to multiple places.

Think high-res stream for storage and low-res stream for mobile.

(1)
UM
Undisclosed Manufacturer #3
Jan 12, 2017

I believe a certain brand of camera will try to lock to the protocol that first discovers the camera.  This can cause issues with multi-streaming to 2 separate systems.

 

If I recall correctly, if you connect via the native API, such as to the VMS, it disables ONVIF.  If you then need to connect via ONVIF to a mobile app, etc. that is not part of the VMS, it is locked out...

Also, some brands need to have ONVIF enabled in the menu or enabled for user accounts.

Other brands have ONVIF as their core - same users/passwords, streams/profiles, etc. Thus, even if the camera datasheet states that it can support multi streaming, you need to ensure the VMS can, and that the camera can support the various resolution combination needed and the protocol/streaming methods needed.

Pretty strange for a company that helped found ONVIF.

UI
Undisclosed Integrator #1
Jan 12, 2017

So that sparks another question that maybe you can address.

When you pull a RTSP stream, let's say it utilizes 5Mbps -- Every time that RTSP stream is pulled, you utilize another 5Mbps. 

I've seen on this forums that you can redistribute the RTSP stream so that the camera is not multiplying bandwidth everytime a new user accesses the stream. How does that work? If the VMS distributes it lets say 5 times, how is it not 40Mbps being transmitted? 

Avatar
Josh Hendricks
Jan 12, 2017
Milestone Systems

Now you're touching on something called multicast. Typical network connections are unicast, and are "private" connections between two nodes. In this case between camera and server for example. If you make three separate connections to a camera, and each "client" connecting to the camera is pulling "stream0" which happens to be a 5Mbps h.264 stream, then there is going to be 15Mbps of data streaming out of the camera into the switch.

The concept of multicast is this: If you have many clients on the network all viewing exactly the same video as is usually the case with realtime data like audio/video, then it doesn't make a lot of sense to multiply that 5Mbps - especially if there are 10 clients all viewing the same video. You would quickly saturate the network when you have dozens or hundreds of cameras or more.

With multicast, the underlying network technology is IGMP or Internet Group Management Protocol. What IGMP allows the camera to do is broadcast it's availability to the network. All the IGMP-enabled routers/switches will "hear" this. At this point, there is no data streaming out of the camera.

When a multicast client wishes to "subscribe" to this video stream, they will attempt to make a connection to the multicast address. Multicast IP addresses are always somewhere in the range of 224.0.0.0 to 239.255.255.255. Now that there is a subscriber, the camera will start broadcasting the video stream, and the network will take care of getting that video stream out to the client.

As more clients subscribe, the switches make sure the stream gets to the client without duplicating the stream. So there is only ever one copy coming out of the camera. IGMP-enabled switches are also smart enough that if the camera is connected to a switch, and that switch is connected to another switch where 10 clients are connected, there will still only be one copy of that 5Mbps stream going between the two switches.

Whether or not you should use multicast depends a lot on the architecture of the VMS you're using, how you're using the system, and the network itself. For example, with Milestone, the only thing to "touch" the cameras is the Recording Server. So unless you have multiple recording servers or you have other applications talking to the cameras directly, there is little to no reason to multicast between the camera and server. But with Genetec, it is common for the client workstations to talk directly to the cameras, so it makes sense to multicast in that situation.

If you have multiple client workstations viewing the same cameras with Milestone and you're using XProtect Expert or XProtect Corporate, then you can multicast between the Recording Server and the clients. In that case, there is a single unicast stream from the camera to the Recording Server, and a single multicast stream from the Recording Server to multiple live clients.

Finally, it is very important that the network equipment supports multicast/igmp. If you're running "dumb" switches with no IGMP support, then the video stream(s) will effectively be "broadcasted" meaning the stream(s) will be sent out of all ports on the switch which can quickly kill network performance.

(1)
(2)
UI
Undisclosed Integrator #1
Jan 12, 2017

But with Genetec, it is common for the client workstations to talk directly to the cameras, so it makes sense to multicast in that situation.

 

How does Genetec differ from Milestone in this case? 

If in Genetec, the live view clients are pulling data from the camera directly, vs Milestone Smart Clients pulling it from the recording server, isn't it essentially the same amount of data that's being pushed out? 

I.e. 3 streams are being pulled directly from the cameras in Genetec, and 3 streams are being sent from Milestone recording server to the Milestone Smart Clients.

Why would users not opt to Multicast Milestone at that point as well?

 

Thanks Joshua!

U
Undisclosed #2
Jan 12, 2017
IPVMU Certified

If in Genetec, the live view clients are pulling data from the camera directly, vs Milestone Smart Clients pulling it from the recording server, isn't it essentially the same amount of data that's being pushed out?

By the cameras, yes.  

But on the network, no, since Milestone is taking each of the 3 unicast camera streams and then broadcasting those to the clients on 3 multicast streams.  So a total of 6 streams vs 3 for Genetec.

Avatar
Josh Hendricks
Jan 12, 2017
Milestone Systems

If your network design allows for the clients being on the same network as the cameras, or at least routing multicast traffic between the client and camera networks, then with Genetec if you had 3 cameras, there would only be three streams on the network regardless of the number of clients and Archivers.

With Milestone and an identical network, you would have three camera streams going to the Recording Server, and then you could multicast those live streams from the Recording Server to any number of clients for a total of 6 streams on the network as explained by U2.

On smaller systems it doesn't usually make a big difference whether or not you use multicast. In fact, even many large Milestone customers never use it. In some cases it would certainly reduce bandwidth on the network, but in most cases there is plenty of bandwidth on the switch backplane(s) that there would be little if any noticeable difference in network performance.

Where multicast really shines is when you need to push the same stream(s) to a lot of clients over a single "narrow" path. Let's say for example you have a site to site WAN connection with a lot of cameras on one end and a lot of clients on the other. Using multicast you only have to send one stream per camera across that link which might only be 100Mbps or 1Gbps for example.

Mid-large sized Milestone customers will also often isolate cameras and other security devices on a private network which is inaccessible from the business network. They then use either unicast or multicast from the Recording Server out to the clients. I am not well-versed on other VMS's including Genetec but I believe they can also adapt to a "Milestone-like" topology by effectively using a component of their software to retransmit video such that you can isolate the camera network from the business network in a similar manner.

(1)
UI
Undisclosed Integrator #1
Jan 12, 2017

Ok -- This all makes sense now. So does that mean that Milestone ONVIF Bridge is multicasting the RTSP streams?

Avatar
Josh Hendricks
Jan 13, 2017
Milestone Systems

I'll have to check up on our own manuals but offhand I don't think ONVIF Bridge supports multicast just yet. But yes, it allows you to access video streams from Milestone using a standardized RTSP stream URI for every camera regardless of make/model/resolution/etc.

Using ONVIF bridge, you can either access the RTSP stream directly, or you can utilize an external ONVIF application to connect to Milestone as if it is one big ONVIF encoder for example. Again, the ONVIF Bridge allows you to query Milestone using a standard set of messages in order to eventually discover the RTSP stream URL at which point you would use RTP/RTCP to establish a connection and receive the RTSP stream. As an alternative, you could access the raw RTSP stream URL's directly and entirely bypass the ONVIF functionality.

I should also note that while ONVIF Bridge implements some of the ONVIF commands, it does not implement all, or enough of the ONVIF protocol to be considered ONVIF compliant. For example, you can't yet use ONVIF Bridge to change the resolution or do other more complex operations. But it implements enough of the ONVIF protocol that a Milestone system can be added to some other VMS's as an "onvif camera". IPVM did some testing on it in 2016 and some improvements were made since then which may or may not have improved it's compatibility.

New discussion

Ask questions and get answers to your physical security questions from IPVM team members and fellow subscribers.

Newest discussions