npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@danelowe/scrypted-plugin-kingcam

v0.0.2

Published

KingCam ONVIF Camera Plugin for Scrypted

Downloads

28

Readme

KingCam ONVIF Plugin for Scrypted

I've implemented a custom client that supports the minimum required ONVIF endpoints to get KingCam cameras set up with Scrypted. This is in src/client.

common.ts and rtsp.ts are extracted from Scrypted.

publish

npm publish --access public

Deploy to scrypted

npm run build && npm run scrypted-deploy 192.168.1.100

Scrypted

Set up to make security cameras compatible with HomeKit Secure Video.

Install @danelowe/scrypted-plugin-kingcam plugin, @scrypted/homekit @scrypted/snapshot

The cameras should have motion detection enabled, and able to send ONVIF events to scrypted.

Required docker config:

FROM koush/scrypted:v0.1.6
RUN apt-get -y update
RUN apt-get install -y ffmpeg
  scrypted:
    build: ./scrypted/
    privileged: true # this may not be necessary for all setups
    container_name: scrypted
    restart: always
    network_mode: host
    volumes:
        - ./volumes/scrypted:/server/volume
        # Adds `{ type: () => true }` to plain text body parser to allow XML or other non-JSON bodies to be posted.
        - ./scrypted/plugin-http.js:/server/node_modules/@scrypted/server/dist/plugin/plugin-http.js
    devices:
      - /dev/dri/renderD128 # for intel hwaccel
    environment:
      SCRYPTED_FFMPEG_PATH: /usr/bin/ffmpeg # Use OS package rather than node package, to support VAAPI hardware decoding.
    logging:
        driver: "json-file"
        options:
            max-size: "10m"
            max-file: "10"

Scrypted setup for each camera

  • Integrations, WebRTC (required), Rebroadcast, Transcoding, HomeKit, Snapshot.
  • Disable audio. The cameras might actually support audio, but HKSV requires AAC (which may be supported by camera?), and we don't really want audio.
  • HomeKit Tab - Transcoding Debug Mode.
  • HomeKit Pairing - Standalone Accessory Mode.
  • Transcoding - All streams: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
  • Stream: MainStream, Stream: SubStream - set RTSP parser to FFMPEG TCP
  • Snapshot: from prebuffer.

*Reload plugins to ensure cameras are no longer set up in bridge mode

Enable motion detection.

Motion detection is performed by the camera, and posted to scrypted.

Motion detection should be enabled on each camera.

If you don't have Internet Explorer, the easiest method is telnet.

➜  onvif telnet 192.168.1.155 9999
Trying 192.168.1.155...
Connected to 192.168.1.155.
Escape character is '^]'.
list
[Success]list;accfg;aeawbblccfg;alarmincfg;alarmoutcfg;alarmtest;alarmhost;audiocfg;audiotestcfg;blackmargincfg;ca2aicfg;ca2host;ca2mdcfg;ca2vlcfg;ca2vmcfg;capturecfg;ca2ipconflict;ca2linkbroken;ca2diskfull;ca2diskerror;ddns9299;ddns3322;devrecordcfg;devvecfg;denoisecfg;emailcfg;ethcfg;ftpclicfg;getalarmevent;ircfg;mdcfg;mdmbcfg;nfsrecordcfg;osdcfg;osdstrcfg;osdstylecfg;portcfg;pppoecfg;roicfg;sambarecordcfg;searchfilecfg;getlog;sysctrl;timecfg;update;ntpcfg;upnpcfg;sdcard;userpasswd;veprofile;version;vicfg;vlcfg;toggle;videomaskcfg;capability;showweb;ptzcfg;checkuser;authmode;diskalarmcfg;vmaskalarmcfg;prienv;bootargs;guobiaocfg;guobiaoaddr;tslivecfg;hngscfg;jstarcfg;tutkcfg;format;mkdosfsprogbar;lensdpc;lenscs;danalecfg;danaleconf;dhcpnotify;outispadjust;

Connection closed by foreign host.
➜  onvif telnet 192.168.1.155 9999
Trying 192.168.1.155...
Connected to 192.168.1.155.
Escape character is '^]'.
mdmbcfg -act list
[Success]enable=1;thresh=100;mbdesc=0000000000000000000000,0000000000000000000000,0000000000000000000000,0000000000000000000000,0000000000000000000000,0000000000000000000000,0000000000000000000000,0000000000000000000000,0000000000000000000000,0000000000000000000000,0000000000000000000000,0000000000000000000000,0000000000000000000000,0000000000000000000000,0000000000000000000000,0000000000000000000000,0000000000000000000000,0000000000000000000000,;timestrategy=0:2164260863,1:2164260863,2:2164260863,3:2164260863,4:2164260863,5:2164260863,6:2164260863,;
➜  ~ telnet 192.168.1.155 9999
Trying 192.168.1.155...
Connected to 192.168.1.155.
Escape character is '^]'.
mdmbcfg -act list
[Success]enable=1;thresh=20;mbdesc=0000000000000000000000,0000000000000000000000,0111111111111111111000,0111111111111111111000,0111111111111111111000,0111111111111111111000,0111111111111111111000,0111111111111111111000,0111111111111111111000,0111111111111111111000,0111111111111111111000,0111111111111111111000,0111111111111111111000,0111111111111111111000,0111111111111111111000,0000000000000000000000,0000000000000000000000,0000000000000000000000,;timestrategy=0:2164260863,1:2164260863,2:2164260863,3:2164260863,4:2164260863,5:2164260863,6:2164260863,;

thresh is sensitivity threshold. 100 is most sensitive, 0 is least sensitive.

mbdesc is 18 sets of 22 bits. Presumably this is just splitting the screen into boxes, with 1 indicating that motion in that box should be detected.

0000000000000000000000,
0000000000000000000000,
0111111111111111111000,
0111111111111111111000,
0111111111111111111000,
0111111111111111111000,
0111111111111111111000,
0111111111111111111000,
0111111111111111111000,
0111111111111111111000,
0111111111111111111000,
0111111111111111111000,
0111111111111111111000,
0111111111111111111000,
0111111111111111111000,
0000000000000000000000,
0000000000000000000000,
0000000000000000000000

timestrategy is the times that motion detection is enabled by day of week. 2164260863 is all day.

To enable motion detection at all time, in all areas of the camera, with a detection sensitivity of 20/100, run:

mdmbcfg -act set -enable 1 -thresh 20 -mbdesc 1111111111111111111111,1111111111111111111111,1111111111111111111111,1111111111111111111111,1111111111111111111111,1111111111111111111111,1111111111111111111111,1111111111111111111111,1111111111111111111111,1111111111111111111111,1111111111111111111111,1111111111111111111111,1111111111111111111111,1111111111111111111111,1111111111111111111111,1111111111111111111111,1111111111111111111111,1111111111111111111111 -timestrategy 0:2164260863,1:2164260863,2:2164260863,3:2164260863,4:2164260863,5:2164260863,6:2164260863;