View unanswered posts | View active topics It is currently Thu Oct 02, 2014 9:25 am



Reply to topic  [ 13 posts ] 
Zoneminder and FFMPEG RTSP authentication error 
Author Message

Joined: Mon Mar 16, 2009 5:38 am
Posts: 6
Post Zoneminder and FFMPEG RTSP authentication error
Hi everyone,

I'm working on getting Zoneminder working in RTSP mode with a Sanyo HD4000 IP camera. My problems currently stem from a bad RTSP implementation in the Sanyo camera. I'm working with a contact there to try and get it fixed, but in the meantime, I'd like to work around the issue if I can.

I'm running on Ubuntu 8.10, and I've compiled the latest SVN versions of FFMPEG and ZM as per the excellent Ubuntu 8.10 Vanilla 32bit (with FFmpeg SVN, ZoneMinder SVN, jscalendar-1.0, cambozola-0.7) guide in the wiki.

Since installing it, I've patched FFMPEG to not send a format string to the camera that breaks the implementation. Since getting that working, ffmpeg will play from the camera correctly, and save into a file.

However, when I capture the packets, I can see that the standalone ffmpeg tool tries the DESCRIBE method, has it rejected as 401 - Authorization Required and then goes straight on to the OPTIONS method, with authorization. A wireshark example is included here:
----------------
No. Time Source Destination Protocol Info
781574 17403.549081 192.168.10.85 192.168.10.89 RTSP DESCRIBE rtsp://admin:admin@192.168.10.89:554/Vi ... t/1/h264/1 RTSP/1.0

Frame 781574 (166 bytes on wire, 166 bytes captured)
Ethernet II, Src: AsustekC_6e:0a:26 (00:22:15:6e:0a:26), Dst: SanyoEle_88:1e:6c (08:00:7b:88:1e:6c)
Internet Protocol, Src: 192.168.10.85 (192.168.10.85), Dst: 192.168.10.89 (192.168.10.89)
Transmission Control Protocol, Src Port: 47560 (47560), Dst Port: rtsp (554), Seq: 1, Ack: 1, Len: 112
Real Time Streaming Protocol
Request: DESCRIBE rtsp://admin:admin@192.168.10.89:554/Vi ... t/1/h264/1 RTSP/1.0\r\n
Method: DESCRIBE
URL: rtsp://admin:admin@192.168.10.89:554/Vi ... t/1/h264/1
Accept: application/sdp\r\n
CSeq: 1\r\n
\r\n

No. Time Source Destination Protocol Info
781576 17403.563115 192.168.10.89 192.168.10.85 RTSP Reply: RTSP/1.0 401 Unauthorized

Frame 781576 (142 bytes on wire, 142 bytes captured)
Ethernet II, Src: SanyoEle_88:1e:6c (08:00:7b:88:1e:6c), Dst: AsustekC_6e:0a:26 (00:22:15:6e:0a:26)
Internet Protocol, Src: 192.168.10.89 (192.168.10.89), Dst: 192.168.10.85 (192.168.10.85)
Transmission Control Protocol, Src Port: rtsp (554), Dst Port: 47560 (47560), Seq: 1, Ack: 113, Len: 88
Real Time Streaming Protocol
Response: RTSP/1.0 401 Unauthorized\r\n
Status: 401
CSeq: 1\r\n
WWW-Authenticate: Basic realm="You need RTSP ID"\r\n
\r\n

No. Time Source Destination Protocol Info
781672 17438.595209 192.168.10.85 192.168.10.89 RTSP OPTIONS rtsp://admin:admin@192.168.10.89:554/Vi ... t/1/h264/1 RTSP/1.0

Frame 781672 (179 bytes on wire, 179 bytes captured)
Ethernet II, Src: AsustekC_6e:0a:26 (00:22:15:6e:0a:26), Dst: SanyoEle_88:1e:6c (08:00:7b:88:1e:6c)
Internet Protocol, Src: 192.168.10.85 (192.168.10.85), Dst: 192.168.10.89 (192.168.10.89)
Transmission Control Protocol, Src Port: 47565 (47565), Dst Port: rtsp (554), Seq: 1, Ack: 1, Len: 125
Real Time Streaming Protocol
Request: OPTIONS rtsp://admin:admin@192.168.10.89:554/Vi ... t/1/h264/1 RTSP/1.0\r\n
Method: OPTIONS
URL: rtsp://admin:admin@192.168.10.89:554/Vi ... t/1/h264/1
CSeq: 1\r\n
Authorization: Basic YWRtaW46YWRtaW4=\r\n
\r\n

No. Time Source Destination Protocol Info
781674 17438.603734 192.168.10.89 192.168.10.85 RTSP Reply: RTSP/1.0 200 OK

Frame 781674 (123 bytes on wire, 123 bytes captured)
Ethernet II, Src: SanyoEle_88:1e:6c (08:00:7b:88:1e:6c), Dst: AsustekC_6e:0a:26 (00:22:15:6e:0a:26)
Internet Protocol, Src: 192.168.10.89 (192.168.10.89), Dst: 192.168.10.85 (192.168.10.85)
Transmission Control Protocol, Src Port: rtsp (554), Dst Port: 47565 (47565), Seq: 1, Ack: 126, Len: 69
Real Time Streaming Protocol
Response: RTSP/1.0 200 OK\r\n
Status: 200
CSeq: 1\r\n
Public: DESCRIBE, SETUP, PLAY, TEARDOWN\r\n
\r\n

----------------

However, when I add the config to ZM, and zmc runs to handle the capture, I only see the first DESCRIBE method, and in the logs I get 'Unable to open Input xxx'.

Wireshark log:
----------------
No. Time Source Destination Protocol Info
783161 17448.618071 192.168.10.85 192.168.10.89 RTSP DESCRIBE rtsp://admin:admin@192.168.10.89:554/Vi ... t/1/h264/1 RTSP/1.0

Frame 783161 (166 bytes on wire, 166 bytes captured)
Ethernet II, Src: AsustekC_6e:0a:26 (00:22:15:6e:0a:26), Dst: SanyoEle_88:1e:6c (08:00:7b:88:1e:6c)
Internet Protocol, Src: 192.168.10.85 (192.168.10.85), Dst: 192.168.10.89 (192.168.10.89)
Transmission Control Protocol, Src Port: 47567 (47567), Dst Port: rtsp (554), Seq: 1, Ack: 1, Len: 112
Real Time Streaming Protocol
Request: DESCRIBE rtsp://admin:admin@192.168.10.89:554/Vi ... t/1/h264/1 RTSP/1.0\r\n
Method: DESCRIBE
URL: rtsp://admin:admin@192.168.10.89:554/Vi ... t/1/h264/1
Accept: application/sdp\r\n
CSeq: 1\r\n
\r\n

No. Time Source Destination Protocol Info
783163 17448.620479 192.168.10.89 192.168.10.85 RTSP Reply: RTSP/1.0 401 Unauthorized

Frame 783163 (142 bytes on wire, 142 bytes captured)
Ethernet II, Src: SanyoEle_88:1e:6c (08:00:7b:88:1e:6c), Dst: AsustekC_6e:0a:26 (00:22:15:6e:0a:26)
Internet Protocol, Src: 192.168.10.89 (192.168.10.89), Dst: 192.168.10.85 (192.168.10.85)
Transmission Control Protocol, Src Port: rtsp (554), Dst Port: 47567 (47567), Seq: 1, Ack: 113, Len: 88
Real Time Streaming Protocol
Response: RTSP/1.0 401 Unauthorized\r\n
Status: 401
CSeq: 1\r\n
WWW-Authenticate: Basic realm="You need RTSP ID"\r\n
\r\n

----------------

ZM Debug log:
----------------
03/17/09 16:45:11.100847 zmc_m4[12762].INF-zm_debug.c/292 [New Debug Level = 7, New Debug Log = /tmp/zm.log]
03/17/09 16:45:11.101065 zmc_m4[12762].DB1-zm_monitor.cpp/2260 [Got 1 monitors]
03/17/09 16:45:11.101397 zmc_m4[12762].DB1-zm_thread.cpp/240 [Creating thread]
03/17/09 16:45:11.101429 zmc_m4[12762].DB2-zm_rtsp.cpp/176 [Protocol is:rtsp]
03/17/09 16:45:11.101447 zmc_m4[12762].DB2-zm_rtsp.cpp/177 [Host is:192.168.10.89]
03/17/09 16:45:11.101460 zmc_m4[12762].DB2-zm_rtsp.cpp/178 [Path is:/VideoInput/1/h264/1]
03/17/09 16:45:11.101473 zmc_m4[12762].DB2-zm_rtsp.cpp/179 [SubPath is:?trackid=1]
03/17/09 16:45:11.101486 zmc_m4[12762].DB2-zm_rtsp.cpp/180 [Auth is:admin:admin]
03/17/09 16:45:11.101541 zmc_m4[12762].DB2-zm_rtsp.cpp/194 [RTSP Local SSRC is 6b8b4567]
03/17/09 16:45:11.101559 zmc_m4[12762].DB1-zm_thread.cpp/276 [Starting thread]
03/17/09 16:45:11.101670 zmc_m4[12763].DB2-zm_thread.cpp/252 [Invoking thread]
03/17/09 16:45:11.101858 zmc_m4[12762].DB1-zm_thread.cpp/297 [Started thread 12763]
03/17/09 16:45:11.107601 zmc_m4[12762].DB1-zm_monitor.cpp/338 [monitor purpose=1]
03/17/09 16:45:11.107639 zmc_m4[12762].DB1-zm_monitor.cpp/345 [mem.size=62209192]
03/17/09 16:45:11.113770 zmc_m4[12763].ERR-zm_rtsp.cpp/313 [Unable to open input 'rtsp://admin:admin@192.168.10.89:554/VideoInput/1/h264/1']
03/17/09 16:45:11.113845 zmc_m4[12763].DB2-zm_thread.cpp/263 [Exiting thread, status 0xffffffff]
03/17/09 16:45:11.193126 zmc_m4[12762].DB1-zm_zone.cpp/50 [Initialised zone 0/All - 1 - 960x540 - Rgb:ff0000, CM:3, MnAT:15, MxAT:0, MnAP:50, MxAP:75000, FB:3x3, MnFP:50, MxFP:50000, MnBS:10, MxBS:0, MnB:0, MxB:0, OF: 0]
03/17/09 16:45:11.207592 zmc_m4[12762].DB1-zm_monitor.cpp/458 [Monitor Sanyo has function 5]
03/17/09 16:45:11.207622 zmc_m4[12762].DB1-zm_monitor.cpp/459 [Monitor Sanyo LBF = '%N - %y/%m/%d %H:%M:%S', LBX = 0, LBY = 0]
03/17/09 16:45:11.207629 zmc_m4[12762].DB1-zm_monitor.cpp/460 [Monitor Sanyo IBC = 40, WUC = 25, pEC = 10, PEC = 10, EAF = 1, FRI = 1000, RBP = 7, FM = 0]
03/17/09 16:45:11.207748 zmc_m4[12762].DB1-zm_zone.cpp/889 [Got 1 zones for monitor Sanyo]
03/17/09 16:45:11.207760 zmc_m4[12762].DB5-zm_zone.cpp/918 [Parsing polygon 0,0 959,0 959,539 0,539]
03/17/09 16:45:11.207767 zmc_m4[12762].DB3-zm_zone.cpp/758 [Parsing polygon string '0,0 959,0 959,539 0,539']
03/17/09 16:45:11.207775 zmc_m4[12762].DB3-zm_zone.cpp/796 [Got coordinate 0,0 from polygon string]
03/17/09 16:45:11.207782 zmc_m4[12762].DB3-zm_zone.cpp/796 [Got coordinate 959,0 from polygon string]
03/17/09 16:45:11.207789 zmc_m4[12762].DB3-zm_zone.cpp/796 [Got coordinate 959,539 from polygon string]
03/17/09 16:45:11.207795 zmc_m4[12762].DB3-zm_zone.cpp/796 [Got coordinate 0,539 from polygon string]
03/17/09 16:45:11.207804 zmc_m4[12762].DB3-zm_zone.cpp/816 [Successfully parsed polygon string]
03/17/09 16:45:11.207813 zmc_m4[12762].DB1-zm_zone.cpp/50 [Initialised zone 4/All - 1 - 960x540 - Rgb:ff0000, CM:3, MnAT:25, MxAT:0, MnAP:15552, MxAP:388800, FB:3x3, MnFP:15552, MxFP:388800, MnBS:10368, MxBS:0, MnB:1, MxB:0, OF: 0]
03/17/09 16:45:11.215678 zmc_m4[12762].DB1-zm_monitor.cpp/2457 [Loaded monitor 4(Sanyo), 1 zones]
03/17/09 16:45:11.215706 zmc_m4[12762].INF-zmc.cpp/186 [Starting Capture]
03/17/09 16:45:11.215807 zmc_m4[12762].DB2-zm_remote_camera_rtsp.cpp/112 [Waiting for sources]
03/17/09 16:45:16.216697 zmc_m4[12762].FAT-zm_remote_camera_rtsp.cpp/118 [No RTSP sources]

03/17/09 16:45:16.216955 zmc_m4[12762].INF-zm_signal.cpp/64 [Got signal 6 (Aborted), exiting and forcing backtrace]
03/17/09 16:45:16.217136 zmc_m4[12762].ERR-zm_signal.cpp/84 [Signal address is (nil), from 0xb7f5d430]
03/17/09 16:45:16.217512 zmc_m4[12762].ERR-zm_signal.cpp/122 [Backtrace: [0xb7f5d430]]
03/17/09 16:45:16.217593 zmc_m4[12762].ERR-zm_signal.cpp/122 [Backtrace: [0xb7f5d430]]
03/17/09 16:45:16.217695 zmc_m4[12762].ERR-zm_signal.cpp/122 [Backtrace: /lib/tls/i686/cmov/libc.so.6(gsignal+0x50) [0xb72ec8a0]]
03/17/09 16:45:16.217778 zmc_m4[12762].ERR-zm_signal.cpp/122 [Backtrace: /lib/tls/i686/cmov/libc.so.6(abort+0x188) [0xb72ee268]]
03/17/09 16:45:16.217851 zmc_m4[12762].ERR-zm_signal.cpp/122 [Backtrace: /usr/local/bin/zmc [0x80562cd]]
03/17/09 16:45:16.217922 zmc_m4[12762].ERR-zm_signal.cpp/122 [Backtrace: /usr/local/bin/zmc [0x807fa04]]
03/17/09 16:45:16.217993 zmc_m4[12762].ERR-zm_signal.cpp/122 [Backtrace: /usr/local/bin/zmc [0x804d093]]
03/17/09 16:45:16.218064 zmc_m4[12762].ERR-zm_signal.cpp/122 [Backtrace: /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5) [0xb72d7685]]
03/17/09 16:45:16.218137 zmc_m4[12762].ERR-zm_signal.cpp/122 [Backtrace: /usr/local/bin/zmc [0x804cc21]]
03/17/09 16:45:16.218208 zmc_m4[12762].INF-zm_signal.cpp/125 [Backtrace complete, please execute the following command for more information]
03/17/09 16:45:16.218287 zmc_m4[12762].INF-zm_signal.cpp/126 [addr2line -e /usr/local/bin/zmc 0xb7f5d430 0xb7f5d430 0xb72ec8a0 0xb72ee268 0x80562cd 0x807fa04 0x804d093 0xb72d7685 0x804cc21]
----------------

The camera's implementation seems to be broken in that it requires basic auth for everything, even the DESCRIBE method. I was just wondering if anyone with better knowledge of ZM and/or FFMPEG code could help.

As far as I can tell from reading the FFMPEG code, it seems that the issue is with the av_open_input_file function - it's getting a 401 and not parsing the username:password string out from the URL, but instead returning an error.

Thanks very much for any help,

Nick Young


Tue Mar 17, 2009 6:58 am
Profile

Joined: Wed Feb 23, 2005 10:21 pm
Posts: 150
Location: Czestochowa, POLAND
Post 
Did you patched ffmpeg with authorization patch?


Thu Mar 19, 2009 9:24 am
Profile

Joined: Mon Mar 16, 2009 5:38 am
Posts: 6
Post 
Oops, I forgot to put that in. Yes, i did. I also fixed the same bugs that someone else posted about in another thread, but forgot until I saw that thread. :)


Thu Mar 19, 2009 11:25 pm
Profile

Joined: Mon Mar 16, 2009 5:38 am
Posts: 6
Post 
A reply just in case anyone finds this topic through Google:

It seems that this issue is caused by the implementation of RTSP on the camera I am using - it asks for authentication at the DESCRIBE method stage rather than at the SETUP stage.

Can anyone confirm if asking for authentication at the SETUP stage is normal behaviour for IP cameras doing RTP over UDP with RTSP session setup?


Fri Apr 03, 2009 3:46 am
Profile

Joined: Tue Aug 21, 2007 2:42 pm
Posts: 246
Location: Baltimore, MD
Post 
Any update on this camera?
I am trying to get one working with 1.24.2 and am having the same problems as above. I have not applied any additional patches.

I am in the process of updating the camera's firmware to 1.03-00 and will report if it helps.
The notes for the firmware are:
Code:
Firmware for VCC-HD4000(P)



MAIN 1.03-00 (090326-04): CL210300.bin

SUB  1.00-03 (090302-00): CL230200.HEX



Use with ActiveX H.264 Plug-in version 2.0.6.8.

Differences from previous version:

- Support RTP over RTSP protocol.

- Support RTP over RTSP over HTTP protocol.


Wed Jun 17, 2009 10:40 pm
Profile WWW

Joined: Mon Mar 16, 2009 5:38 am
Posts: 6
Post 
Sorry for the lack of updates. I did eventually manage to get the camera working by patching ffmpeg with the RTSP authentication patch available in the wiki and then using the camera as a FFMPEG camera, passing the full RTSP url including the username and password, like so:

rtsp://user:pass@x.x.x.x/VideoInput/1/h264/1

With the 1.03 firmware as well, you need to make sure that you set the rtsp_rtp setting in the codec_stream.cgi settings to 2, rather than 1, as this is the newer, better, implementation.

If you need a hand with this or anything else on the Sanyo, post something here and I'll be here as soon as I can.

Edit: When I have some time, I'll see if I can put some notes about the Sanyo camera in the wiki.


Thu Jun 18, 2009 3:06 am
Profile

Joined: Tue Aug 21, 2007 2:42 pm
Posts: 246
Location: Baltimore, MD
Post 
Nick,

Thanks for the update! I will apply the auth. patch, and then get the firmware uploaded.
I am having trouble uploading the MAIN firmware (SUB went fine), as the browser keeps timing out. Did you upload through your browser (if so, which one?), or did you upload using a SD card?


Thu Jun 18, 2009 1:43 pm
Profile WWW

Joined: Tue Aug 21, 2007 2:42 pm
Posts: 246
Location: Baltimore, MD
Post 
OK, I have the firmware updated, and rtsp set to version 2.

As for the authentication patch, are you referring to http://lists.mplayerhq.hu/pipermail/ffm ... 59446.html ? If not, could you send me the link? Thanks.

EDIT: Actually, could you give me a rundown of how to apply actually that patch?


Thu Jun 18, 2009 3:07 pm
Profile WWW

Joined: Mon Mar 16, 2009 5:38 am
Posts: 6
Post 
Good to see you got the firmware to update - I found I had to use IE to get it to work, which is a bit of a bitch as my main desktop is a Linux machine. :)

I think the patch you refer to and the one linked in the ZM wiki here http://www.zoneminder.com/wiki/index.php/Patches are one and the same.

To apply the patch, you need to checkout the latest SVN of FFMPEG, copy the patch into that directory, and then run patch -p0 <patchfile>. You might need to fiddle with the paths inside the patchfile slightly to make the patch work properly. Then you can go through the standard configure/make/make install process, although with ffmpeg, you should also do make install-libs.

When you do configure FFMPEG, you need to make sure you use at least ./configure --enable-gpl --enable-postproc --enable-pthreads .

Anyway, hope this helps, if you still need a hand, just drop some more replies here.


Fri Jun 19, 2009 12:52 am
Profile

Joined: Fri Aug 14, 2009 12:56 pm
Posts: 1
Post 
nickyoung wrote:
Good to see you got the firmware to update - I found I had to use IE to get it to work, which is a bit of a bitch as my main desktop is a Linux machine. :)

I think the patch you refer to and the one linked in the ZM wiki here http://www.zoneminder.com/wiki/index.php/Patches are one and the same.

To apply the patch, you need to checkout the latest SVN of FFMPEG, copy the patch into that directory, and then run patch -p0 <patchfile>. You might need to fiddle with the paths inside the patchfile slightly to make the patch work properly. Then you can go through the standard configure/make/make install process, although with ffmpeg, you should also do make install-libs.

When you do configure FFMPEG, you need to make sure you use at least ./configure --enable-gpl --enable-postproc --enable-pthreads .

Anyway, hope this helps, if you still need a hand, just drop some more replies here.

hey firstly i am sorry about my english
how are you doing
this is mehmet i need to your help about sanyohd 4000 camera .
my mission is to get stream from hd camera (h264 format) and decode that video data stream than display it.
i am using for that ffmpeg but it doesnt work.it gives me the same error with yours can you give me your patched avcodec.lib avformat.lib and dll files thank you for your help..


Tue Aug 18, 2009 3:55 pm
Profile

Joined: Mon Mar 16, 2009 5:38 am
Posts: 6
Post 
mehmetalilk wrote:
hey firstly i am sorry about my english
how are you doing
this is mehmet i need to your help about sanyohd 4000 camera .
my mission is to get stream from hd camera (h264 format) and decode that video data stream than display it.
i am using for that ffmpeg but it doesnt work.it gives me the same error with yours can you give me your patched avcodec.lib avformat.lib and dll files thank you for your help..

In order to make the Sanyo hd4000 camera work with Zoneminder, you need to:
1. Ensure the camera is updated to the latest firmware available - the earlier firmwares had really buggy RTSP implementations.
2. You'll need to build your FFMPEG from the subversion source, adding the patch mentioned earlier. Once you've done that, the ffmpeg binaries should be able to play the source if you use
ffplay rtsp://admin:admin@x.x.x.x/VideoInput/1/h264/1
as the filename.
3. Once you can view the source using FFMPEG, you should make sure that you have the path to the FFMPEG binary set in your ZM config, then add the camera as an FFMPEG type camera, using the url from step 2 as the filename. Then, it should play.

I hope this helps you. I can't send you any DLL files as I haven't compiled ffmpeg on Windows, only on Linux.


Wed Aug 19, 2009 12:42 am
Profile

Joined: Fri Dec 18, 2009 9:49 pm
Posts: 1
Post 
Hi,

Is it possible to use VLC to play video stream from camera? Can someone give me pointers to get video via RTSP in windows ?

Also is there a command that will access a jpeg image directly?

eg 192.168.1.21/jpeg.jpg etc...

Has anyone succesfully teleneted to this camera? There is a request for password and user name if you try to telnet.. What are those? Anyone know?

They also misspelled "Password" it is spelled "Passoword" LOL


Fri Dec 18, 2009 9:53 pm
Profile

Joined: Wed Jan 20, 2010 1:17 am
Posts: 1
Post 
Hi,

I also have the VCC-HD4000 cam, however, I see no RTSP settings
and when I try to connect to the port it gives me:

RTSP/1.0 503 Service Unavailable

Any idea?

Thanx


Wed Jan 20, 2010 1:23 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 13 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group