[FFmpeg-devel] [PATCH 1/2] vf_scale: add force_original_aspect_ratio

Stefano Sabatini stefasab at gmail.com
Sat Aug 3 12:10:16 CEST 2013

On date Friday 2013-08-02 18:42:07 -0700, Timothy Gu encoded:
> ---
>  doc/filters.texi       | 15 +++++++++++++++
>  libavfilter/vf_scale.c | 16 ++++++++++++++++
>  2 files changed, 31 insertions(+)
> diff --git a/doc/filters.texi b/doc/filters.texi
> index cd59057..d78c4ca 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -6373,6 +6373,21 @@ Full range (0-255 in case of 8bit luma)
>  "Mpeg" range (16-235 in case of 8bit luma)
>  @end table
> + at item force_original_aspect_ratio
> +Enable decreasing or increasing output video width or height if necessary to

> +keep the original aspect ratio. If set to 1, it will automatically decrease;
> +if set to 2, it will increase if needed.

decrease/increase are transitive verbs and thus you need to always
specify the object (decrease the output aspect ratio, increase ...).

Also I'd prefer to use named constants instead of numerals, for
example disable/decrease/increase

Also check:

> +
> +One useful instance of this option is that when you know a specific device's
> +maximum allowed resolution, you can use this to limit the output video to
> +that, while retaining the aspect ratio. For example, device A allows
> +1280x720 playback, and your video is 1920x800. Using this option (set it to
> +1) and specifying 1280x720 to the command line makes the output 1280x533.

Not sure this is a good idea, since this tricks the output size in
possibly unexpected ways. Why can't you use an expression to set that
condition, so that outw/h depends on the original input aspect ratio?
FFmpeg = Faithless and Faithful Magnificient Plastic Earthshaking Gargoyle

More information about the ffmpeg-devel mailing list