Thomas
Thomas

Reputation: 12087

Trying to limit output of ffmpeg

I have the following command line:

ffmpeg -hide_banner -ss 5 -i test.mp4 -y -vf "select='eq(pict_type\,PICT_TYPE_I)', mpdecimate,showinfo,scale=320:240,tile=12x25" -vsync 2 out%%03d.png

As you can see, I make a mosaic of 12x25 (=300) tiles per output image. But I'd like to cap the output to a single image.

Is there a way to have ffmpeg stop processing the video after it found 300 frames?

Additionally, when grabbin the I-frames, is there a way to just keep 1/x for example

After playing with different options, I couldn't find any way to do this.

Upvotes: 0

Views: 303

Answers (1)

Gyan
Gyan

Reputation: 92928

Use

ffmpeg -hide_banner -ss 5 -skip_frame nokey -i test.mp4 -y -vf "framestep=7,mpdecimate,showinfo,scale=320:240,tile=12x25" -vsync 0 -vframes 1 out.png

framestep value sets x in 1/x. You probably don't need mpdecimate if you're skipping x-1 keyframes. I've added -skip_frame nokey to avoid using the select filter. This method is much faster.

Upvotes: 1

Related Questions