Creating timelapse with basic video processing using ffmpeg

Key idea of time-lapse is to take a series of photos in regular intervals with a fixed settings and field of view. I have a Cannon 600D (T3i) which is apparently most popular DSLR ever (probably because neither too basic nor too expensive). This doesn't really have any built in feature where I could take series of photos automatically at a fixed interval. I had recently installed magic lantern firmware which has some cool additional features like intervalometer 





The Yi Action camera that I have also has feature built in to take time-lapse. In "Video Timelapse" mode it automatically stitches the photos taken in the specified interval and we get the video as output. However in this mode we don't really have much control the setting of the photos like exposure and shutter speed. These settings are critical for night sky or low light areas. So the other mode called "photo time-lapse" is the right choice here. In this mode you get the JPEG or RAW photos straight out of the action camera and stitch it yourself to make a video.

To stitch the photos to make video we can use simple yet very powerful ffmpeg command like utility.

We may want to edit the photo in a tool like gimp before stitching to enhance them. probably in a batch as time-lapse involves a lot of photos.

To create video out of the all the photo files in a directory, the following command can be used.

ffmpeg -r 5 -pattern_type glob -i '*.JPG'  -s hd1080 -pix_fmt yuv420p -vcodec libx264 -crf 18 -preset slow timelapse.mp4


Note - I kept the frame rate to be only 5 tough usual frame rate of any video os 30fps or 60fps. In such fps our time-lapse will be extremely short , probably a second long and nothing really will be visible.


If the individual photos were tilted and not really straightened using gimp or any other photo editor then ffmpeg can be used for that. I found neither iMovie or any other free online tool could do rotation other than multiples of 90 degree.

ffmpeg -i timelapse.mp4 -vf “rotate=-6*PI/180” out.mp4

Similarly, if the images were not cropped to only the area of interest , the whole video can be done afterwards using ffmpeg like as follows. I prefer not doing it at the photos level just in case they get misaligned.


ffmpeg -i out.mp4 -filter:v "crop=in_w/2:in_h/1.7:in_w/20:in_h/5" -c:a copy out1.mp4


Finally we can trim the video and see the preview.

ffmpeg -ss 00:00:00.5 -i out1.mp4  -c copy VideoClip.mp4


ffplay VideoClip.mp4