Re: let ffmpeg auto-calc height value when specifying (new) width while keeping aspect ratio?
On Thu, Nov 01, 2018 at 07:56:52 +0100, Ben wrote:
> The new video should have the same aspect ratio as the original.
> I want to change the resolution of the new video to 1680 but don't want to calculate manually the corresponding height (dividable by 2).
> Can I tell ffmpeg to automatically calculate the appropriate height by using the specified width and the given aspect ratio?
Sure. Using the "scale" filter, there's the magic negative dimension:
"If one and only one of the values is -n with n >= 1, the scale
filter will use a value that maintains the aspect ratio of the input
image, calculated from the other specified dimension. After that it
will, however, make sure that the calculated dimension is divisible
by n and adjust the value if necessary."