Creating a Time-Lapse Video Through the Command-Line (Using FFmpeg)

I tried creating a time-lapse video without using any video editing applications and would like to share my learnings. I found FFmpeg to be powerful — it can crop, trim, join videos, fade, add audio and even add moving zoom and pan effects.

First things first, here’s one of the videos I created using FFmpeg:

Image for post
Image for post

First step — a quick and dirty time-lapse

ffmpeg -framerate 30 -pattern_type glob -i "folder-with-photos/*.JPG" -s:v 1440x1080 -c:v libx264 -crf 17 -pix_fmt yuv420p my-timelapse.mp4

Video codecs and formats

H264 and ProRes

ffmpeg -framerate 30 -pattern_type glob -i "folder-with-photos/*.JPG" -s:v 1440x1080 -c:v prores -profile:v 3 -pix_fmt yuv422p10

Workflow and usages of codecs


Processing the video

Change speed

ffmpeg -i input.mp4 -filter:v "setpts=0.5*PTS" output.mp4


ffmpeg -i input.mp4 -filter:v "crop:1920:1080:100:50" output.mp4


ffmpeg -i input.mp4 -ss 6.5 -t 15.44 output.mp4

Joining multiple videos

file 'path/to/video-1.mp4'
file 'path/to/video-2.mp4'
ffmpeg -f concat -safe 0 -i mylist.txt -c copy concat-video.mp4


ffmpeg -i input.mp4 -filter:v "fade=t=in:st=0:d=0.5" output.mp4
ffprobe -show_format input.mp4
ffmpeg -i input.mp4 -filter:v "fade=t=out:st=45.177:d=0.5" output.mp4

Combining filters

ffmpeg -i input.mp4 -filter:v "crop:1920:1080:100:50,fade=t=in:st=0:d=0.5,fade=t=out:st=45.177:d=0.5" output.mp4

Adding an audio track

ffmpeg -i input.mp4 -i my-audio.m4a -c copy -map 0:v:0 -map 1:a:0 -shortest output.mp4
ffmpeg -i input-with-audio.mp4 -filter:a "afade=t=in:st=0:d=0.5" output.mp4


ffmpeg -i input.mp4 -filter:v "zoompan=z=1.1:d=1:x='px+0.5':y='ih/2-(ih/zoom/2)':s=2560x1920:fps=30" output.mp4
ffmpeg -i input.mp4 -filter:v “zoompan=z='if(lte(in,1),1.2,max(pzoom-0.0001,1))’:d=1:x=’iw/2-(iw/zoom/2)’:y=’ih/2-(ih/zoom/2)’:s=2560x1920:fps=30" output.mp4



Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store