2,704 views

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.

My Image

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:

https://github.com/collabnix/pico

Clap

Categories: Docker

Ajeet Raina

My name is Ajeet Singh Raina and I am an author of this blogging site. I am a Docker Captain, ARM Innovator & Docker Bangalore Community Leader. I bagged 2 special awards last year(2019) : Firstly, “The Tip of Captain’s Hat Award” at Dockercon 2019, San Francisco and secondly, “2019 Docker Community Award“. I run Collabnix Community Slack with over 4700+ audience as well as Redis Community Slack with close to 500+ members. I have built popular GITHUB repositories like DockerLabs, KubeLabs, Kubetools, RedisPlanet Terraform etc. with the support of Collabnix Community. Currently working as Developer Relations Manager at Redis Labs where I help customers and community members adopt Redis. With over 11,000+ followers over LinkedIn & close to 4800+ twitter followers, I like sharing Docker and Kubernetes related content . You can follow me on Twitter(@ajeetsraina) & GitHub(@ajeetraina)

1 Comment

Object Detection with Yolo Made Simple using Docker on NVIDIA Jetson Nano – Collabnix · 10th January 2020 at 11:54 pm

[…] Pico goes Cloudless: Running RTMP & Nginx for Video Streaming using Docker on Jetson Nano local… Multi-Node K3s Cluster on NVIDIA Jetson Nano in 5 Minutes Docker 19.03 comes to NVIDIA Jetson Nano […]

Leave a Reply to Object Detection with Yolo Made Simple using Docker on NVIDIA Jetson Nano – Collabnix Cancel reply

Your e-mail address will not be published. Required fields are marked *