3

I have a video and I want to extract every 10th frame as I am getting way too many images.

ffmpeg -i out1.avi -r 1 -f image2 image-%3d.jpeg

How to extract images from video file?

  • usually video has at least 25 frames per seconds - so using `-r 1` you get image every `25th` frame. If you want to get every `10th` then you will have even more images. – furas May 02 '21 at 03:00
  • No i should have less images because i am only getting 1/10 of the batch @furas – Julien Tremblay McLellan May 02 '21 at 03:06
  • you means every 10th image from images generated by this code - not every 10th frame from video. Use `-r 0.1` – furas May 02 '21 at 03:29

1 Answers1

7

If you want 1/10 of what you have now (when you use -r 1) then use

 -r 0.1

It will get 1 frame every 10 seconds instead of 1 frame every 1 second.

 ffmpeg -i out1.avi -r 0.1 -f image2 image-%3d.jpeg

EDIT:

If you really what every 10th frame from video then you can use select with modulo 10

ffmpeg -i out1.mp4 -vf "select=not(mod(n\,10))" -vsync vfr image_%03d.jpg

but it may gives more images than before.

If video has 25fps then -r 1 gives image every 25th frame. And if video has 60fps then gives image every 60th frame. So it gives less images then this code which get image every 10th frame.

furas
  • 229
  • 1
  • 6