../creating-timelapse-videos-on-linux

Creating timelapse videos on linux

Assembly Process (slight commenting)

Tools used:

Sorting input images

ffmpeg expects the input images to have incremental  numbers without offset. so one can get them in this format with whatever tool of choice. gqview e.g. allows series renaming and would do that job fine. or just use the cmdline(shell + perl) like i did:

cd ~/inputfiles; mkdir order;find . -maxdepth 1 -iname "*.jpg" | sort | perl -MFile::Copy -ne 'BEGIN{$i = 0};chomp;copy($_, "order/".sprintf("img_%04d.jpg", $i)); $i++'

~inputfiles/order/ now holds images as ffmpeg expects them.

Creating the timelapse

ffmpeg -i /inputfiles/order/img_%04d.jpg -r 25 -s 1280x960 -vcodec libx264 -b:v 30000k Flapse_25fps.mp4

now, this creates a timelapse video of 25 frames per second. this might fit well in a lot of situations. but in my case the timelapse seemed to be a bit to fast rushing by.

Using mencoder to slow it down

mencoder -speed 0.5 -ofps 25 -ovc copy Flapse_25fps.mp4 -o slow.mp4

play with the -speed value a bit.

once i was satisfied with the result i pushed slow.mp4 into a kdenlive project, added some music, fade in/out effects and rendered to mp4. note to myself: investigate further on how this step be done with ffmpeg/(cmdl)

Converting for online playback

For my embedded wordpress player i wanted to resize the video, lower the bitrate and create streaming compatible metadata:

MP4

ffmpeg -i slow_and_audio.mp4 -strict experimental -vcodec libx264 -acodec aac -b:v 1500k -b:a 128k -s 640x480 slow_and_audio_resized.mp4
MP4Box -inter 500 slow_and_audio_resized.mp4 -out final.mp4

WEBM

ffmpeg -i slow_and_audio.mp4 -acodec libvorbis -b:v 1000k -b:a 128k slow_and_audio_resized.webm

OGV

ffmpeg -i slow_and_audio.mp4 -acodec libvorbis -b:v 1000k -b:a 128k  slow_and_audio_resized.ogv