[FFmpeg-user] Extract all keyframes

Matthew Bondy bondy1z at uwindsor.ca
Mon Jun 30 05:01:31 CEST 2014


>
> > My question: When I do not specify the frame rate
> > I assume ffmpeg uses some default (20, 25?).
>
> This is (at least generally) not true.
>
> What happens if you run:
> ffmpeg -i yourinput -qscale 2 out.avi
> ?
> Please provide your command, the console output
> and explain what is wrong if you don't specify
> "-r".
>
> I do not have direct evidence of this but I believe on one workstation I
have been using the frame rate is not automatically set to 20 or 25 (it is
the correct native frame rate for the input file) and on another
workstation the frame rate is certainly set to some default value internal
to ffmpeg (20 or 25)*. I have been using this second workstation more
(especially recently) as it is much more powerful. When I specify a frame
rate (see my input command below) the number of frames extracted is reduced
significantly (i.e. the number of bitmap files). The two workstations may
have different versions of ffmpeg (may even be two workstations + my
laptop, all three might have different version of ffmpeg - however, I have
to some degree wised up and now only use the one machine with whatever
version of ffmpeg is already installed).

My command(s):
ffmpeg -i my_input_file.avi -r 17 -f image2 image%4d.bmp
or (before I started specifying a frame rate of 17 fps):
ffmpeg -i my_input_file.avi -f image2 image%4d.bmp4

I have never tried removing image2 and I have no idea what it does. I did
try to google this before and made no headway.

The first command (where the frame rate is specified) works quite well.
However, there are more frames than I expect (given the resolution, 8bit
gray scale, and the file size there should only be so many frames, I would
expect to see fewer and not more given the presence of a header, etc.). The
excess number of frames is within a few frames of the number of duplicate
frames indicated on the command line as ffmpeg runs. At this point all I
need to do is figure out how to get rid of those duplicate frames. It is
not a larger number anyways. For the time being I can live with it but
eventually I may apply the same techniques with high loading rates (impact
experiments). It is possible the percent error in terms of synchronization
of data will be similar but it certainly seems possible this issue will
become worse.

*This was especially maddening and had me tearing my hair out. Where is the
source of error? The optical strain measurement system? My MATLAB/Octave
scripts for post-processing of data? The digital image correlation
software? ffmpeg? Nothing seemed to make sense since the problem was
sporadic. I now believe the problem was the use of different versions of
ffmpeg on different PCs. Certainly with the same file and specifying (or
not) the frame rate the number of frames extracted is different (since I
assume a certain frame rate in my MATLAB post-processing...). I will try to
post details on the version of ffmpeg which requires manual specification
of the frame rate.

Thank you for your input,
- Matt Bondy

Carl Eugen
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>


More information about the ffmpeg-user mailing list