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

youtube-cctv-stream

v0.13.0

Published

Use youtube as a free buckup video surveillance server

Downloads

13

Readme

A simple script using youtube as a free video surveillance server

  • YouTube broadcast
  • Accessibility from anywhere in the world
  • Free video backup

YouTube limits the number of broadcasts, maximum number of cameras:

Requirements

  • ip camera supporting H264/H265 streaming
  • node 16
  • ffmpeg

Install

  1. Install node 16 or higher
  2. Install ffmpeg
  3. Install package npm install -g youtube-cctv-stream
  1. npm install
  2. npm run build
  3. Use npm start to run

Getting a token to access youtube

Full official instructions from Google: https://developers.google.com/youtube/v3/guides/auth/server-side-web-apps?hl=en#creatingclient

  1. Go to the google cloud console: https://console.cloud.google.com/
  2. Create a project
  3. open Api&Services
  4. Then click on Enable apis and services
  5. Find "youtube data api v3"
  6. Open and click Enable
  7. Go to credentials
  8. Click on Create credentials and select OAuth client id
  9. Select the following scope:
   YouTube Data API v3 .../auth/youtube.readonly View your YouTube account
   YouTube Data API v3 .../auth/youtube Manage your YouTube account
   YouTube Data API v3 .../auth/youtube.force-ssl See, edit, and permanently delete your YouTube videos, ratings, comments, and captions.
  1. Add yourself to test users
  2. Specify Authorized redirect URIs: http://localhost:8080
  3. Copy Client ID and Client secret to .env:
GOOGLE_CLIENT_ID=<...Client ID...>
GOOGLE_CLIENT_SECRET=<... Client secret  ...>
GOOGLE_REDIRECT_URL="http://localhost:8080"
  1. Run youtube-cctv-stream auth to get an oauth2 token to access youtube

Camera broadcast

Run:

STREAM_NAME='CCTV 1' STREAM_KEY=cam1 CAMERA_RTSP_URL="rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif" youtube-cctv-stream stream

Envs:

  • STREAM_NAME (required) - broadcast name
  • STREAM_KEY (required) - YouTube broadcast key, if it doesn't exist, it will be created at startup.
  • CAMERA_RTSP_URL (required) - rtsp stream from camera
  • STREAM_TYPE - Ingestion type (see RTMP or HLS)
    • rtmp (default)
    • hls
  • STREAM_PRIVACY_TYPE - Broadcast privacy
    • private (default) - access only for your account
    • unlisted - available via link
  • LIVE_TIME - Time in milliseconds, number. By default, one stream is created and goes "forever". Rewind to 12 hours backwards is available. If you need an archive record, set 43140000 (11 hours and 59 minutes). Then every 12 hours a new stream will be created, and the previous one will be saved to your account

RTMP or HLS

  • rtmp supports only H264, but has the lowest latency ~5s
  • hls supports H264 and H265, but the delay is up to ~20-30s.

If your camera broadcasts video in H264, choose rtmp.