Main Content

Find IP Camera URL

You need the URL of the camera to create the ipcam object. The URL must be over the HTTP or RTSP stream for a Motion JPEG (mjpeg) camera, and over the RTSP stream for a H.264 camera.

The URL is made up of the IP address of the camera, followed by a resource designation, such as video.mjpeg or mjpg.cgi, as defined by the camera vendor. For example:

cam = ipcam('http://172.28.17.104/video/mjpg.cgi')

If you do not know the URL to use for the camera:

  • Try the camera utility or the camera web interface. Either may list the URL.

  • Search the Internet for your camera model.

  • You can use a browser, such as Mozilla® Firefox®. For example, in Firefox, go to your camera’s web interface. Right-click inside the browser and select View Image Information. The URL is listed.

  • MathWorks® technical support is unable to find the URL. Refer to the camera documentation, or call the vendor. Only the manufacturer can supply the camera URL.

If the URL is not working in MATLAB®, verify the URL that the camera is using by looking at it in a browser, as described in the last tip, or by looking at it in VLC media player (an open source cross-platform multimedia player).

The following table lists some popular IP camera models and their URLs. The URLS show the video file designations, and you can substitute the IP address of your camera in place of <IP address:port>.

VendorModel NumberURL
FoscamFI9821W V2http://<IP address:port>/cgi-bin/CGIStream.cgi?cmd=GetMJStream
DlinkDCS-2132L
  • http://<IP address:port>/video1.mjpg

  • rtsp://<IP address:port>/live3.sdp

TrendnetTV-IP572WIhttp://<IP address:port>/video/mjpg.cgi
VivotekIB8168
  • http://<IP address:port>/video.mjpg

  • rtsp://<IP address:port>/live3.sdp

Axis0519-004http://<IP address:port>/mjpg/video.mjpg
SonySNC-CH110http://<IP address:port>/mjpeg
Hikvision DS-2CD1240-lrtsp://<IP address>/Streaming/Channels/101
CP PlusCP-UNC-TA21PL3-V3
  • For MJPG - rtsp://IP address/cam/realmonitor?channel=1&subtype=1

  • For H.264 - rtsp://IP address/cam/realmonitor?channel=1&subtype=0

Tips for Finding the Stream Codec for RTSP

To use an IP Camera over the RTSP stream, the stream codec must either be Motion JPEG or H.264 in order to be recognized in MATLAB. Use the VLC media player to check the codec type.

  1. Open VLC media player.

  2. In VLC, select Media > Open Network Stream.

  3. Select Tools > Codec to open the Current Media Information dialog box.

  4. On the Codec tab, check the Codec field to verify whether it is using Motion JPEG. The example shown here is using Motion JPEG.

    An example using H.264

  5. If your camera is not using Motion JPEG or H.264, use the camera’s web interface to change the codec to Motion JPEG or H.264.

See Also