Problem with Foscam 9821 clone RTSP stream

Forum for questions and support relating to the 1.28.x releases only.
Post Reply
clust
Posts: 3
Joined: Wed Aug 19, 2015 12:28 pm

Problem with Foscam 9821 clone RTSP stream

Post by clust » Wed Aug 19, 2015 12:37 pm

I'm trying to add new monitor to Zoneminder v1.28.1 on Debian Jessie using Foscam FI9821W FFMPEG H.264 preset with the following settings:

General tab

Source Type: FFmpeg

---

Source tab

Source Path: rtsp://opticam:password@10.10.x.y:8080/videoMain
Remote Method: RTP/Unicast
Capture Width: 1280
Capture Height: 720

---

Camera is behind OpenVPN tunnel and OpenVPN endpoint has port forwarding from port 8080 to camera's internal IP address' port 88. I have confirmed that this configuration and URL works fine as the stream plays fine with VLC media player on Windows 8.1.

zmc debug log gives the following output:

08/19/15 15:25:30.138711 zmc_m5[31919].DB1-/root/ZoneMinder-1.28.1/src/zm_monitor.cpp/2774 [Loaded monitor 5(Monitor-5), 1 zones]
08/19/15 15:25:30.138905 zmc_m5[31919].INF-/root/ZoneMinder-1.28.1/src/zmc.cpp/195 [Starting Capture]
08/19/15 15:25:30.139098 zmc_m5[31919].INF-/root/ZoneMinder-1.28.1/src/zm_ffmpeg_camera.cpp/98 [Priming capture from rtsp://opticam:password@10.10.x.y:8080/videoMain]
08/19/15 15:25:30.139263 zmc_m5[31919].DB2-/root/ZoneMinder-1.28.1/src/zm_ffmpeg_camera.cpp/215 [OpenFfmpeg called.]
08/19/15 15:25:30.139440 zmc_m5[31919].DB2-/root/ZoneMinder-1.28.1/src/zm_ffmpeg_camera.cpp/237 [Number of Options: 1]
08/19/15 15:25:30.139603 zmc_m5[31919].DB1-/root/ZoneMinder-1.28.1/src/zm_ffmpeg_camera.cpp/254 [Calling avformat_open_input]
08/19/15 15:25:30.864276 zmc_m5[31919].DB1-/root/ZoneMinder-1.28.1/src/zm_ffmpeg_camera.cpp/269 [Opened input]
08/19/15 15:25:30.864325 zmc_m5[31919].DB1-/root/ZoneMinder-1.28.1/src/zm_ffmpeg_camera.cpp/276 [Calling avformat_find_stream_info]
08/19/15 15:25:36.006100 zmc_m5[31919].DB1-/root/ZoneMinder-1.28.1/src/zm_ffmpeg_camera.cpp/281 [Got stream info]
08/19/15 15:25:36.006148 zmc_m5[31919].DB1-/root/ZoneMinder-1.28.1/src/zm_ffmpeg_camera.cpp/300 [Found video stream]
08/19/15 15:25:36.006175 zmc_m5[31919].DB1-/root/ZoneMinder-1.28.1/src/zm_ffmpeg_camera.cpp/308 [Found decoder]
08/19/15 15:25:36.006191 zmc_m5[31919].DB1-/root/ZoneMinder-1.28.1/src/zm_ffmpeg_camera.cpp/315 [Calling avcodec_open2]
08/19/15 15:25:36.007113 zmc_m5[31919].DB1-/root/ZoneMinder-1.28.1/src/zm_ffmpeg_camera.cpp/320 [Opened codec]
08/19/15 15:25:36.007136 zmc_m5[31919].DB1-/root/ZoneMinder-1.28.1/src/zm_ffmpeg_camera.cpp/331 [Allocated frames]
08/19/15 15:25:36.007150 zmc_m5[31919].DB1-/root/ZoneMinder-1.28.1/src/zm_ffmpeg_camera.cpp/338 [Validated imagesize]
08/19/15 15:25:36.007158 zmc_m5[31919].DB1-/root/ZoneMinder-1.28.1/src/zm_ffmpeg_camera.cpp/341 [Calling sws_isSupportedInput]
08/19/15 15:25:36.007174 zmc_m5[31919].FAT-/root/ZoneMinder-1.28.1/src/zm_ffmpeg_camera.cpp/343 [swscale does not support the codec format: ÿÿÿÿ]

--

I tried to Google around what is the meaning of that "swscale does not support the codec format" error message but didn't find anything helpful.

User avatar
knight-of-ni
Posts: 2325
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Problem with Foscam 9821 clone RTSP stream

Post by knight-of-ni » Wed Aug 19, 2015 1:59 pm

08/19/15 15:25:36.007174 zmc_m5[31919].FAT-/root/ZoneMinder-1.28.1/src/zm_ffmpeg_camera.cpp/343 [swscale does not support the codec format: ÿÿÿÿ]
This means the version of ffmpeg or libav on your system does not support the video stream from the camera.
You could try using a source type of libvlc.

You could also try to install a new version of ffmpeg, but that is problematic on Debian because that distro ships with libav.
This is about to change, however. Debian is moving back to ffmpeg, but that will take time.

The 9821 works well on my Redhat-based systems.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/

bbunge
Posts: 2704
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Problem with Foscam 9821 clone RTSP stream

Post by bbunge » Thu Aug 20, 2015 1:28 am

Try turning your camera settings down a bit. Use the second stream, videoSub, and set the resolution to HD mode, VGA (640x360), Bit Rate 512 (or less),frame rate 5, Key frame interval 10. You might also put a ?tcp at the end of your source (.../videoSub?tcp).

ffmpeg should work in Debian 8.1. If I get a chance tomorrow I will set up Jessie box and test it. Can't do an OpenVPN tunnel which might be your problem. Simple port forward might be better.

bbunge
Posts: 2704
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Problem with Foscam 9821 clone RTSP stream

Post by bbunge » Thu Aug 20, 2015 1:27 pm

I can confirm that this procedure to set up ZM under Debian 8.1 works.

http://www.zoneminder.com/wiki/index.ph ... e_Easy_Way

The only thing I did different was to convert the MySQL databases to innodb_file_per_table. I did this before installing ZM.

I then set up my Foscam FI9821W camera and it to works!

Source Type Ffmpeg
Source Path rtsp://user:user@192.168.3.28:88/videoSub
Capture Width 640
Capture Height 360

I did not set up control but I have had control working with this camera.

clust
Posts: 3
Joined: Wed Aug 19, 2015 12:28 pm

Re: Problem with Foscam 9821 clone RTSP stream

Post by clust » Sat Aug 29, 2015 10:39 pm

I still can't get it working. I'm getting the same "swscale does not support the codec format" error message with /videoSub also. Could you check which versions of ffmpeg and libav you have on your test Debian 8.1 installation?

Libvlc doesn't work either:

08/30/15 01:30:22.256860 zmc_m2[28373].INF-/tmp/buildd/zoneminder-1.28.1/src/zmc.cpp/195 [Starting Capture]
08/30/15 01:30:22.286359 zmc_m2[28373].INF-/tmp/buildd/zoneminder-1.28.1/src/zm_libvlc_camera.cpp/145 [Priming capture from rtsp://user:pass@10.10.x.y:8080/videoSub]
08/30/15 01:30:22.426912 zmc_m2[28381].ERR-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/54 [Got signal 11 (Segmentation fault), crashing]
08/30/15 01:30:22.507170 zmc_m2[28381].DB1-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/64 [Signal information: number 11 code 1 errno 0 pid -24 uid -1 status -1]
08/30/15 01:30:22.507370 zmc_m2[28381].ERR-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/77 [Signal address is 0xffffffffffffffe8, from 0x7f3c4fe113e0]
08/30/15 01:30:22.737425 zmc_m2[28381].ERR-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/98 [Backtrace 0: /usr/bin/zmc(_Z14zm_die_handleriP9siginfo_tPv+0x78) [0x7f3c4fe21c18]]
08/30/15 01:30:22.849124 zmc_m2[28381].ERR-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/98 [Backtrace 1: /lib/x86_64-linux-gnu/libpthread.so.0(+0xf8d0) [0x7f3c4f2838d0]]
08/30/15 01:30:22.919755 zmc_m2[28381].ERR-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/98 [Backtrace 2: /usr/bin/zmc(_ZN13Authenticator5resetEv+0x10) [0x7f3c4fe113e0]]
08/30/15 01:30:22.986492 zmc_m2[28381].ERR-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/98 [Backtrace 3: /usr/lib/x86_64-linux-gnu/libliveMedia.so.42(_ZN13AuthenticatoraSERKS_+0x16) [0x7f3c30e7abd6]]
08/30/15 01:30:23.053164 zmc_m2[28381].ERR-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/98 [Backtrace 4: /usr/lib/x86_64-linux-gnu/libliveMedia.so.42(_ZN10RTSPClient18sendOptionsCommandEPFvPS_iPcEP13Authenticator+0x28) [0x7f3c30e50858]]
08/30/15 01:30:23.082913 zmc_m2[28381].ERR-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/98 [Backtrace 5: /usr/lib/vlc/plugins/access/liblive555_plugin.so(+0x71d7) [0x7f3c310c51d7]]
08/30/15 01:30:23.116354 zmc_m2[28381].ERR-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/98 [Backtrace 6: /usr/lib/vlc/plugins/access/liblive555_plugin.so(+0x782b) [0x7f3c310c582b]]
08/30/15 01:30:23.149744 zmc_m2[28381].ERR-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/98 [Backtrace 7: /usr/lib/libvlccore.so.8(+0x8e015) [0x7f3c45195015]]
08/30/15 01:30:23.182795 zmc_m2[28381].ERR-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/98 [Backtrace 8: /usr/lib/libvlccore.so.8(vlc_module_load+0x47e) [0x7f3c451955de]]
08/30/15 01:30:23.216234 zmc_m2[28381].ERR-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/98 [Backtrace 9: /usr/lib/libvlccore.so.8(+0x4303f) [0x7f3c4514a03f]]
08/30/15 01:30:23.249615 zmc_m2[28381].ERR-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/98 [Backtrace 10: /usr/lib/libvlccore.so.8(+0x52e68) [0x7f3c45159e68]]
08/30/15 01:30:23.283030 zmc_m2[28381].ERR-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/98 [Backtrace 11: /usr/lib/libvlccore.so.8(+0x544f3) [0x7f3c4515b4f3]]
08/30/15 01:30:23.315853 zmc_m2[28381].ERR-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/98 [Backtrace 12: /usr/lib/libvlccore.so.8(+0x586a6) [0x7f3c4515f6a6]]
08/30/15 01:30:23.357520 zmc_m2[28381].ERR-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/98 [Backtrace 13: /lib/x86_64-linux-gnu/libpthread.so.0(+0x80a4) [0x7f3c4f27c0a4]]
08/30/15 01:30:23.396817 zmc_m2[28381].ERR-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/98 [Backtrace 14: /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f3c4be0304d]]
08/30/15 01:30:23.445423 zmc_m2[28381].INF-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/105 [Backtrace complete, please execute the following command for more information]
08/30/15 01:30:23.478772 zmc_m2[28381].INF-/tmp/buildd/zoneminder-1.28.1/src/zm_signal.cpp/106 [addr2line -e /usr/bin/zmc 0x7f3c4fe21c18 0x7f3c4f2838d0 0x7f3c4fe113e0 0x7f3c30e7abd6 0x7f3c30e50858 0x7f3c310c51d7 0x7f3c310c582b 0x7f3c45195015 0x7f3c451955de 0x7f3c4514a03f 0x7f3c45159e68 0x7f3c4515b4f3 0x7f3c4515f6a6 0x7f3c4f27c0a4 0x7f3c4be0304d]

---

Remote with source path /cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=user&pwd=pass is working fine but I don't want to use it because of poor FPS.

I don't think that OpenVPN is causing problems because Windows 8.1 with VLC player plays rtsp both /videoMain and /videoSub streams fine over the same VPN connection.

Any other things to try?

bbunge
Posts: 2704
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Problem with Foscam 9821 clone RTSP stream

Post by bbunge » Sun Aug 30, 2015 1:53 am

Don't currently have Debian set up. Switched to Ubuntu to work on the setup for the master branch PPA.

Your resolution at the camera needs to match the resolution set in Zoneminder. Or at least an equivalent WxH ratio. For my videoMain setup the camera is set to HD Mode 720P, Bit Rate 128K, Frame Rate 5, Key Frame 50.
Source Type Ffmpeg
Source Path rtsp://admin:password@192.168.1.??:88/videoMain
Capture Width 640
Capture Height 320

I have never concerned myself with the version of programs, like ffmpeg, installed. To be honest, I have had great success with the packages installed by Zoneminder. Figuring out how to configure Zoneminder has been a challenge at times. Especially as I'm really not a Linux expert or a programming expert. I usually keep a test PC that I have set up with a basic OS (of various flavors) and create an image of each so I can wipe the drive and start over when I hose things up! (I use clonezilla).

Did you look over the how-to in the WIKI under Debian?
http://www.zoneminder.com/wiki/index.ph ... e_Easy_Way

clust
Posts: 3
Joined: Wed Aug 19, 2015 12:28 pm

Re: Problem with Foscam 9821 clone RTSP stream

Post by clust » Sun Aug 30, 2015 10:39 am

Thanks for help, I finally managed to get ffmpeg stream working! I did fresh Debian 8.1 installation and installed ZoneMinder using wiki instructions http://www.zoneminder.com/wiki/index.ph ... e_Easy_Way. It's still unclear why ffmpeg doesn't work on my other Debian 8.1 machine.

Currently I'm having problems with Foscam 9821W controls. It seems that I have to do partial rewrite to FI9821W control perl module (FI9821W_Y2k.pm) to get controls working as they should.

User avatar
asker
Posts: 1411
Joined: Sun Mar 01, 2015 12:12 pm

Re: Problem with Foscam 9821 clone RTSP stream

Post by asker » Sun Aug 30, 2015 11:39 am

Try grabbing the 9831W control module from master and see if that works for your 9821
https://raw.githubusercontent.com/ZoneM ... FI9831W.pm

I only checked and modified the pan part - did not really validate pre-sets etc - it may or may not work. If you'd like you can start with that and fill in what does not work and commit back.
clust wrote:Thanks for help, I finally managed to get ffmpeg stream working! I did fresh Debian 8.1 installation and installed ZoneMinder using wiki instructions http://www.zoneminder.com/wiki/index.ph ... e_Easy_Way. It's still unclear why ffmpeg doesn't work on my other Debian 8.1 machine.

Currently I'm having problems with Foscam 9821W controls. It seems that I have to do partial rewrite to FI9821W control perl module (FI9821W_Y2k.pm) to get controls working as they should.
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

bbunge
Posts: 2704
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Problem with Foscam 9821 clone RTSP stream

Post by bbunge » Mon Aug 31, 2015 12:34 am

Nope, no rewrite needed.

In the Control tab
Control Device your camera admin password
Control Address IP address and port of the camera

There is a possibility that in the Control Device you may need to use user=XXX&pwd=XXX

Also put a 1 in Auto Stop Timeout.

Control Type FoscamFI9821W you may need to go into the Edit list and turn off features the camera does not use.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests