View Single Post
turtle
Lord of the Rant.
Formerly turtle2472
 
Join Date: Mar 2005
Location: Upstate South Carolina
 
2020-09-22, 13:59

I'm looking to build a time lapse builder that is only using CLI. At this point I wget a URL once per minute via crontab. This the most frequent you can do without any convoluted steps and multiple of the same cron job.

So the command to get the image is:
Code:
wget -q https://camera.ip/snap.jpg -O /var/services/homes/turtle/flexImages/`date +%Y%m%d_%H%M%S`.jpg
This does a "quiet" grab of the image from the URL and saves it to the specified location with the specified name, 20200921_235903.jpg as an example.

This gives me a set of images that can easily be sorted. On 1080p these are between 100k - 350k in size that I've observed so far, but I'm sure that will vary heavily with the camera source.

To do the stitching I use the tried and true ffmpeg. Right now I'm using this, but it is barking at me about deprecated pixel format I haven't searched out yet:
Code:
ffmpeg -r 24 -pattern_type glob -i '*.jpg' -vcodec libx264 -pix_fmt yuv420p /volume1/video/tmp/`date +%Y%m%d`_timelapse.mp4
This goes through the list of files ending in ".jpg" and stitches them together in a 1080p video. By default it is grabbing them in sequence.

The thing I'm working through now is making it so it does one day at a time. I'm thinking I'm going to save 7 days worth of images to be able to build a "mega time lapse" but have one video per day. Right now I can pull through the file list and only grab yesterday's images with "find" but this doesn't work on macOS. It has to do with the difference between BSD and GNU builds for "find" and BSD doesn't support -daystart.
Code:
find /var/services/homes/turtle/flexImages/ -daystart -mtime 1 -ls
Of course, this is a method to list out the images but not really pipe them into ffmpeg. My thought was to move each day's images into their own dated folder (ie, 20200921, 20200922, etc.). Use the above find but with mv instead. Then I get into the run of properly naming a folder for the past etc.

The more I'm thinking about this I think I want to just leave the images in a single folder and have ffmpeg pull them from there. Now I need to figure out how to feed only selected images into ffmpeg like with a for loop or something like that. I also need to make the ffmpeg output silent so it doesn't fill logs with stuff I don't need.

Anyway, the whole point of this is to be able to have cool time lapses of the weather/sky. Mine is going to be for my personal camera, but you can always apply it to something you find at Insecam.

Anyone have any ideas on how to handle just the images from the day before? Since it's going to be scripted I can make a cron executed script that runs after midnight each day. While I could build this as an all encompassing script, I think I'll have it run a a few different for the same of simplicity. One example being the gap command is not even a script but a single command in the cron. I am also running all of this on my NAS since it seems the most compatible for the work and also provides the storage I need.

Louis L'Amour, “To make democracy work, we must be a nation of participants, not simply observers. One who does not vote has no right to complain.”
Visit our archived Minecraft world! | Maybe someday I'll proof read, until then deal with it.
  quote