DEV Community

Artyom Kozyrev
Artyom Kozyrev

Posted on

Real Time Video Stream Server based on AIOHTTP, OpenCV and ECMA6 JS

Hello, this is my new side project — Real Time Video Stream Server.

Demo

The source code is available in the link below: https://github.com/ArtyomKozyrev8/stream_video_server

The application is composed of two services: 1. http server 2. video processing process 3. Optionally Nginx

HTTP Server:

It listens for incoming websocket connections from video processing processes, gets video frames from the connections and distribute them to Asyncio Queues which are associated with incoming websocket connections from clients (web browsers), then tasks which are associated with the clients get data from the queues and send data to client browser.

In addition HTTP Server Process notifies Video Processing Process when it wants to receive data, since there is no need to send video frame when no clients (web browser) watch the video stream.

Video Processing Process:

It handles web camera or RTSP stream, gets frames from the stream, add timestamps, resize frame and send it HTTP Server Process.

Limitations of the Solution:

It can have only one HTTP server Process simultaneously, you can have more HTTP server Processes, but you can get some unexpected results. I am going to overcome the issue using message queue like NATS and write about it in next article.

Top comments (0)