I would like to extract frames at fps=25 and the frames are rescaled to 320x240.

What I have tried:

ffmpeg -i video.avi -vf scale="320x240" fps=25   frames/c01_%04d.jpeg

It returns fps=25: Invalid argument

but when I run it with either fps or scale it works.

ffmpeg -i video.avi -vf scale="320x240"    frames/c01_%04d.jpeg


ffmpeg -i video.avi -vf  fps=25   frames/c01_%04d.jpeg

It works. How can I run ffmpeg with scale and fps filters?


Join simple filters with a comma:

ffmpeg -i video.avi -vf "scale=320:240,fps=25" frames/c01_%04d.jpeg


When using the fps filter to extract frames be aware that if the input frame rate:

  • is the same as the fps value then the filter is doing nothing and you can remove it.

  • is higher than the fps value then some frames will be omitted to match the fps value. If this is the case then use fps before scale and the process will be faster.

  • is lower than the fps value then some frames will be duplicated to match the fps value.

If you want to simply extract all frames then remove the fps filter.


Consider declaring just width or height and using -1 as the value for the other, such as 320:-1 or -1:240. Doing this will allow the filter to automatically choose the proper value while preserving the aspect ratio. This will prevent stretching of the output image aspect ratio.


Use -q:v or -qscale:v to control quality.

  • If you specify a different ratio h:w when scaling I don't think you'll end up with a stretched image as ffmpeg will by default keep the DAR (display aspect ratio) constant. But you will end up with a different PAR - ie pixels will not necessarily be square. Eg 1920x1080 to 1920x540 will keep the aspect ratio but the vertical resolution is halved by having taller pixels. – thomasrutter Nov 6 '19 at 2:43
  • @thomasrutter ffmpeg will preserve the DAR by adjusting the SAR. If you want it to stretch add setsar=1. – llogan Nov 6 '19 at 20:16
  • Yes that's what I was explaining. But your answer says, This will prevent stretching of the output image.. I wanted to point out that this isn't the case - it wouldn't stretch. – thomasrutter Nov 6 '19 at 23:43
  • @thomasrutter Fixed. – llogan Nov 7 '19 at 0:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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