I am working on a web app using Django on the server side and I'd like to stream from the camera to the browser. I already tried methods like HLS with the ffmpeg segment muxer, but with such methods I don't have the full control over the stream. So I thought about sending the video manually over a websocket and then playing it with Media Source Extensions.
On the server side I use UV4L and OpenCV to capture the video, but I found no good way of writing a segment over a websocket, because OpenCV only writes the data to a file. The only possible solution I found involves some changes to OpenCV itself.
Does anyone know an alternative or how to do this?
Here's a minimalistic example that uses in-memory Redis key-value store. The Redis database is an intermediary between continuous camera capture process and a Tornado web server:
https://github.com/vmlaker/hello-websocket