RTSP failes after "SETUP" (406 Not Acceptable)

Forum for questions and support relating to the 1.31.x releases only.
Post Reply
arhi
Posts: 4
Joined: Thu Aug 30, 2018 6:07 pm

RTSP failes after "SETUP" (406 Not Acceptable)

Post by arhi » Thu Aug 30, 2018 6:30 pm

Hi,
Using some noname PRC made IP camera that supports RTSP and ONVIF and ...
turned off credentials check to make things simpler (same issue with credentials on)

VLC/PotPlayer.. view the rtsp stream without problem
fflplay too

so this works: ffplay rtsp://192.168.89.60/11
also using this url in vlc/potplayer works: rtsp://192.168.89.60/11

rtsp running on default 554, this url works too as expected rtsp://192.168.89.60:554/11

debug log show zero useful info even with debug level 9:

Code: Select all

08/30/18 19:51:36.556478 zmc_m2[1260].FAT-zm_remote_camera_rtsp.cpp/148 [No RTSP sources]
08/30/18 19:51:41.691199 zmc_m2[1262].INF-zmc.cpp/223 [Starting Capture version 1.31.47]
08/30/18 19:51:42.755783 zmc_m2[1263].ERR-zm_rtsp.cpp/87 [Unexpected response code 406, text is 'Not Acceptable']
08/30/18 19:51:51.697543 zmc_m2[1262].FAT-zm_remote_camera_rtsp.cpp/148 [No RTSP sources]
08/30/18 19:52:01.841411 zmc_m2[1264].INF-zmc.cpp/223 [Starting Capture version 1.31.47]
08/30/18 19:52:02.895810 zmc_m2[1265].ERR-zm_rtsp.cpp/87 [Unexpected response code 406, text is 'Not Acceptable']
...
tcpdump show bit more:

Code: Select all

[root@gedora zoneminder]# tcpdump  -n host 192.168.89.60
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on enp4s0, link-type EN10MB (Ethernet), capture size 262144 bytes
20:04:47.075822 IP 192.168.89.1.43398 > 192.168.89.60.rtsp: Flags [S], seq 4173094158, win 27200, options [mss 1360,sackOK,TS val 192532742 ecr 0,nop,wscale 7], length 0
20:04:47.076380 IP 192.168.89.60.rtsp > 192.168.89.1.43398: Flags [S.], seq 1746096554, ack 4173094159, win 14480, options [mss 1460,sackOK,TS val 481524 ecr 192532742,nop,wscale 1], length 0
20:04:47.076407 IP 192.168.89.1.43398 > 192.168.89.60.rtsp: Flags [.], ack 1, win 213, options [nop,nop,TS val 192532742 ecr 481524], length 0
20:04:47.076432 IP 192.168.89.1.43398 > 192.168.89.60.rtsp: Flags [P.], seq 1:90, ack 1, win 213, options [nop,nop,TS val 192532742 ecr 481524], length 89: RTSP: OPTIONS rtsp://192.168.89.60:554/11 RTSP/1.0
20:04:47.077108 IP 192.168.89.60.rtsp > 192.168.89.1.43398: Flags [.], ack 90, win 7240, options [nop,nop,TS val 481524 ecr 192532742], length 0
20:04:47.193653 IP 192.168.89.60.rtsp > 192.168.89.1.43398: Flags [P.], seq 1:135, ack 90, win 7240, options [nop,nop,TS val 481536 ecr 192532742], length 134: RTSP: RTSP/1.0 200 OK
20:04:47.193691 IP 192.168.89.1.43398 > 192.168.89.60.rtsp: Flags [.], ack 135, win 221, options [nop,nop,TS val 192532860 ecr 481536], length 0
20:04:47.193761 IP 192.168.89.1.43398 > 192.168.89.60.rtsp: Flags [P.], seq 90:180, ack 135, win 221, options [nop,nop,TS val 192532860 ecr 481536], length 90: RTSP: DESCRIBE rtsp://192.168.89.60:554/11 RTSP/1.0
20:04:47.194148 IP 192.168.89.60.rtsp > 192.168.89.1.43398: Flags [.], ack 180, win 7240, options [nop,nop,TS val 481536 ecr 192532860], length 0
20:04:47.305694 IP 192.168.89.60.rtsp > 192.168.89.1.43398: Flags [P.], seq 135:741, ack 180, win 7240, options [nop,nop,TS val 481547 ecr 192532860], length 606: RTSP: RTSP/1.0 200 OK
20:04:47.346332 IP 192.168.89.1.43398 > 192.168.89.60.rtsp: Flags [.], ack 741, win 231, options [nop,nop,TS val 192533012 ecr 481547], length 0
20:04:48.194044 IP 192.168.89.1.43398 > 192.168.89.60.rtsp: Flags [P.], seq 180:299, ack 741, win 231, options [nop,nop,TS val 192533860 ecr 481547], length 119: RTSP: SETUP rtsp://192.168.89.60:554/11 RTSP/1.0
20:04:48.194930 IP 192.168.89.60.rtsp > 192.168.89.1.43398: Flags [.], ack 299, win 7240, options [nop,nop,TS val 481636 ecr 192533860], length 0
20:04:48.195978 IP 192.168.89.60.rtsp > 192.168.89.1.43398: Flags [P.], seq 741:813, ack 299, win 7240, options [nop,nop,TS val 481636 ecr 192533860], length 72: RTSP: RTSP/1.0 406 Not Acceptable
20:04:48.195986 IP 192.168.89.1.43398 > 192.168.89.60.rtsp: Flags [.], ack 813, win 231, options [nop,nop,TS val 192533862 ecr 481636], length 0
^C
15 packets captured
16 packets received by filter
so after the SETUP is sent camera reply with 406 not acceptable and zmc dies with "no rtsp sources" in the log

on the other hand, ffplay tcpdump shows it works nicely

Code: Select all

[root@gedora zoneminder]# tcpdump  -n host 192.168.89.60
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on enp4s0, link-type EN10MB (Ethernet), capture size 262144 bytes
20:21:13.909502 IP 192.168.89.1.43464 > 192.168.89.60.rtsp: Flags [S], seq 922085818, win 27200, options [mss 1360,sackOK,TS val 193519597 ecr 0,nop,wscale 7], length 0
20:21:13.910655 IP 192.168.89.60.rtsp > 192.168.89.1.43464: Flags [S.], seq 181379712, ack 922085819, win 14480, options [mss 1460,sackOK,TS val 580207 ecr 193519597,nop,wscale 1], length 0
20:21:13.910673 IP 192.168.89.1.43464 > 192.168.89.60.rtsp: Flags [.], ack 1, win 213, options [nop,nop,TS val 193519598 ecr 580207], length 0
20:21:13.910701 IP 192.168.89.1.43464 > 192.168.89.60.rtsp: Flags [P.], seq 1:85, ack 1, win 213, options [nop,nop,TS val 193519598 ecr 580207], length 84: RTSP: OPTIONS rtsp://192.168.89.60:554/11 RTSP/1.0
20:21:13.911374 IP 192.168.89.60.rtsp > 192.168.89.1.43464: Flags [.], ack 85, win 7240, options [nop,nop,TS val 580207 ecr 193519598], length 0
20:21:14.024759 IP 192.168.89.60.rtsp > 192.168.89.1.43464: Flags [P.], seq 1:135, ack 85, win 7240, options [nop,nop,TS val 580219 ecr 193519598], length 134: RTSP: RTSP/1.0 200 OK
20:21:14.024771 IP 192.168.89.1.43464 > 192.168.89.60.rtsp: Flags [.], ack 135, win 221, options [nop,nop,TS val 193519712 ecr 580219], length 0
20:21:14.025121 IP 192.168.89.1.43464 > 192.168.89.60.rtsp: Flags [P.], seq 85:195, ack 135, win 221, options [nop,nop,TS val 193519713 ecr 580219], length 110: RTSP: DESCRIBE rtsp://192.168.89.60:554/11 RTSP/1.0
20:21:14.025578 IP 192.168.89.60.rtsp > 192.168.89.1.43464: Flags [.], ack 195, win 7240, options [nop,nop,TS val 580219 ecr 193519713], length 0
20:21:14.140012 IP 192.168.89.60.rtsp > 192.168.89.1.43464: Flags [P.], seq 135:741, ack 195, win 7240, options [nop,nop,TS val 580230 ecr 193519713], length 606: RTSP: RTSP/1.0 200 OK
20:21:14.140853 IP 192.168.89.1.43464 > 192.168.89.60.rtsp: Flags [P.], seq 195:343, ack 741, win 231, options [nop,nop,TS val 193519828 ecr 580230], length 148: RTSP: SETUP rtsp://192.168.89.60:554/11/trackID=0 RTSP/1.0
20:21:14.141450 IP 192.168.89.60.rtsp > 192.168.89.1.43464: Flags [.], ack 343, win 7240, options [nop,nop,TS val 580230 ecr 193519828], length 0
20:21:14.245026 IP 192.168.89.60.rtsp > 192.168.89.1.43464: Flags [P.], seq 741:974, ack 343, win 7240, options [nop,nop,TS val 580241 ecr 193519828], length 233: RTSP: RTSP/1.0 200 OK
20:21:14.245836 IP 192.168.89.1.43464 > 192.168.89.60.rtsp: Flags [P.], seq 343:513, ack 974, win 240, options [nop,nop,TS val 193519933 ecr 580241], length 170: RTSP: SETUP rtsp://192.168.89.60:554/11/trackID=1 RTSP/1.0
20:21:14.246263 IP 192.168.89.60.rtsp > 192.168.89.1.43464: Flags [.], ack 513, win 7240, options [nop,nop,TS val 580241 ecr 193519933], length 0
20:21:14.355384 IP 192.168.89.60.rtsp > 192.168.89.1.43464: Flags [P.], seq 974:1207, ack 513, win 7240, options [nop,nop,TS val 580252 ecr 193519933], length 233: RTSP: RTSP/1.0 200 OK
20:21:14.356066 IP 192.168.89.1.33500 > 192.168.89.60.6600: UDP, length 12
20:21:14.356082 IP 192.168.89.1.33501 > 192.168.89.60.6601: UDP, length 8
20:21:14.356135 IP 192.168.89.1.33502 > 192.168.89.60.6602: UDP, length 12
20:21:14.356149 IP 192.168.89.1.33503 > 192.168.89.60.6603: UDP, length 8
20:21:14.356164 IP 192.168.89.1.43464 > 192.168.89.60.rtsp: Flags [P.], seq 513:636, ack 1207, win 250, options [nop,nop,TS val 193520044 ecr 580252], length 123: RTSP: PLAY rtsp://192.168.89.60:554/11/ RTSP/1.0
20:21:14.356759 IP 192.168.89.60.rtsp > 192.168.89.1.43464: Flags [.], ack 636, win 7240, options [nop,nop,TS val 580252 ecr 193520044], length 0
20:21:14.464854 IP 192.168.89.60.rtsp > 192.168.89.1.43464: Flags [P.], seq 1207:1395, ack 636, win 7240, options [nop,nop,TS val 580263 ecr 193520044], length 188: RTSP: RTSP/1.0 200 OK
20:21:14.505334 IP 192.168.89.1.43464 > 192.168.89.60.rtsp: Flags [.], ack 1395, win 259, options [nop,nop,TS val 193520193 ecr 580263], length 0
20:21:14.535094 IP 192.168.89.60.6602 > 192.168.89.1.33502: UDP, length 172
20:21:14.535233 IP 192.168.89.60.6602 > 192.168.89.1.33502: UDP, length 172
20:21:14.573924 IP 192.168.89.60.6600 > 192.168.89.1.33500: UDP, length 22
20:21:14.574047 IP 192.168.89.60.6600 > 192.168.89.1.33500: UDP, length 16
here I see ffplay does
DESCRIBE rtsp://192.168.89.60:554/11
SETUP rtsp://192.168.89.60:554/11/trackID=0
SETUP rtsp://192.168.89.60:554/11/trackID=1

and then
PLAY rtsp://192.168.89.60:554/11/

so the /trackID=0 and /trackID=1 is added to the url ...

if I try to add this to the url directly in zoneminder path it fails bit differently:

Code: Select all

08/30/18 20:23:23.653747 zmc_m2[2077].INF-zmc.cpp/223 [Starting Capture version 1.31.47]
08/30/18 20:23:24.816489 zmc_m2[2079].WAR-zm_rtp_source.cpp/69 [The device is using a codec that may not be supported. Do not be surprised if things don't work.]
08/30/18 20:23:24.854811 zmc_m2[2077].FAT-zm_remote_camera_rtsp.cpp/188 [Unable to locate video stream]
...
but codec is just h264 ?!?!?

Code: Select all

[root@gedora zoneminder]# ffplay rtsp://192.168.89.60:554/11
ffplay version 4.0.2 Copyright (c) 2003-2018 the FFmpeg developers
  built with gcc 8 (GCC)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --extra-ldflags='-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld ' --extra-cflags=' ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcdio --enable-libdrm --enable-indev=jack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzvbi --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Input #0, rtsp, from 'rtsp://192.168.89.60:554/11':q=    0B f=0/0
  Metadata:
    title           : 10
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1280x960, 12.50 tbr, 90k tbn, 180k tbc
    Stream #0:1: Audio: pcm_alaw, 8000 Hz, 1 channels, s16, 64 kb/s
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

SDL_OpenAudio (1 channels, 8000 Hz): ALSA: Couldn't open audio device: Connection refused
No more combinations to try, audio open failed
   3.40 M-V:  0.033 fd=   0 aq=    0KB vq=  485KB sq=    0B f=0/0
can anyone help ?! I'm stuck :(

arhi
Posts: 4
Joined: Thu Aug 30, 2018 6:07 pm

Re: RTSP failes after "SETUP" (406 Not Acceptable)

Post by arhi » Thu Aug 30, 2018 6:36 pm


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

Re: RTSP failes after "SETUP" (406 Not Acceptable)

Post by bbunge » Thu Aug 30, 2018 8:18 pm

Don't assume the resolution is correct. Use VLC (Tools, Media Information, Codec) to check camera Display Resolution.

Ah... and use ffmpeg

arhi
Posts: 4
Joined: Thu Aug 30, 2018 6:07 pm

Re: RTSP failes after "SETUP" (406 Not Acceptable)

Post by arhi » Wed Sep 12, 2018 10:47 am

bbunge wrote:
Thu Aug 30, 2018 8:18 pm
Don't assume the resolution is correct. Use VLC (Tools, Media Information, Codec) to check camera Display Resolution.
the resolution is ok (VLC confirms it)
bbunge wrote:
Thu Aug 30, 2018 8:18 pm
Ah... and use ffmpeg
what's the point of zm understanding RTSP protocol if I need to use ffmpeg to recode it? it does work with ffmpeg but it's using lot more cpu then using direct RTSP

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

Re: RTSP failes after "SETUP" (406 Not Acceptable)

Post by iconnor » Wed Sep 12, 2018 2:54 pm

What is the point of us duplicating code that exists in ffmpeg?

arhi
Posts: 4
Joined: Thu Aug 30, 2018 6:07 pm

Re: RTSP failes after "SETUP" (406 Not Acceptable)

Post by arhi » Wed Sep 12, 2018 3:15 pm

iconnor wrote:
Wed Sep 12, 2018 2:54 pm
What is the point of us duplicating code that exists in ffmpeg?
I might be wrong in understand how it works. If I understand correctly FFPMPEG transcode the date into something that is then used by the zmc/zma .. while RTSP protocol is read directly by zmc/zma... I believe that 'cause when ffpmpeg is used cpu load is lot higher then when rtsp protocol is used (as with some other cameras rtsp works)... hence I assume using rtsp directly is better option (less resource intensive) ...

as for "duplication", why rtsp protocol exist at all, why local, remote, tcp, web.... ? why isn't there only ffmpeg source available? there must be reason why all these other sources are there :D ...

I believe this "bug" requires just a small tweak to rtsp protocol, I'll fetch the sources and see where/how it's implemented, but the "not recommended to self compile" thing made me thing it's better to post here then to spend time going trough code and tweak the source myself .. seems I was wrong so "to the code" it is :D

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests