Hi all (long time no see!). It’s the end of the year and I had the (maybe) neat idea of making a “timelapse” of every photo I took in 2019. The workflow had to be exclusively FOSS, of course!
So, after some fiddling around, here’s what I came up with:
Notes:
I used ffmpeg to do this, using the following bit of code:
# First recursively search for all jpegs in the current directory, and all lower directories, and writeout a text file that ffmpeg can parse with the concat demuxer.
# IMPORTANT! Make sure to set duration to match output framerate or frames will be dropped!!
find . | grep "\.jpg$" | sort -V | xargs -I {} echo -e "file '{}'\nduration 0.06" > list.txt
# Now use that list of images in ffmpeg to compile the timelapse.
# IMPORTANT: -framerate sets the output framerate, and should match the duration used above or frames will be dropped!
# Output movie will be rendered at input aspect ratio, but rescaled to 1080 height. If images are different aspect ratio, then they will all be scaled to same height (I think)
ffmpeg -f concat -safe 0 -i list.txt -c:v libx264 -framerate 0.06 -crf 18 -preset slow -pix_fmt yuv420p -vf scale=-1:1080 tlapse.mp4
# lower quality but faster render:
## ffmpeg -f concat -safe 0 -i list.txt -c:v libx264 -framerate 0.06 -pix_fmt yuv420p -vf scale=-1:1080 tlapse.mp4
# Or try with hardware acceleration for fastest render
## ffmpeg -vaapi_device /dev/dri/renderD128 -f concat -safe 0 -i list.txt -vf scale=-1:1080 'format=nv12,hwupload' -c:v h264_vaapi -framerate 0.06 tlapse.mkv
# Add an audio track if you have one. Make sure it's at least as long as the final video!
ffmpeg -i tlapse.mp4 -i audio_track.mp3 -codec copy -shortest final_tlapse.mp4
I am using concat instead of reading in with glob because I use RapidPhotoDownloader and all my photos are organized in the default directory structure of YEAR>DAY>PHOTO, so I need to recursively traverse the directories and assemble the files in chronological order.
Probably rotation issues could be tackled by adding a pipe through exiftool, but I didn’t feel like messing with it. All my photos are shot at 4:3 aspect ratio, so I figured let’s just keep it that way.
Because I mixed images across all my cameras (two Olympus bodies and my Moto Z), I had to remove a lot of crufty images (things I sold on craigslist, reciepts, etc.). I just did that by hand, but it was annoying to see how many dumb photos I took of that kind of stuff, lol!
If I still used darktable to catalog my photos, probably the best way would be the built in timelapse function which would have dealt with the rotation (I think). But, I am a busy dad of a toddler now (as you can see!), so I haven’t really been doing much raw editing (or any editing at all). So, straight from the jpegs it was!
Finally, the music is a track by Montplaisir called “Stage1Level24,” released in the public domain: Free Music Archive: Monplaisir