4

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
  • 58,727

1 Answers1

6

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 0 -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 0 -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.

Cestarian
  • 1,997
Gyan
  • 38,955