There is no reliable way to scan the network for available RTSP streams. You can still do a big search, given the following:
- To get the best results (as opposed to speed) you will need to search for brute force at available addresses, that is, check the adapter and mask addresses, generate addresses and try one after another in several streams (or asynchronous sockets)
- You will need port 554 and / or user-provided interactively; real devices (which are hundreds of models) can use different ports, even with default settings
- You can assign more likely candidates to the top of the list of IP addresses by doing a network search for real addresses using UPnP, ZeroConf
- If you have specific providers / models, you can also search for specific providers, which usually include sending a UDP broadcast message and listening for a response
OPTIONS The RTSP command should be good enough for the test, you can use the interactive RTSP tool to see how it works. In any case, no guarantees exist, since the devices may require authentication.
You have the best chance with OPTIONS to get back anything meaningful anyway. DESCRIBE may require you to log in, you may need to authenticate even for OPTIONS . However, you have an RTSP answer that assumes something exists there.
Connection to 192.168.0.59:554 using TCP OPTIONS * RTSP/1.0 CSeq: 1 RTSP/1.0 401 Unauthorized CSeq: 1 Date: Tue, Oct 16 2012 22:22:53 GMT WWW-Authenticate: Basic realm="RTSP/RTP stream"
To execute a successful DESCRIBE command and get meaningful results, you need to know the resource URI on the device, which is not always obvious. The best providers (which, obviously, are a minority) flexibly support incoming requests, while others believe that the client is aware of the specifics of the device. For example,
Connection to 192.168.0.59:554 using TCP OPTIONS * RTSP/1.0 CSeq: 1 RTSP/1.0 200 OK CSeq: 1 Date: Tue, Oct 16 2012 22:26:54 GMT Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE DESCRIBE rtsp:
Note that without knowing the magic of ch0_unicast_secondstream , you are not getting any sense from the device.
Roman R.
source share