FFMpeg Time Lapse and Slow Motion
Interpolation doesn’t just slow down, speed up, or increases FPS for better overall appearance.
It fills in the gaps between frames by mathematically guessing were pixels belong between each frame. Here is a source clip that I’ll be processing.
This command increases a 18 second segment from 30 FPS to 120 FPS
ffmpeg -ss 00:47:08 -i 201207140948.MOV -t 00:00:18 -c copy 201207140948_Seg.MOV ffmpeg -i 201207140948_Seg.MOV -vf minterpolate=fps=120 201207140948_Seg_120fps.MOV
The results look the same at first glance, but when viewed intently, there are details not available in the original. The video looks more live. However, uploading it to the internet introduces some losses, so you’ll just have to take my word for it.
Now, lets slow motion it down so it runs 1/4th the original speed (thanks http://blog.grio.com/2012/01/fast-and-slow-motion-video-with-ffmpeg.html and https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video)
ffmpeg -i 201207140948_Seg_120fps.MOV -vf setpts=4*PTS -an 201207140948_Seg_30fps.MOV
Here you can see some of the artifacts introduced with the interpolation. If we were to slow down the original, we would notice the motion gaps between each frame captured by the camera. This allows us to electronically make up the missing frames and create a more smooth appearance.
Now lets speed things up so the entire 1 hour 10 minute video runs for 15 seconds. The PTS variable is multiplied by a fraction of the original, 70 minutes or 4200 second clip. Since I want to end up with 15 seconds as a result I divide the 4200/15 to get my 280 value below. This is basiclly saying make my output 1/280 the length of the original.
ffmpeg -i 201207140948.MOV -vf setpts=1/280*PTS -an 201207140948_RealFast.MOV
FFMPeg’s interpolation feature make it a contender against other commercial products I’ve used in the past. The scripting function and community support put it out ahead.