Create time lapse video from other video

11,629

Solution 1

To take every 15th frame, use

ffmpeg -i in.mp4 -vf select='not(mod(n,15))',setpts=N/FRAME_RATE/TB out.mp4

Another method is to use the framestep filter

ffmpeg -i in.mp4 -vf framestep=15,setpts=N/FRAME_RATE/TB out.mp4

Solution 2

I had a H264 video from a camera and after lots of attempts found following command that produce 16x faster video with good result and 60 FPS (option -r) that is good for the YouTube timelapse

ffmpeg -i video.avi -r 60 -filter:v "setpts=0.0625*PTS" -vcodec libx264 -an timelapse.avi

You can check the result here https://www.youtube.com/watch?v=azhRqKQ7kCU

Since you are asking for 1/15 frame it will be 1/15 ~= 0.06667 with 30 FPS result video you will need command

ffmpeg -i video.avi -r 30 -filter:v "setpts=0.06667*PTS" -vcodec libx264 -an timelapse.avi
Share:
11,629
Orlando
Author by

Orlando

Updated on June 15, 2022

Comments

  • Orlando
    Orlando about 2 years

    Using avconv (or even ffmpeg, so I can use as a reference), how can I create a time lapse video by taking only anchor/reference frames from another video? Most information I find is on how to create a time lapse video by combining images, and I'd like to do it by extracting frames from a video. Say, if a video is 30 seconds long at 30 FPS, I'd like to take 60 out of those 900 frames (900/60 = every 15 seconds) to produce a 2 second video.