Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different between '-s' and '-vf scale=' in ffmpeg, especially in two-pass transcoding?

Tags:

ffmpeg

Different between '-s' and '-vf scale=' in ffmpeg?

And for a two-pass transcoding in ffmpeg, what's the difference or influence then?

like image 813
Drake Guan Avatar asked Dec 20 '22 12:12

Drake Guan


1 Answers

There should be no difference in the output

Using the md5 muxer to compare.

-s

$ ffmpeg -i input -an -s 640x360 -f md5 -
...
MD5=6280d86947e18d6633f4eddc299cf8a4

-vf scale

$ ffmpeg -i input -an -vf scale=640:360 -f md5 -
...
MD5=6280d86947e18d6633f4eddc299cf8a4

I believe -s is mapped to scale but I'm not totally sure and did not look at the source code to find out.


There are advantages to using scale instead of -s

  • You can use it with other filters and determine exactly where in the filtergraph you want the scale to occur.

  • It is more flexible because you can use additional options and expressions.

  • You can just declare one dimension and scale can automatically determine the other while preserving aspect ratio: scale=640:-1.

See the FFmpeg scale video filter documentation for more info.

like image 99
llogan Avatar answered Dec 28 '22 08:12

llogan