Three ways to shoot time-lapse videos from an ESP32 based camera system such as the ESP32-Cam and the ESP-EYE
Before following this tutorial make sure your camera and Arduino IDE are set up correctly by following this tutorial Ai-Thinker ESP32-CAM in the Arduino IDE
Paste the script above into a new Sketch and upload it to your device. Reset the device, look for the IP address in the Serial Monitor and connect to that IP address with your browser.
You can speed up or slow down the speed of the capture using the slider during the process. When the capture has completed use the ‘Save page as’ menu or Ctrl+s to save the images.
This method doesn’t work it you want to capture thousands of frames because the browser won’t save everything if there are too many images.
Capture to the SD Card
The Ai-Thinker has a built-in Micro-SD card reader. This Sketch captures an image at the interval set in the Sketch and saves it to the SD card. If there is an available internet connection the Sketch retrieves the time from the internet and uses this in the filename. If there is no connection, files are named numerically. Be aware that without internet, if the device restarts it will begin overwriting existing files.
The card must be formatted to FAT32 and be 4GB or less. For some reason the ‘flash’ LED on the front is connected to one of the SD card pins so it glows brightly every time a file is written. I ended up putting black tape over it.
Upload a Capture to a Server
This the most complicated approach but once working, it’s the easiest to manage and keep an eye on progress. Every time an image is captured it is sent to a server via http POST for saving. This would make an ideal solution for an online web cam.
Some simple PHP to name and copy the uploaded image to a folder (don’t forget to add the opening <?php tag):
$received = file_get_contents('php://input'); $fileToWrite = "timelapse/upload - ".time().".jpg"; file_put_contents($fileToWrite, $received);
Making the time-lapse video
This is the easiest to follow guide I found to make the time-lapse video from your images: https://www.youtube.com/watch?v=JwF6I0iLGS4
Time formatting: http://www.cplusplus.com/reference/ctime/strftime/
Code for SD card: https://github.com/espressif/esp-idf/tree/master/examples/storage/sd_card
Tips for making time-lapse videos: http://www.enriquepacheco.com/10-tips-for-shooting-time-lapse/
If you liked this tutorial and want me to create more then please say thanks by buying me a coffee here...