GithubHelp home page GithubHelp logo

vicanis / camrec3 Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 19.59 MB

Handles Ezviz camera motion events, stores event video to AWS S3 Cloud storage

Go 67.02% TypeScript 22.90% CSS 0.82% JavaScript 1.89% Shell 5.87% Dockerfile 1.50%
aws-lambda aws-s3 ezviz

camrec3's Introduction


EZViz surveillance camera free playback solution

About

I need a solution to store CCTV events somewhere in the cloud (preferably Amazon S3), to be able to download them later. All of the EZViz cameras has its own cloud service, but it is not suitable for me for some reasons:

  • I have to pay for that
  • The payment amount depends on the duration of the archived records
  • There is no subscription plan to store records older than 30-day
  • The subsription plan for maximum storage duration (30-day) has a crazy price of ~$100 per year

Solution details

  • There is a server that stores the RTSP stream (recorder app). The server has a backend application (processor) with REST API endpoint to return the event file by its timestamp.
  • I configured the EZViz application to send notification emails to the email address of my own domain name.
  • The notification email is processed with Amazon Simple Email Service:
    • Saves raw message to Amazon S3 bucket
    • Triggers Amazon Lambda function (mailhandler)
  • The mailhandler processes email:
    • Extract timestamp from the email body
    • Creates a Amazon DynamoDB record that contains email ID, event timestamp and processing flag (is false)
  • There is another Amazon Lambda function (eventprocessor) that is triggered by Amazon EventBridge every minute:
    • Get unprocessed events from the DynamoDB table with timestamp less than 2 minutes ago:
      • Fetch event video file from the backend server
      • Store it in the S3 bucket
      • Update processed flag, set file path in the DynamoDB record
  • I built a simple dashboard application to view all videos for a specific date

Live demo:

Netlify Status

https://camera.fbuzz.pro

Quality Gate Status

Tech stack

Camera backend (recorder, processor):

  • Go
  • ffmpeg
  • gorilla/mux

Amazon Lambda functions:

  • Go

Dashboard application:

  • NextJS
  • React
  • Typescript
  • Tailwind CSS
  • Deployed on the Netlify

Configuration

Prerequisites

  1. Domain name ownership with DNS hosting feature
  2. Amazon Web Services account
  3. A Linux server to process RTSP stream and upload event videos to the cloud. I use Raspberry Pi 3B+ for this purpose.
    1. Docker installation
    2. Nginx

Configuration procedure

  1. Enable email notifications
  2. Setup Amazon Route 53
  3. Setup Amazon Simple Email Service
  4. Setup Amazon S3
  5. Setup Amazon Lambda
  6. Setup Amazon DynamoDB
  7. Setup processor server
  8. Deploy camera dashboard

Enable email notifications

Configure camera settings in the EZViz application to send motion event notifications via E-Mail. Motion event messages will start arriving in the inbox.

Message example:

Setup Amazon Route 53, Amazon Simple Email Service

Add appropriate MX records to the domain name.

Configure Amazon Simple Email Service to receive incoming emails to your domain name and store raw messages into the Amazon S3 bucket.

Configure email address in the EZViz application to send emails to your domain address.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.