Page 2 of 2

Re: Hikvision DS-KB8112-IM connection to ZM?

Posted: Thu Oct 08, 2020 11:02 am
by DonZalmrol
Its a virtual headless server, so I will not be able to display an output.
But I will try this tonight, perhaps it display some more information about the stream.

On my computer it open without any issues besides the previous mentioned error messages.

Re: Hikvision DS-KB8112-IM connection to ZM?

Posted: Thu Oct 08, 2020 12:48 pm
by Magic919
Mine's an AM, but otherwise similar. It's more about reading the text when it fails.

Re: Hikvision DS-KB8112-IM connection to ZM?

Posted: Thu Oct 08, 2020 1:40 pm
by iconnor
Some cameras don't do tcp. Try udp.

Re: Hikvision DS-KB8112-IM connection to ZM?

Posted: Thu Oct 08, 2020 2:02 pm
by DonZalmrol
When I run it from my server I get this message:

Code: Select all

[NULL @ 0x555b4e1ce8c0] Unable to find a suitable output format for 'rtsp://username:password@ipaddress:554/h264/ch1/main/av_stream'
rtsp://username:password@ipaddress:554/h264/ch1/main/av_stream: Invalid argument
and if use ffplay:

Code: Select all

root@GRE-MAN-02:/usr/bin# ffplay -i rtsp://username:password@ipaddress:554/h264/ch1/main/av_stream': Invalid argument
ffplay version 4.1.6-1~deb10u1 Copyright (c) 2003-2020 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Argument 'Invalid' provided as input filename, but 'rtsp://username:password@ipaddress:554/h264/ch1/main/av_stream':' was already specified.

Don't think its due to TCP vs UDP, tried changing the setting before and it didn't do much else...

Re: Hikvision DS-KB8112-IM connection to ZM?

Posted: Thu Oct 08, 2020 7:00 pm
by Magic919
Sounds like you need to put the RTSP part in quotes.

Re: Hikvision DS-KB8112-IM connection to ZM?

Posted: Fri Oct 09, 2020 7:32 am
by DonZalmrol
Ok, stupid of me. It was indeed the quotes.
Now I get a different error with ffplay:

Code: Select all

Could not initialize SDL - No available video device
(Did you set the DISPLAY variable?)
But that could be due to the fact its a headless server (no physical monitor, its a virtual machine).

After testing yesterday I've build a new server and set it up.
Same issue persists. I'm starting to believe that these door stations from HikVision don't use the proper RTSP stream settings/ protocol.

Now my Zoneminder is giving me this error

Code: Select all

Unable to open input rtsp://username:password@ipaddress:554/h264/ch1/main/av_stream due to: Invalid data found when processing input
Same error occurs when you run the command on the server via ssh directly.

Code: Select all

root@hostname:/home/administrator# ffmpeg -i "rtsp://username:password@ipaddress:554/h264/ch1/main/av_stream"
ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
rtsp://username:password@ipaddress:554/h264/ch1/main/av_stream: Invalid data found when processing input

Re: Hikvision DS-KB8112-IM connection to ZM?

Posted: Fri Oct 09, 2020 10:26 am
by Magic919
Ok.

I just run one of the other ff progs, such as ffprobe -i rather than ffplay (for the exact reasons you stated). ffmpeg -i works and of course stops with the error showing no output specified.

What this all suggests is it's an ffmpeg error that is just surfacing via ZM.

I'd go with running ffprobe, add a '-report' argument and then it'll create a file in the directory you run it from named ffprobe-DATE-TIME.log. Have a look for signs of trouble in there.

Re: Hikvision DS-KB8112-IM connection to ZM?

Posted: Fri Oct 09, 2020 11:41 am
by DonZalmrol
Ha when running the ffprobe I now get this error:

Code: Select all

[rtsp @ xxx] method OPTIONS failed: 401 Unauthorized
rtsp://username:password@ipaddress:554/h264/ch1/main/av_stream: Server returned 401 Unauthorized (authorization failed)
The virtual server is in the same vlan as the camera's so you couldn't say its being blocked by my firewall.
Also if it would be blocked by the firewall the other cams shouldn't work neither since these also use RTSP...

EDIT:

The FFProbe did returned a log:

Code: Select all

ffprobe started on 2020-10-09 at 13:45:18
Report written to "ffprobe-20201009-134518.log"
Command line:
ffprobe -rtsp_transport tcp rtsp://username:password@ipaddress:554/h264/ch1/main/av_stream -report
ffprobe version 4.1.6-1~deb10u1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enab$
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[tcp @ xxx] No default whitelist set
[tcp @ xxx] Original list of addresses:
[tcp @ xxx] Address ipaddress port 554
[tcp @ xxx] Interleaved list of addresses:
[tcp @ xxx] Address ipaddress port 554
[tcp @ xxx] Starting connection attempt to ipaddress port 554
[tcp @ xxx] Successfully connected to ipaddress port 554
[rtsp @ xxx] method OPTIONS failed: 401 Unauthorized
[rtsp @ xxx] CSeq: 2
WWW-Authenticate: Digest realm="TIGERYIN", nonce="xxx", random="xxx", stale="FALSE"
WWW-Authenticate: Basic realm="/"

rrtsp://username:password@ipaddress:554/h264/ch1/main/av_stream: Server returned 401 Unauthorized (authorization failed)
So it connects to the door station, but then fails when it gets to the OPTIONS part.

Re: Hikvision DS-KB8112-IM connection to ZM? -Resolved-

Posted: Fri Oct 09, 2020 12:21 pm
by DonZalmrol
Found the issue!!!

It was due to the password I've used, seems that the encoding messes up passwords with special characters...
Example from someone else who had it: https://stackoverflow.com/questions/589 ... ing-opencv

Re: Hikvision DS-KB8112-IM connection to ZM?

Posted: Fri Oct 09, 2020 12:44 pm
by iconnor
So I'm wondering if we should be translating %'s into %25's when passing the url to ffmpeg..

Kinda annoying

Re: Hikvision DS-KB8112-IM connection to ZM?

Posted: Fri Oct 09, 2020 1:17 pm
by Magic919
Good to see you've made progress with it.

Re: Hikvision DS-KB8112-IM connection to ZM?

Posted: Fri Oct 09, 2020 1:31 pm
by DonZalmrol
Well I had a different character then the '%' sign.
Suffice to say certain characters will/ could break the URL.

e.g. '@', '%', ...

Not sure if these are "fixable". Anyway its resolved :)

Re: Hikvision DS-KB8112-IM connection to ZM?

Posted: Fri Oct 09, 2020 2:12 pm
by Magic919
Good. Means I can safely add the doorbell to my Xmas list. :-)