Reputation: 93
I have a bunch of videos downloaded from Youtube and I would like to extract frames from them. The current command I am using is:
ffmpeg -i input.mp4 -an -s qvga %06d.png
But I also want to set the -r and -t option. I want the fps to be the fps of each video, and the duration time is their duration. I know that if I don't set the -r option, the default is 25 fps.
So could anyone help? how to add the -r and -t option? and is there any better and accurate way to obtain individual frames from videos? Thanks a lot.
Upvotes: 5
Views: 6749
Reputation: 133743
You do not need to set duration (-t
) or frame rate (-r
) when outputting images. By default ffmpeg
will output all of the images.
Other notes:
If you want to limit the duration, such as only wanting the images from the first 3 seconds, then use -t 3
.
If you want to limit the number of output frames, such as only wanting the first 100 frames, then use -frames:v 100
.
Individual images do not have a frame rate. If you add -r
, then ffmpeg
will duplicate or drop frames if -r
is different than the input frame rate. Omitting -r
will output all images.
You don't need -an
when outputting images.
Using the scale filter is more flexible than -s
. It can prevent stretching because it can preserve the aspect ratio: -vf scale=320:-1
Upvotes: 6