Note: When I imported these .mp4 videos into Final Cut Pro, the audio wasn’t working on them. Audio would play fine in QuickTime Player. To fix the problem, when encoding, I used the “mov” extension instead of “mp4”.
Amcrest UltraHD 5MP POE Bullet IP Security Camera* (Amazon Affiliate) US: https://amzn.to/39CjeFg *This camera is similar to the one used in the video.
A RAM disk is created to store the images. This reduces wear on the computer’s SSD or hard drive. The RAM disk size is 2048 * megabytes. 409600 is 200MB.
Create Image Download Script
nano rollingtimelapse.sh
#!/bin/bash
url=http://username:password@ip_address/cgi-bin/snapshot.cgi
fps=60
tl_length=5
image_count=$((fps*tl_length))
function download_image {
# This loops until an image is saved as temp. This prevents the saving of empty image files. "temp" purposefully doesn't have an extension so it doesn't get picked up by ffmpeg.
until [ -s "temp" ]
do
curl --digest -o "temp" $url
done
# "temp" is renamed to the current file
mv "temp" $1
echo $1
}
# Download image once and copy it image_count number of times to preload the image set
download_image `printf "%003d.jpg" 1`
for ((i=1; i<=image_count; i++)); do
cp -v `printf "%003d.jpg" 1` `printf "%003d.jpg" $i`
done
# Continually download images in a loop
#initialsize the image_number
image_number=1
while :
do
# Reset image number when it is greater than image count
if [ $image_number -gt $image_count ]
then
image_number=1
fi
# current_file is padded with 2 zeros to help with ordering in file system
current_file=`printf "%003d.jpg" $image_number`
download_image $current_file;
image_number=$((image_number+1))
sleep $tl_length
done