2

I'm trying to extract x seconds from every minute and produce a video.

For example: from a 6 minute video, I want to take the 1st second from the 1st minute, then the 1st second from the 2nd minute etc. (or more clearly, take 00:00:01, 00:01:01, 00:02:01 ...) and construct a new video.

1 Answer 1

4

Use

ffmpeg -i in.mp4 -vf "select='lt(mod(t,60),1)',setpts=N/FRAME_RATE/TB" out.mp4

If audio's also present, add

-af "aselect='lt(mod(t,60),1)',asetpts=N/SR/TB"
3
  • One more question: how can i make it dynamic. For example: if i have 120 seconds video and produce a 30 second video. 120/30 = 4 which means to create video from every 4th second? I m trying something like this lt(mod(t,VIDEO_LENGTH_IN_SECONDS/30),1) but not sure whats the variable name for the length
    – gigot
    Apr 6, 2017 at 16:38
  • ffmpeg filters can't access video duration. It will have to be precomputed.
    – Gyan
    Apr 6, 2017 at 18:38
  • Is it possible to run this comando faster maybe by using -ss lt(mod(t,60),1) or something like this? Aug 31, 2022 at 16:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .