2

I went through this guide and found that below commands should give maximum of image-000.jpg to image-999.jpg

ffmpeg -i video.webm -vf fps=1 image-%03d.png

But after reaching image-999.jpg, ffmpeg keeps on creating 1000, 1001, ... 99999.jpg,

I tried with VLC, but VLC as well gives millions of images.

The problem: we work on the last 100 images at any instant. So to create images, we use ffmpeg. But this creates a lot of images, after time moves, so I have to delete older images as disk usage will increase.

Excellll
  • 12,627
  • 11
  • 51
  • 78
vijayky88
  • 23
  • 5
  • You mean last 2000 frames, or last 100? Or do you want the first *x* frames only? – slhck May 24 '18 at 10:38
  • last 100 frames or last 2000 frames or last 999 frame any things are fine – vijayky88 May 24 '18 at 10:39
  • 1
    Easy solution would be to seek in the video with `ffmpeg -ss 00:01:23 …` and start from that as an offset. Then you only get the "remaining" frames. But it's not very exact unless you know the particular start time of the frame from which you want to cut. – slhck May 24 '18 at 10:42
  • Or see the commands in this question: https://superuser.com/questions/866144/cutting-videos-at-exact-frames-with-ffmpeg-select-filter – slhck May 24 '18 at 10:45
  • Thansk slhck for your attempt ! basically input here is rtsp live stream. and i wanted to get the last 100 frame decoded into my files always. so seeking is not a solution. – vijayky88 May 24 '18 at 10:49
  • You did not say that your input was a live stream – that would have been good to know. – slhck May 24 '18 at 12:41

1 Answers1

1

You can try this:

ffmpeg -i input -q:v 3 -f segment -segment_format mjpeg -segment_wrap 100 -segment_time 0.001 out%d.jpg

This will limit output to 100 files but it will reuse filenames, so you'll have to order files by time last modified to know the order of the last 100 frames.

Gyan
  • 34,439
  • 6
  • 56
  • 98