Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to catch some snapshots from a video. So I found this code in their official page:

ffmpeg -i myvideo.avi -f image2 -vf fps=fps=1/60 img%03d.jpg

but, I can not find any documentation about options and they never explain it.

So if you know some reference or documentations about ffmpeg options, please share.

The main question of this post is what image2 -vf fps=fps=1/60 means. I cannot understand why they just write like fps=1/60. And image2 is some kind of option or what?

What's the difference to the following?

ffmpeg -i filename.avi -ss 00:00:01 -r 1/60 image%03d.png
share|improve this question

1 Answer 1

up vote 5 down vote accepted

It shouldn't be hard to find the documentation on the FFmpeg homepage.

If you read the documentation of the fps filter, you will see that the filter has multiple options, one being fps. So, to declare that option, you have to call:

-vf fps=fps=1/60
     ↑   ↑   ↑
     |   |   |
     |   |   |__ value
     |   |______ option
     |__________ filter

You could also write -vf fps="fps=1/60", of course.

So, when you use 1/60 that means 1/60 frames per second, or 1 frame per 60 seconds. In any case the difference between this and -r 1/60 is that a filter is applied before any -r option. Both commands you gave should work in theory, however the -r one creates too many output frames for me (but I'm not the first one to notice). Stick with the fps filter.


If you dissect the command you will find that image2 is the option value of -f. This specifies the output format. In general, you can use it in ffmpeg like this:

ffmpeg -f input-format -i input-file -f output-format output-file

In your example, we told ffmpeg to use the image2 muxer, which allows you to output single image files from video, by specifying a pattern like %02d for the output name.

The -f image2 is superfluous here as the muxer should be chosen automatically when you use an image output format.

share|improve this answer
    
Thank you so much:D i don't even know there's filter option! –  Juneyoung Oh Apr 21 '13 at 13:13
    
-vf and -filter:v mean the same, but it's more apparent that it's a filter with the -filter one, of course. I had a talk with someone on the FFmpeg mailing list and they also said that -r shouldn't be used to set the frame rate for the output. -filter:v fps is preferred. –  slhck Apr 21 '13 at 13:16
    
@slhck As a trivial and mostly unrelated side note, ffplay doesn't seem to like -filter:v compared to -vf (but it has been a while since I've tried due to travel). –  LordNeckbeard Apr 28 '13 at 16:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.