Configuration for RTMP Stream?

Forum for questions and support relating to the 1.34.x releases only.
Post Reply
dmac
Posts: 7
Joined: Sat Jun 06, 2020 9:48 pm

Configuration for RTMP Stream?

Post by dmac »

I have a few Reolink cameras I am adding to a system running zoneminder v1.34.15 on a Debian sever.

I was having terrible image quality issues ('smearing') and found this post that perfectly described the issue:
viewtopic.php?f=12&t=29143&p=114201&hilit=RTMP#p114201

So I went ahead and added the RTMP URL but have been unable to get it to work. Testing with VLC failed as well so I contacted Reolink support. They provided a firmware update which resolved that issue. So at this point I can access the RTMP stream using VLC with no issues but still no luck with zoneminder. The monitor will not show an image and and input/output error appears in the log with the URL.

To help diagnose the issue I ran a packet sniffer on the server. It quickly became apparent that the traffic was not going to the RTMP port but the RTSP port. I tried both ffmpeg and libvlc, neither work. I also tried adding the port to the URL to no effect. As a side note selecting libvlc gives an error that libvld cannot be started (null) which lead me to believe it was not installed, but I verified that was not the case (it is installed on the system). However it sounds like other have gotten this working with ffmpeg.

As others have gotten RTMP streams working on zoneminder with good results does anyone have advice on what to try next?

Any help is much appreciated!

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

Re: Configuration for RTMP Stream?

Post by iconnor »

Try next? How about posting debug logs? So we can see what is actually happening?
~Rob
Posts: 10
Joined: Fri Jun 05, 2020 7:57 am

Re: Configuration for RTMP Stream?

Post by ~Rob »

RLC-511 and RLC-522 here, both using RTMP on an Ubuntu 20.04 box

Cameras both set up as:
Source Type: Ffmpeg
Source Path: rtmp://[IP Address]/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password=[PASSWORD]
Video Writer: H264 Camera Passthrough
Image Buffer Size (frames): 65

I'm also monitoring the sub-stream for each camera too
dmac
Posts: 7
Joined: Sat Jun 06, 2020 9:48 pm

Re: Configuration for RTMP Stream?

Post by dmac »

Thank you for the response.

This is the URL I am using (it works using VLC so I know the URL is good and the credentials work):
rtmp://192.168.100.17/bcs/channel0_sub.bcs?channel=0&stream=1&user=admin&password=password

The source is ffmpeg, method TCP. Resolution is set correctly for the sub stream. I did change the video writer to H264 (it was disabled).

The log lists the following:
2020-06-08 19:44:09 zmc_m4 1929 INF Priming capture from rtmp://192.168.100.17/bcs/channel0_sub.bcs?channel=0&stream=1&user=admin&password=password zm_ffmpeg_camera.cpp 202
2020-06-08 19:44:09 zmc_m4 1929 ERR Unable to open input rtmp://192.168.100.17/bcs/channel0_sub.bcs?channel=0&stream=1&user=admin&password=password due to: Input/output error zm_ffmpeg_camera.cpp 380
2020-06-08 19:44:09 zmc_m4 1929 ERR Failed to prime capture of initial monitor zmc.cpp 257


Using tcpdump on the zoneminder server this is what I get:
17:49:48.164548 STP 802.1d, Config, Flags [none], bridge-id 8000.bc:ae:c5:eb:2b:3e.8001, length 47
...........+>..........+>......................


Note the port number...

Adding :1935 (the rtmp port) to the URL generates the same behaviour, including hitting the RTSP port as verified with the packet sniffer. This surprised me. I would have thought appending the port number to the IP address would have sent traffic to a different port.

Is there something else I need to change in the configuration? What other information could I provide to aid in the debugging process?

Thanks again!
dmac
Posts: 7
Joined: Sat Jun 06, 2020 9:48 pm

Re: Configuration for RTMP Stream?

Post by dmac »

I am still wrestling with this. Any other suggestions? I can access the URL using VLC which is a good sign, so I tried switching over to VLC lib. Initially I was not having much lunch but after manually installing some dependencies I am getting the following errors in the log:
2020-06-21 21:03:49 web_php 776 ERR Socket /var/run/zm/zms-634435s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/lat ... window-etc for more information. /usr/share/zoneminder/www/includes/functions.php 2177
2020-06-21 21:03:47 zms_m4 1362 ERR Got empty memory map file size 0, is the zmc process for this monitor running? zm_monitor.cpp 578
2020-06-21 21:03:47 zms_m4 1362 ERR Unable to connect to monitor id 4 for streaming zm_stream.cpp 53
2020-06-21 21:03:47 zms_m4 1362 ERR Unable to connect to zmc process for monitor 4
dmac
Posts: 7
Joined: Sat Jun 06, 2020 9:48 pm

Re: Configuration for RTMP Stream?

Post by dmac »

I also tried the suggestion(s) found here:
https://github.com/ZoneMinder/ZoneMinder/issues/811

This includes both forcing TCP and setting a large buffer size. Unfortunately it did not resolve the issue.

Any help would be very much appreciated; I have a lot of these cameras and would hate to see them go to waste.
dmac
Posts: 7
Joined: Sat Jun 06, 2020 9:48 pm

Re: Configuration for RTMP Stream?

Post by dmac »

OK, I turned up the logging. Here is the issue:

Code: Select all

06/29/20 20:15:36.395419 zmc_m4[686].INF-zm_ffmpeg_camera.cpp/202 [Priming capture from rtmp://192.168.100.20/bcs/channel0_sub.bcs?channel=0&stream=1&user=admin&password=password]
06/29/20 20:15:36.429367 zmc_m4[686].DB1-zm_ffmpeg_camera.cpp/365 [Calling avformat_open_input for rtmp://192.168.100.20/bcs/channel0_sub.bcs?channel=0&stream=1&user=admin&password=password]
06/29/20 20:15:36.429577 zmc_m4[686].DB3-zm_ffmpeg.cpp/70 [Opening 'rtmp://192.168.100.20/bcs/channel0_sub.bcs?channel=0&stream=1&user=admin&password=password' for reading]
06/29/20 20:15:36.429626 zmc_m4[686].DB3-zm_ffmpeg.cpp/70 [No default whitelist set]
06/29/20 20:15:36.429670 zmc_m4[686].DB3-zm_ffmpeg.cpp/70 [No default whitelist set]
06/29/20 20:15:36.429702 zmc_m4[686].DB3-zm_ffmpeg.cpp/70 [Original list of addresses:]
06/29/20 20:15:36.429724 zmc_m4[686].DB3-zm_ffmpeg.cpp/70 [Address 192.168.100.20 port 1935]
06/29/20 20:15:36.429740 zmc_m4[686].DB3-zm_ffmpeg.cpp/70 [Interleaved list of addresses:]
06/29/20 20:15:36.429756 zmc_m4[686].DB3-zm_ffmpeg.cpp/70 [Address 192.168.100.20 port 1935]
06/29/20 20:15:36.429773 zmc_m4[686].DB2-zm_ffmpeg.cpp/70 [Starting connection attempt to 192.168.100.20 port 1935]
06/29/20 20:15:36.430697 zmc_m4[686].DB2-zm_ffmpeg.cpp/70 [Successfully connected to 192.168.100.20 port 1935]
06/29/20 20:15:36.430796 zmc_m4[686].DB3-zm_ffmpeg.cpp/70 [Handshaking...]
06/29/20 20:15:36.435133 zmc_m4[686].DB3-zm_ffmpeg.cpp/70 [Type answer 3]
06/29/20 20:15:36.435185 zmc_m4[686].DB3-zm_ffmpeg.cpp/70 [Server version 9.0.124.2]
06/29/20 20:15:36.435306 zmc_m4[686].WAR-zm_ffmpeg.cpp/70 [Server response validating failed]
06/29/20 20:15:36.463047 zmc_m4[686].ERR-zm_ffmpeg_camera.cpp/380 [Unable to open input rtmp://192.168.100.20/bcs/channel0_sub.bcs?channel=0&stream=1&user=admin&password=password due to: Input/output error]
06/29/20 20:15:36.496359 zmc_m4[686].ERR-zmc.cpp/257 [Failed to prime capture of initial monitor]
The other log files do not show any faults that I can see. Note that this URL does work with VLC.

Thanks again!
dmac
Posts: 7
Joined: Sat Jun 06, 2020 9:48 pm

Re: Configuration for RTMP Stream?

Post by dmac »

And one more data point: switching to libvlc over ffmpeg generates the following error:

Code: Select all

06/29/20 20:24:51.121978 zmc_m4[843].INF-zm_libvlc_camera.cpp/160 [Priming capture from rtmp://192.168.100.20/bcs/channel0_sub.bcs?channel=0&stream=1&user=admin&password=password]
06/29/20 20:24:51.168440 zmc_m4[843].DB2-zm_libvlc_camera.cpp/176 [Number of Options: 3]
06/29/20 20:24:51.168492 zmc_m4[843].DB2-zm_libvlc_camera.cpp/180 [set option 0 to '']
06/29/20 20:24:51.168510 zmc_m4[843].DB2-zm_libvlc_camera.cpp/180 [set option 1 to '--rtsp-tcp']
06/29/20 20:24:51.168524 zmc_m4[843].DB2-zm_libvlc_camera.cpp/180 [set option 2 to '--no-audio']
06/29/20 20:24:51.169658 zmc_m4[843].ERR-zm_libvlc_camera.cpp/186 [Unable to create libvlc instance due to: (null)]
06/29/20 20:24:51.201857 zmc_m4[843].ERR-zmc.cpp/257 [Failed to prime capture of initial monitor]
And

Code: Select all

vlc: unknown option or missing mandatory argument `--rtsp-tcp'
Try `vlc --help' for more information.
Post Reply