As the build continues I thought it would be interesting to experiment with creating timelapses of the process. There’s already a Hikvision Pan-Tilt-Zoom camera on site and wired up. This post looks at the current (rather string and glue) approach to creating timelapses.
I’m currently snapping a picture every two seconds [plus a bit of time for the next picture to be snapped] (call it 2.5 seconds).
This endlessly grabs a bunch of pictures and puts them into a ~/timelapse directory:
while true; do curl -sD - -o `date +'%F-%H-%M-%S'`.jpg http://<username>:<password>@camera01.imagilan/ISAPI/Streaming/channels/101/picture ; sleep 2 ; done
Then I generate a sorted list of files to pipe into ffmpeg’s concat muxer. It also allows me to select a single day of images.
find ~/timelapse/ -type f -newerct "5 Dec 2018 06:00:00" ! -newerct "5 Dec 2018 19:00:00" | sort -V | xargs -I {} echo "file '{}'" > ~/timelapse.list
Finally the heavy lifting compliments of ffmpeg: I found tha tit helps to specify the input and output framerate (input framerate is an odd idea since it’s just a bunch of frames). Without doing this I ran into a bunch of issues where ffmpeg was complaining about duplicated frames.
ffmpeg -f concat -r 15 -safe 0 -i ~/timelapse.list -c:v libx264 -s hd1080 -preset slow -crf 21 -pix_fmt yuv420p -movflags faststart -r 15 /srv/video/netcams/archive/timelapse/2018-12-05-15fps.mkv
And here’s the output at 30 fps and 15fos:
15fps seems about the right speed.
30 FPS – probably too fast.