[FFmpeg-user] Extracting I P B frames from a mpg video
barsnick at gmx.net
Mon Jan 5 11:25:36 CET 2015
On Sun, Jan 04, 2015 at 23:46:26 -0800, Rohit wrote:
> ffmpeg -i delta.mpg -vf select="eq(pict_type\,PICT_TYPE_I)" -s 400x300 -f image2 frame.mpg-%03d.tif
You should always show us the complete, uncut output of your command.
> which should extract all the I frames(as per -vf
> select="eq(pict_type\,PICT_TYPE_I)" ) in the input file. But I got 197
> frames instead of 17 from this command and it looked like command has just
> shown me all the frames.
There's a Wiki entry covering this:
And though it doesn't explain why, it does hint that you need to use:
This works for me.
I believe the image2 muxer automatically assumes the same frame rate as
the input (i.e. automatically chooses "-vsync cfr"). Since you are
dropping all none-I-frames, it interpolates the missing frames to
produce the correct rate. BTW, I get less frames than the (my) source
video, because the muxers stops creating output at the last input
Another BTW: The value PICT_TYPE_I, which is also used in the Wiki
entry, does not correspond to the documentation which says:
> ‘pict_type (video only)’
> The type of the filtered frame. It can assume one of the following values:
But the source (libavfilter/f_select.c) tells me that the prefix
PICT_TYPE_ is also accepted.
More information about the ffmpeg-user