ip camera Connection not working

10 views (last 30 days)
Konstantin Beckmann
Konstantin Beckmann on 26 Apr 2021
Answered: Chidvi Modala on 9 Jun 2021
I tried to read in two different IP Cams (Ubiquiti UniFi UVC G3 and a virtual camera via OBS Studio) independently.
It works with the VLC player, but not with Matlab. Unfortunately the matlab help could not help me either. I get the error: Cannot connect to the IP Camera Stream URL. Make sure the URL is correct and authentication is provided if needed.
I entered the URL from the interface (stand alone mode) of the camera or from the OBS-Studio into VLC and in VLC the video is displayed. I also checked the codec information from the VLC. Compared to the matlab help I have 2 streams, but the video stream is H264 (see pictures).
Code for connecting to virtual camera:
cam=ipcam('rtsp://localhost:554/live')
Code for connecting to UniFi camera:
cam=ipcam('rtsp://xxx.xxx.xxx.xxx:xxx/s0','user','pw'
What am I doing wrong?
Thanks for your help!

Answers (1)

Chidvi Modala
Chidvi Modala on 9 Jun 2021
Currently there is no support for H264 encoding for IPCam. The video stream has to be encoded in Motion JPEG (mjpeg) format. As the video is encoded in H.264 format (not currently supported by IPCAM), it is throwing an error. I have brought this issue to the notice of the concerned people and it might be considered for a future release.
A possible workaround for this issue is to read the network stream with a third-party application (e.g. VLC Media Player) and transcode it to an MJPEG stream. Then try to open that MJPEG stream in MATLAB.
There is a FileExchange submission that might be useful as well: HebiRobotics/HebiCam. HebiRobotics/HebiCam is one of the several submissions in MATLAB File Exchange on MATLAB Central which is a forum for our product users to interact, exchange information and knowledge, without MathWorks' involvement. You may contact the author of this submission directly for specific questions about the implementation.

Categories

Find more on MATLAB Support Package for IP Cameras in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!