Page 1 of 2

[solved] Hikvision DS-KB8112-IM connection to ZM?

Posted: Wed Jun 24, 2020 8:32 am
by DonZalmrol
Hi,

First post here, hopefully right subforum.
I've been using ZM for a while now and I'm gradually expanding my cam network.

Recently purchased and installed my two Hikvision doorbells (DS-KB8112-IM) with the Indoor station (DS-KH8301-WT) and they are working well.
Now I'm trying to add my doorbells to my ZM installation, this seems a bit difficult as (at first glance) there is no RTSP available on the doorbells, I only have the ports 80, 443 and 8000 available.

Searched the forum and wiki, and only found the how to for the DS-KB6003-WIP.
https://wiki.zoneminder.com/Hikvision_V ... KB6003-WIP

Unfortunately not working (as RTSP is not available).

Tips, tricks greatly appreciated!

EDIT 01: Seems that RTSP should be available according to the datasheet.
https://www.hikvision.com/en/products/V ... KB8112-IM/

I probably need to find the correct RTSP stream.

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

Posted: Thu Jun 25, 2020 9:55 pm
by Doobie Brother
Have you tried the URL in this post?:

https://community.home-assistant.io/t/h ... a/45123/41

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

Posted: Tue Jun 30, 2020 4:04 pm
by DonZalmrol
Apologies for the late reply, work had gotten in the way.

The link provided works for me through VLC player!
But not in ZM, yet they are the exact same RTSP URLs.

Maybe I need to set something additionaly for it to work in ZM besides the FFMPEG codec?

From the ZM log:
2020-06-30 18:06:03 zmc_m3 94401 ERR Unable to open input rtsp://username:password@IPADDRESS:554/Streaming/Channels/101 due to: Invalid data found when processing input zm_ffmpeg_camera.cpp 379

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

Posted: Tue Jun 30, 2020 5:03 pm
by burger
Try source type: LibVLC in zoneminder if it works in VLC.

Also review https://wiki.zoneminder.com/Finding_Camera_Stream_Paths

Test things out of ZM before using ZM. i.e. use vlc from gui, and ffmpeg from terminal to verify that these source type will work, then use the path you used, and the resolution they will print out, when/if they work.

It's faster to test outside of ZM, first.

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

Posted: Thu Jul 02, 2020 4:24 am
by incompetent-nerd
DonZalmrol,

I don't have the Hikvision doorbell, but do have several of their other cameras on my ZM system.
The URL I ended up using was:
rtsp://username:password@192.168.0.1:554/Streaming/Channels/101?transportmode=unicast&profile=Profile_1

I had to create a username and password in the camera GUI. If I left it blank, I had problems.

Perhaps the above URL will work with the doorbell also?
I'd also recommend double checking SELINUX or IPTABLES is not blocking anything.
I'm embarassed to admit how much time I spent troubleshooting things when it was a simple firewall or SELINUX issue...

*EDIT* My source type is FFMPEG.

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

Posted: Fri Jul 03, 2020 2:39 pm
by DonZalmrol
@Burger: seems my ZM cannot open the stream correctly, yet the settings are the same. My computer (different VLAN as my ZM and CAMS) can open the stream with VLC and ffmpeg.

Code: Select all

PS C:\temp\ffmpeg-20200628-4cfcfb3-win64-static\bin> .\ffmpeg.exe -i rtsp://xxx:xxx@x.x.x.x:554/Streaming/Channels/101 output.mp4
ffmpeg version git-2020-06-28-4cfcfb3 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200621
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 55.100 / 56. 55.100
  libavcodec     58. 93.100 / 58. 93.100
  libavformat    58. 47.100 / 58. 47.100
  libavdevice    58. 11.100 / 58. 11.100
  libavfilter     7. 86.100 /  7. 86.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
[rtsp @ 0000028b7990bf80] Missing PPS in sprop-parameter-sets, ignoring
[rtsp @ 0000028b7990bf80] RTP: dropping old packet received too late
    Last message repeated 1 times
[h264 @ 0000028b7990ff80] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0000028b7990ff80] decode_slice_header error
[h264 @ 0000028b7990ff80] no frame!
[rtsp @ 0000028b7990bf80] RTP: dropping old packet received too late
    Last message repeated 1 times
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://xxx:xxx@x.x.x.x:554/Streaming/Channels/101':
  Metadata:
    title           : HIK Media Server
    comment         : HIK Media Server Session Description : standard
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1280x720, 25 tbr, 90k tbn, 180k tbc
    Stream #0:1: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s
File 'output.mp4' already exists. Overwrite? [y/N]
@Incompetent-nerd: Tried your URL, I can open it in VLC and in ffmpeg from my computer. Firewall is not enabled on the ZM server. A local user account has been created

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

Posted: Fri Jul 03, 2020 3:58 pm
by burger
You should test ffmpeg from the ZM server, generally. But, it looks as though it works. It's telling you the resolution 1280x720, and you have the path correct. Did you watch the output.mp4 to verify it is creating a valid video container?

Also you didn't mention if you tried source type: LibVLC. Post a screenshot of your source settings on ZM, and try ffmpeg from the ZM server.

If you have VLANs or firewall, etc, that is a possible point of failure.

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

Posted: Fri Jul 03, 2020 4:16 pm
by DonZalmrol
From the ZM server I can't use the ffmpeg codec. it keeps stating that the used query/ code is invalid or missing arguments.

The current settings are:
1.png
1.png (27.1 KiB) Viewed 8756 times
2.png
2.png (23.75 KiB) Viewed 8756 times
changing it to libvlc doesn't resolve it.

FYI I have another Hikvision camera connected (DS-2CD2143G0-I). This a regular POE cam and works without any issues.
The cam is in the same vlan as the doorbells and connects to the ZM server that resides in a different vlan.

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

Posted: Fri Jul 03, 2020 8:45 pm
by burger
Can you post the output of the ffmpeg command you are using, and results?

You should verify the zm server can run ffmpeg on the command, and that it outputs to a valid video file. This means its very likely that the server can use it (ffmpeg) w/zm.

And obvious troubleshooting applies here. Try a reboot of the camera, network switches, try different paths, try different username/password.. If you are trying to run 30FPS of 1080p on an RPI1, you might have trouble, so in that case lower res, etc, etc...

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

Posted: Mon Jul 06, 2020 11:10 am
by DonZalmrol
I will test the suggested tomorrow evening.

The server that hosts ZM should be sufficient, its hosted as a VM with decent HW specs (4x CPU (Intel Xeon E5-2650 v3), 8GB RAM).
Switches are good, username/ password, ...

Command I would need to look up, for ZM you don't need to install this codec separately no?
If so, this is probably the reason why its not working.

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

Posted: Wed Sep 23, 2020 6:08 am
by DonZalmrol
Apologies for the late reply, things got in the way of further troubleshooting this.

With Ffmpeg I am able to open up a stream of the camera's without any issues.
I've tested with /h264/ and without and same for the port ":554", in the URL "rtsp://username:password@ipaddress:554/h264/ch1/main/av_stream"

Code: Select all

PS C:\temp\ffmpeg> .\ffplay.exe -rtsp_transport tcp rtsp://username:password@ipaddress:554/h264/ch1/main/av_stream
ffplay version N-99339-ge71d73b096 Copyright (c) 2003-2020 the FFmpeg developers
  built with gcc 9.3-win32 (GCC) 20200320
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --enable-iconv --enable-zlib --enable-libxml2 --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvmaf --disable-vulkan --enable-libvorbis --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-ffnvcodec --enable-cuda-llvm --disable-libglslang --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libvidstab --disable-libwavpack --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-libs=-lgomp
  libavutil      56. 59.100 / 56. 59.100
  libavcodec     58.106.100 / 58.106.100
  libavformat    58. 58.100 / 58. 58.100
  libavdevice    58. 11.102 / 58. 11.102
  libavfilter     7. 87.100 /  7. 87.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
[rtsp @ 000001b184309900] Missing PPS in sprop-parameter-sets, ignoring
[h264 @ 000001b18430c7c0] non-existing PPS 0 referenced  0B f=0/0
    Last message repeated 1 times
[h264 @ 000001b18430c7c0] decode_slice_header error
[h264 @ 000001b18430c7c0] no frame!
Input #0, rtsp, from 'rtsp://username:password@ipaddress:554/h264/ch1/main/av_stream':
  Metadata:
    title           : HIK Media Server
    comment         : HIK Media Server Session Description : standard
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1280x720, 24.97 fps, 24.97 tbr, 90k tbn, 180k tbc
    Stream #0:1: Audio: pcm_mulaw, 8000 Hz, 1 channels, s16, 64 kb/s
  13.42 A-V: -0.008 fd=  64 aq=   11KB vq=  584KB sq=    0B f=0/0
Output on screen (excerpt):
output.png
output.png (297.99 KiB) Viewed 6613 times

In Zoneminder with the RTSP path set the same and TCP option selected. I receive the following error message from the logs:

Code: Select all

2020-09-23 08:03:26	zmc_m6		140546	ERR	Unable to open input rtsp://username:password@ipaddress:554/h264/ch1/main/av_stream due to: Invalid data found when processing input zm_ffmpeg_camera.cpp	380
2020-09-23 08:03:26	zmc_m6		140546	ERR	Failed to prime capture of initial monitor	zmc.cpp	257
Could the error message be related to the message from when I use Ffmpeg directly through powershell/ commandline?

Code: Select all

[rtsp @ 000001b184309900] Missing PPS in sprop-parameter-sets, ignoring
[h264 @ 000001b18430c7c0] non-existing PPS 0 referenced  0B f=0/0
Last message repeated 1 times
[h264 @ 000001b18430c7c0] decode_slice_header error
[h264 @ 000001b18430c7c0] no frame!

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

Posted: Tue Oct 06, 2020 6:38 pm
by DonZalmrol
Nobody? :)

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

Posted: Wed Oct 07, 2020 3:27 pm
by Magic919
The errors regarding SPS and PPS etc are just FFMPEG waiting for the keyframe in order to start playing the video. You'll notice it plays after those errors.

I cannot help with why the camera won't work via ZM. It does sound like there is something ZM doesn't like about the stream.

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

Posted: Thu Oct 08, 2020 9:11 am
by DonZalmrol
yeah that's what I'm starting to think.
Now these door stations are little bit different in regard in set up then the regular cams.

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

Posted: Thu Oct 08, 2020 10:56 am
by Magic919
Is there anything stopping you running the ffmpeg tests from the ZM server?