This script simulates infinite number of volume key press with a given interval to issue camera shutter on android devices. I use this to make timelapse using several photos over a long time with the default camera app or Gcam.
Once you gather all the photos, you can use this tutorial to make a video out of them.
You need to have busybox installed. Copy the script to you phone. Start Termux or any other terminal emulator app and run
sh timeLapseKeySimulator.sh
Depending on your android version/settings, you may need to have root access to be able to issue key events
su
sh timeLapseKeySimulator.sh