How to set up the Chrysalis Edge Proxy

The Chrysalis Edge Proxy provides a simple, common interface for conducting AI operations on or near the edge from multiple camera sources.

Find the project on GitHub

Prerequisites

Install:

Configuration

Pull rtsp_to_rtmp docker image from dockerhub to your local computer:

docker pull chryscloud/chrysedgeproxy:0.0.3

Enable docker TCP socket connection (Linux, Ubuntu 18.04 LTS)

Create daemon.json file in /etc/docker folder and add in:

{
  "hosts": [
    "fd://",
    "unix:///var/run/docker.sock"
  ]
}

Check here how to configure the docker daemon on Windows or Mac operating systems

Create a new file /etc/systemd/system/docker.service.d/docker.conf with the following contents:

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd

Reload daemon and restart docker:

sudo systemctl daemon-reload
sudo service docker restart

Create a folder on path /data/chrysalis . At this location Chrysalis Edge Proxy stores individual camera settings.

Run Chrysalis Edge Proxy and Connect your first RTSP camera

Create docker-compose.yml:

version: '3.8'
services:
  chrysedgeportal:
    image: chryscloud/chrysedgeportal:0.0.3
    build: web/
    depends_on:
      - chrysedgeserver
      - redis
    ports:
      - "80:80"
    networks:
      - chrysnet
  chrysedgeserver:
    image: chryscloud/chrysedgeserver:0.0.3
    build: server/
    restart: always
    depends_on:
      - redis
    entrypoint: /app/main
    ports:
      - "8080:8080"
      - "50001:50001"
    volumes:
      - /data/chrysalis:/data/chrysalis
      - /var/run/docker.sock:/var/run/docker.sock
    networks: 
      - chrysnet
  redis:
    image: "redis:alpine"
    ports:
      - "6379:6379"
    # volumes:
    #   - /data/chrysalis/redis:/data
    #   - ./redis.conf:/usr/local/etc/redis/redis.conf
    # command:
    #   - redis-server
    #   - /usr/local/etc/redis/redis.conf
  
    networks: 
      - chrysnet

networks:
  chrysnet:
    name: chrysnet

 

Run the Chrysalis Edge Proxy:

docker-compose up -d

Open browser and visit chrysalisportal at address: http://localhost

Connect RTSP camera:

  1. Click: Connect RTSP Camera in the chrysalisportal and name the camera (e.g. test)
  2. Insert full RTSP link (if credentials are required then add them to the link)

Example RTSP url: rtsp://admin:12345@192.168.1.21/Streaming/Channels/101 where admin is username and 12345 is the password.

Example RTSP url: rtsp://192.168.1.21:8554/unicast when no credentials required and non-default port.

Click on the newly created connection and check the output and error log. Expected state is running and output Started python rtsp process...

chrysalis edge rtsp streamAt this point you should have the video-edge-ai-proxy up and running and your first connection to RTSP camera made.

 

Advanced configuration

Starting Chrysalis edge Proxy without a custom configuration file sets up default values. We can make changes and modify the configuration by adding a conf.yaml file into a default chrysalis directory: /data/chrysalis. 

version: 0.0.2-alpha
title: Chrysalis Video Edge Proxy
description: Chrysalis Video Edge Proxy Service for Computer Vision
mode: release # "debug": or "release"

redis:
  connection: "redis:6379"
  database: 0
  password: ""

api:
  endpoint: https://api.chryscloud.com

annotation:
  endpoint: "https://event.chryscloud.com/api/v1/annotate"
  unacked_limit: 1000
  poll_duration_ms: 300
  max_batch_size: 299

buffer:
  in_memory: 1 # number of images to store in memory buffer (1 = default)
  on_disk: false # store key-frame separated mp4 file segments to disk
  on_disk_folder: /data/chrysalis/archive
  on_disk_clean_older_than: "5m" # remove older mp4 segments than 5m
  on_disk_schedule: "@every 5s" #https://en.wikipedia.org/wiki/Cron

By modifying a custom configuration we can fine tune annotation ingestion, storage of mp4 segment files on a local disk and modify in memory buffer length.

  • mode: release: disables debug mode for http server (default: release)
  • redis -> connection: redis host with port (default: “redis:6379”)
  • redis -> database : 0 – 15. 0 is redis default database. (default: 0)
  • redis -> password: optional redis password (default: “”)
  • api -> endpoint: chrysalis API location for remote signaling such as enable/disable storage (default: https://api.chryscloud.com)
  • annotation -> endpoint: Crysalis Cloud annotation endpoint (default: https://event.chryscloud.com/api/v1/annotate)
  • annotation -> unacked limit: maximum number of unacknowledged annotations (default: 299)
  • annotation -> poll_duration_ms: poll every x milliseconds for batching purposes (default: 300ms)
  • annotation -> max_match_size: maximum number of annotation per batch size (default: 299)
  • buffer -> in_memory: number of decoded frames to store in memory per camera (default: 1)
  • on_disk: true/false, store key-frame chunked mp4 files to disk (default: false)
  • on_disk_folder: path to the folder where segments will be stored
  • on_disk_clean_older_than: remove mp4 segments older than (default: 5m) A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as “300s”, or “2h45m”. Valid time units are “s”, “m”, “h”.
  • on_disk_schedule: run mp4 segment cleanup cron job #https://en.wikipedia.org/wiki/Cron

on_disk creates mp4 segments in format: "current_timestamp in ms"_"duration_in_ms".mp4. For example: 1600685088000_2000.mp4

What’s next?