I conducted Pico workshop for University students (Vellore Institute of Technology, Vellore & the University of Petroleum & Energy Studies, Dehradun) back in October 2019 where I demonstrated Live Object detection and analytics using Docker, AWS Rekognition System and Apache Kafka. The whole idea of Pico project is to simplify object detection and analytics process using few bunch of Docker containers. A cluster of Raspberry Pi nodes installed at various location points are coupled with camera modules and sensors with motion detection activated on them. Docker containers running on these Raspberry Pis are able to convert these nodes into CCTV camera. After producing images of all these cameras, the real-time data are then consumed on any of the five containers because of the replication factor of Kafka. The camera captured video streams and processed by Apache Kafka. The data is consumed inside a different container which runs on all of these nodes. AWS Rekognition analyses the real time video data & searches object on screen against a collection of objects.
Time to go Cloudless..
Cloudless Computing is all about allowing your workloads, computing, and data free to roam around & run where-ever & whenever they need to. With the advent of powerful AI products like Jetson Nano, it is now possible to run Object detection and analytics locally. The Jetson Nano is built around a 64-bit quad-core Arm Cortex-A57 CPU running at 1.43GHz alongside a NVIDIA Maxwell GPU with 128 CUDA cores capable of 472 GFLOPs (FP16), and has 4GB of 64-bit LPDDR4 RAM onboard along with 16GB of eMMC storage and runs Linux for Tegra. The 70 × 45 mm module has a 260-pin SODIMM connector which breaks out interfaces including video, audio, USB, and networking, and allows it to be connected to a compatible carrier board. This board enables the development of millions of new small, low-cost, low-power AI systems. It opens new worlds of embedded IoT applications, including entry-level Network Video Recorders (NVRs), home robots, and intelligent gateways with full analytics capabilities.
For implementing Pico for On-Premises, I planned to use the below high-level architecture. RTMP Server, Nginx & Yolo framework running on 1 or more Jetson Nano whereas leveraging existing stack of Raspberry Pi for capturing the video frames.
Why I chose RTMP Server?
Real-Time Messaging Protocol (RTMP) is an open source protocol owned by Adobe that’s designed to stream audio and video by maintaining low latency connections. It is a TCP-based protocol designed to maintain low-latency connections for audio and video streaming. It is a protocol for streaming audio, video, and data over the Internet.
To increase the amount of data that can be smoothly transmitted, streams are split into smaller fragments called packets. RTMP also defines several virtual channels that work independently of each other for packets to be delivered on. This means that video and audio are delivered on separate channels simultaneously. Clients use a handshake to form a connection with an RTMP server which then allows users to stream video and audio. RTMP live streaming generally requires a media server and a content delivery network, but by leveraging StackPath EdgeCompute you can remove the need for a CDN and drastically reduce latency and costs.
Infrastructure Setup:
- Attach Raspberry Pi with Camera Module
- Turn Your Raspberry Pi into CCTV Camera
- Run RTMP + Nginx inside Docker container on Jetson Nano
- Run Yolo inside Docker container on Jetson Nano
Turn Your Raspberry Pi into CCTV Camera
Refer this link
How to run RTMP inside Docker Container on Jetson Nano
docker run -d -p 1935:1935 --name nginx-rtmp ajeetraina/nginx-rtmp-arm:latest
If you want to build the Docker Image from Dockerfile, follow the below steps:
git clone https://github.com/collabnix/pico
cd pico/rtmp/
docker build -t ajeetraina/nginx-rtmp-arm .
Testing RTMP with OBS Studio and VLC
This can be tested either on your laptop or Raspberry Pi(omxplayer).
Follow the below steps in case you have Windows Laptop with OBS Studo and VLC installed.
- Open OBS Studio
- Click the “Settings” button
- Go to the “Stream” section
- In “Stream Type” select “Custom Streaming Server”
- In the “URL” enter the rtmp://<ip_of_host>/live replacing <ip_of_host> with the IP of the host in which the container is running. For example: rtmp://192.168.0.30/live
- In the “Stream key” use a “key” that will be used later in the client URL to display that specific stream. For example: test
- Click the “OK” button
- In the section “Sources” click de “Add” button (+) and select a source (for example “Screen Capture”) and configure it as you need
- Click the “Start Streaming” button
- Open a VLC player (it also works in Raspberry Pi using omxplayer)
- Click in the “Media” menu
- Click in “Open Network Stream”
- Enter the URL from above as rtmp://<ip_of_host>/live/ replacing <ip_of_host> with the IP of the host in which the container is running and with the key you created in OBS Studio. For example: rtmp://192.168.0.30/live/test
- Click “Play”
- Now VLC should start playing whatever you are transmitting from OBS Studio
By now, you should have RTMP server up and configured. In my next post, I will show you how to run Yolo framework running inside Docker container. Stay tuned !
References:
Comments are closed.