How to Create a Time Lapse Video using FFMPEG
Since I just got my TV tuner card less then a week ago, I have been learning a thing or two on some video file manipulation. Creating a time lapse was something I wanted to create from my storm chasing video, and this was how I did it.
The shell script below should be saved as time-lapse.sh if you decide to save it. The script must take three (3) parameters. The first one is the input file. The second one is the output file, and the third is the framerate. The lower the framerate, the faster the time lapse. Line 10 takes every ‘n’ frames per second from the video and saves them in a temporary folder in png format. Then, line 11 takes those png images, and converts it back into a video – without sound, and sped up. Easy, yes?
1 2 3 4 5 6 7 8 9 10 11 12 | #!/bin/bash # Description: make time lapse video # Usage: time-lapse.sh <source-video> <destination-file> <frames> # Source Video: the video that you are wanting to speed up # Destination File: the file where the video will be saved # Frames: the number of frames to pull per second (1 will speed it up the most, 10 will be slower) mkdir ffmpeg_temp ffmpeg -i $1 -r $3 -f image2 ffmpeg_temp/%05d.png ffmpeg -i ffmpeg_temp/%05d.png -b 512 $2 rm -rf ./ffmpeg_temp |
I am working on a Nautilus script, so it can show up in a popup menu, but I don’t have that mastered as of yet, so stay tuned. I will post it later.
This entry was posted on Thursday, July 5th, 2007 at 7:15 am and is filed under Linux. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Andrew Wells October 23rd, 2007 at 7:03 pm
I was not able to find a solution in Windows myself. Thanks for your tip on converting to .avi. I usually just use mpegs because that’s what my TV tuner uses by default.