0

I have Wireless cameras connected to my WiFi hotspot on my Android device. I already have the IPs of the camera from /proc/net/arp. I am also able to run the video for known rtsp URLs, for testing cameras. But end user can connect to any cameras with their hotspot. So, I need to know the rtsp URL at runtime. For RTSP on android port is always 554 for RTSP. I have su access to the device and am ready to use SOAP as well.

Also, app is running on Android 7.0 and up.

Any help is really appreciated.

sgupta
  • 535
  • 4
  • 8

1 Answers1

1

The steps you must perform are the following:

  1. Discover the device (if you don't know the IP address and the XAddr of the device service)
  2. Get the XAddr of the media service, by invoking GetServices or GetCapabilities on the device service. It may be the same, but there are cameras that don't have a unique XAddr for all the services
  3. Invoke GetProfiles on the media service
  4. Invoke GetStreamingUri on the media service passing the profile that you want.
  5. Request streaming from the URI you got in the previous step.

Additional information

  • On android you probably may want to use ksoap2-android.
  • GetProfiles returns the list of profiles as you can see here. You don't get the streaming URI from GetProfilesResponse, you have to invoke GetStreamURI on the profile for which you want to get the address for RTSP playback.
  • usually XAddr refers to services, URI refers to the addresses for streaming or snapshot
  • knowing the IP address can save you time guessing that the camera has the device service on http://<ip_address>/onvif/device_service , which is the most common entyr point, but I found some devices not following it (different ports, running only https, ooo)

I am not familiar with your cameras, but I'd trust more che Panasonic camera than the chinese one. As you can see here, the camera from Panasonic has a public ONVIF Profile S DoC . Don't trust anything that does not have a valid DoC listed on the ONVIF website.

Ottavio Campana
  • 4,088
  • 5
  • 31
  • 58
  • Thanks for the reply. I am able to do it on Windows. But the problem is on Android. To start with SOAP is not fully supported. I am using Device Discovery to get xAddrs, but when getProfiles, the response doesn't seem to consistent e.g when I tried on panasonic BL-VP104W, there was no port number mentioned in the xAddrs and retrieving port using profiles, gave port 80 (which is default port in android, but should it be 554 for rtsp?)but rtsp URL comes empty string; while on chinese camera (not sure of model) I was able to retrieve RTSP. Confused on how to make it work on Android consistently. – sgupta Apr 24 '17 at 17:39
  • Also, forgot to mention, I have the IP and Mac addresses via/proc/net/arp on Android, can it help somehow to get URL a bit faster? – sgupta Apr 24 '17 at 17:40