Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#2150 closed enhancement (fixed)

scale video filter improvement

Reported by: burek Owned by:
Priority: wish Component: avfilter
Version: git-master Keywords: scale
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Could "scale" video filter be improved in such a way that users could define X:Y as a maximum sized box in which the input video should be scaled, keeping aspect ratio? Something like: "-vf scale=640:480:keep_aspect_ratio"

This would work the same as "-vf scale=640:-1" when the input video has got width > height and "-vf scale=-1:480" when the input video has got height > width.

Right now, without this feature, users have to use either ffprobe or ffmpeg to first determine which dimension is greater and based on that, they would launch either 640:-1 (if width is greater than height) or -1:480 (when height is greater than width). But with this feature, users would be able to do it all with one simple command.

Maybe a simple flag could be added, so that it could be written like this: "-vf scale=640:480:flags=keep-ratio" or something similar.

Change History (5)

comment:1 by Elon Musk, 12 years ago

Component: undeterminedavfilter
Status: newopen

comment:2 by Elon Musk, 12 years ago

Resolution: invalid
Status: openclosed

This is already possible, w and h options are expression, no need to use ffprobe to get video size.

comment:3 by burek, 12 years ago

Can you please give one example of such command line usage?

Version 0, edited 12 years ago by burek (next)

comment:4 by burek, 12 years ago

Here is an example line that can accomplish this already (thanks ubitux) :)

-vf scale="'if(gt(iw,ih),640,-1)':'if(gt(iw,ih),-1,480)'"

NOTE: Pay attention to quotes. They are important.

comment:5 by Carl Eugen Hoyos, 11 years ago

Keywords: scale added
Resolution: invalidfixed
Version: unspecifiedgit-master

I suspect this was fixed in 3415058 (force_original_aspect_ratio).

Note: See TracTickets for help on using tickets.