2

I am using a Windows 10 PC and I am extracting frames from video using FFmpeg as described in this other question and answer thread on SuperUser. How do I control the size of webP files that are generated?

I tried following commands:

ffmpeg -i anim.mp4 -vf "select=not(mod(n\,6))" -vsync vfr img1/f%04d.jpg -preset photo
ffmpeg -i anim.mp4 -vf "select=not(mod(n\,6))" -vsync vfr img/f%04d.webp -qscale 20 -lossless false -preset photo -compression_level 6
Giacomo1968
  • 53,069
  • 19
  • 162
  • 212

1 Answers1

4

Option order matters in FFmpeg.

Options meant for an output file go before that output file and after all input files.

So, this command:

ffmpeg -i anim.mp4 -vf "select=not(mod(n\,6))" -vsync vfr img/f%04d.webp -qscale 20 -lossless false -preset photo -compression_level 6

Should be:

ffmpeg -i anim.mp4 -vf "select=not(mod(n\,6))" -vsync vfr -qscale 20 -lossless false -preset photo -compression_level 6 img/f%04d.webp

Except that quality for WebP encoder has a dedicated option quality, so:

ffmpeg -i anim.mp4 -vf "select=not(mod(n\,6))" -vsync vfr -quality 50 -lossless false -preset photo img/f%04d.webp

quality can range from 0 to 100, where higher is better. Default is 75.

compression_level will also modulate control and encoding speed, with 6 being slowest/best. Range is 0-6.

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
Gyan
  • 34,439
  • 6
  • 56
  • 98
  • The documentation [says](https://ffmpeg.org/ffmpeg-all.html#libwebp) that the quality option is actually called qscale. Did this change after you reply? – mcont Mar 24 '22 at 09:53
  • The answer is correct. The doc is out of date; it wasn't updated when 'quality' was added in 2014. – Gyan Mar 24 '22 at 11:31
  • They both seem to work in the same way though, does it make a difference in practice? Are they aliases? Thanks – mcont Mar 24 '22 at 13:07
  • The scales are different. – Gyan Mar 24 '22 at 18:54