The ESP32, while first thought to be little more than a way of adding wireless capabilities to other microcontrollers, has quickly replaced many of them with its ability to be programmed as its own platform rather than simply an accessory. This also paved the way for accessories of its own, such as various sensors and even a camera. This guide goes over taking the input from the camera and streaming it out over the network to multiple browsers.
On the server side of things, the ESP32 and its attached camera are set up with MQTT, a lightweight communications protocol which uses a publish/subscribe model to send information. The ESP32 is configured to publish its images only, but not subscribe to any other nodes. On the client side, the browser runs a JavaScript program which is able to gather these images and stitch them together into a video.
This can be quite a bit of data to send out over the ESP32’s compact hardware, so there are some tips and tricks for getting more out of these little devices, including using an external antenna for better Wi-Fi signal, or omitting it entirely in favor of Ethernet. As far as getting a lot out of a tiny microcontroller, though, leveraging MQTT really helps the ESP32 go a long way. These chips have come along way since they were first introduced; they’re powerful enough to act as 8-bit gaming consoles too.
Thanks to [Surfskidude] for the tip!
I love that this code is entirely written in Lua!
I hate lua. It’s just awful.
This can be said and has been said about all programming languages.
Not really. Just lua and Java.
Why do you hate Lua and Java?
Good for you, I love lua its so flexible
The example code that comes with the ESP32cam arduino library does basically this.
More like a slide show than actual video..
I don’t think the ESP32 was ever thought of in the terms described in the opening. The ESP8266 might have been early on. Very inaccurate information.
Not to detract from this, but Tasmota also does this (with a specialised build). The stability in my case wasn’t perfect, but that might be my cheap module or crappy wifi.
I did not think that MQTT can transport video, I used it only for small data transport in my tests.
This immediately reminded me of my Video Player which can be synchronized via MQTT:
https://github.com/steveway/MQTT-Sync-Player