FFmpeg: Timelapse from Video, Speed Up vs Every n-th Frame

I go over two techniques in FFmpeg to turn a long video into a “timelapse”. One is to speed up the video. The second is to take every n-th frame of video. The second method simulates a traditional timelapse where you record a series of photos. I go over the pros and cons of each technique.

FFmpeg playlist: https://www.youtube.com/playlist?list=PLErU2HjQZ_ZOPDZ71Khzt5PX4X4j6flkg

Speed Up Video 500x
ffmpeg -i sky.mp4 -vf "setpts=0.002*PTS,crop=in_w:in_w*9/16,scale=1920:1080" -vcodec libx264 -b:v 10000k -r 60 -pix_fmt yuv420p sky_speedier.mp4
Time to Execute (using hardware acceleration on Mac)
real	19m49.420s
user	52m21.576s
sys	0m14.403s
External Link: Speed up video

https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video

Use every 500th Frame
ffmpeg -i sky.mp4 -vf "select='not(mod(n,500))',setpts=N/FRAME_RATE/TB,crop=in_w:in_w*9/16,scale=1920:1080" -vcodec libx264 -b:v 10000k -r 60 -pix_fmt yuv420p sky_virtual_timelapse.mp4
Time to Execute (using hardware acceleration on Mac)
real	11m21.001s
user	42m2.315s
sys	0m21.926s
External Link: Create timelapse from video

https://stackoverflow.com/questions/41902160/create-time-lapse-video-from-other-video

Use Hardware Encoding on Mac
Change libx264 to h264_videotoolbox
Use Hardware Encoding on Windows (Intel processor, QuickSync)
Change libx264 to h264_qsv

Leave a comment

Your email address will not be published. Required fields are marked *