Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create time lapse video from other video

Tags:

ffmpeg

avconv

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.

like image 750
Orlando Avatar asked Jan 27 '17 20:01

Orlando


People also ask

Can you turn an existing video into a time-lapse?

You can convert a video into time lapse simply by using the speeding up feature. FlexClip is a free time lapse video maker online which helps you change video speed easily. Upload the video clip, select the video speed, then upload, you can get a time lapse video. The whole process is easy and simple.

Can you turn a regular video into a timelapse on iPhone?

If you accidentally recorded a regular video instead of a time-lapse video, or you want a time-lapse version of a video you've already taken, you can time-lapse any video on your iPhone using the iMovie app. While you can time-lapse a video using iMovie, it can only double the speed of your video.

Can you create a time-lapse video with photos?

There are two main techniques for making a time lapse video: you can either speed up video footage in post or piece together still photos.


2 Answers

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
like image 53
Gyan Avatar answered Oct 08 '22 04:10

Gyan


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
like image 7
Kiryl Avatar answered Oct 08 '22 02:10

Kiryl