1

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

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"
  • 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 '17 at 16:38
  • ffmpeg filters can't access video duration. It will have to be precomputed. – Gyan Apr 6 '17 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.