ffmpeg with rtsp not working

Forum for questions and support relating to 1.33.x development only.
Post Reply
wootah
Posts: 3
Joined: Thu Jan 03, 2019 9:26 pm

ffmpeg with rtsp not working

Post by wootah » Thu Jan 03, 2019 9:51 pm

Before I had a Zoneminder setup running with Ubuntu 16.04 and some cheap Digoo MQ1 wifi camera's
This seemed to work perfectly, just follow the onvif wizard and the connection was made easy peasy.

Now with Ubuntu 18.04 things are different. Since it was impossible to use the old zoneminder from 16.04 while I installed it, I decided to start using the development branch/ppa. Which I'm still using today.
Unfortunately I'm not able to make to use the camera with ffmpeg
I also tried upgrading ffmpeg to version 4, without any results.
I know ffmpeg works because I can dump a video from my wifi cam like this:

Code: Select all

ffmpeg -i rtsp://admin:password@192.168.1.12:554/onvif1 -vcodec copy -r 60 -y /mnt/usb/video-dump.mp4
which results in a perfect video.

When I make the simple switch to libvlc I can get an image and it works.
Unfortunately libvlc is sensitive to some connection drops, which seems to occur every now and then, they are cheap wifi camera's in the end :D
When the connection drops libvlc doesn't seem to recover (the video will be stuck on the last successful frame) while ffmpeg (at least in my past Ubuntu 16.04 installation) keeps working.

The log, with debugging turned on in the options looks like this:

Code: Select all

2019-01-03 22:47:01.482724 zmc_m2[9819].INF-zm_ffmpeg_camera.cpp/163 [Priming capture from rtsp://admin:password@192.168.1.12:554/onvif1]
2019-01-03 22:46:51.478894 zmc_m2[9819].ERR-zmc.cpp/253 [Failed to prime capture of initial monitor]
2019-01-03 22:46:51.473555 zmc_m2[9819].ERR-zm_ffmpeg_camera.cpp/357 [Unable to open input rtsp://admin:password@192.168.1.12:554/onvif1 due to: Connection timed out]
2019-01-03 22:46:51.466681 zmc_m2[9819].WAR-zm_ffmpeg.cpp/64 [Nonmatching transport in server reply
]
2019-01-03 22:46:51.329016 zmc_m2[9819].INF-zm_ffmpeg_camera.cpp/163 [Priming capture from rtsp://admin:password@192.168.1.12:554/onvif1]
2019-01-03 22:46:47.630470 zmfilter_2[6752].INF-zmfilter.pl [Checking filter Update DiskSpace update disk space returned 0 events ]
2019-01-03 22:46:47.462280 zmfilter_1[6747].INF-zmfilter.pl [Checking filter PurgeWhenFull delete returned 0 events ]
2019-01-03 22:46:41.324426 zmc_m2[9819].ERR-zmc.cpp/253 [Failed to prime capture of initial monitor]
2019-01-03 22:46:41.316620 zmc_m2[9819].ERR-zm_ffmpeg_camera.cpp/357 [Unable to open input rtsp://admin:password@192.168.1.12:554/onvif1 due to: Connection timed out]
2019-01-03 22:46:41.309643 zmc_m2[9819].WAR-zm_ffmpeg.cpp/64 [Nonmatching transport in server reply
]
2019-01-03 22:46:41.170769 zmc_m2[9819].INF-zm_ffmpeg_camera.cpp/163 [Priming capture from rtsp://admin:password@192.168.1.12:554/onvif1]
2019-01-03 22:46:31.165765 zmc_m2[9819].ERR-zmc.cpp/253 [Failed to prime capture of initial monitor]
2019-01-03 22:46:31.158749 zmc_m2[9819].ERR-zm_ffmpeg_camera.cpp/357 [Unable to open input rtsp://admin:password@192.168.1.12:554/onvif1 due to: Connection timed out]
2019-01-03 22:46:31.153525 zmc_m2[9819].WAR-zm_ffmpeg.cpp/64 [Nonmatching transport in server reply
]
2019-01-03 22:46:31.009541 zmc_m2[9819].INF-zm_ffmpeg_camera.cpp/163 [Priming capture from rtsp://admin:password@192.168.1.12:554/onvif1]
2019-01-03 22:46:21.005630 zmc_m2[9819].ERR-zmc.cpp/253 [Failed to prime capture of initial monitor]
2019-01-03 22:46:21.000231 zmc_m2[9819].ERR-zm_ffmpeg_camera.cpp/357 [Unable to open input rtsp://admin:password@192.168.1.12:554/onvif1 due to: Connection timed out]
2019-01-03 22:46:20.993562 zmc_m2[9819].WAR-zm_ffmpeg.cpp/64 [Nonmatching transport in server reply
Any idea how I can solve this situation?
If any other information is required I'd gladly supply it.

User avatar
iconnor
Posts: 830
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: ffmpeg with rtsp not working

Post by iconnor » Thu Jan 03, 2019 11:40 pm

I think the key may be the Nonmatching transport in server reply log.

Try different values for Monitor->Source->Method

wootah
Posts: 3
Joined: Thu Jan 03, 2019 9:26 pm

Re: ffmpeg with rtsp not working

Post by wootah » Fri Jan 04, 2019 11:53 pm

iconnor wrote:
Thu Jan 03, 2019 11:40 pm
I think the key may be the Nonmatching transport in server reply log.

Try different values for Monitor->Source->Method
Strangely enough that seems to work. On my old notes I do have written down that I did use to use TCP.
But when using VLC on my PC I can also see its a UDP stream and not TCP.
I guess libvlc figures that out on his own or simply ignores the method selection.

The setup has been running now for a couple hours without issue.

Relying on the ONVIF setup isn't flawless then though. By default TCP will be selected, but I suppose it should be UDP?
Or is this also camera specific?

I do get a lot of these warnings now btw:

Code: Select all

reference count 1 overflow	zm_ffmpeg.cpp line 64

tr3b0r
Posts: 4
Joined: Sat Dec 03, 2016 1:43 pm

Re: ffmpeg with rtsp not working

Post by tr3b0r » Thu Mar 14, 2019 12:53 pm

Are you sure your camera is always attaching to the network with the same address?

See my posts in this thread viewtopic.php?f=14&t=26663

wootah
Posts: 3
Joined: Thu Jan 03, 2019 9:26 pm

Re: ffmpeg with rtsp not working

Post by wootah » Thu Mar 14, 2019 12:57 pm

tr3b0r wrote:
Thu Mar 14, 2019 12:53 pm
Are you sure your camera is always attaching to the network with the same address?

See my posts in this thread viewtopic.php?f=14&t=26663
Yes, I set a static ip in my DHCP server. Ever since switching to UDP it has been working perfectly without interruptions.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest