[FFmpeg-user] Can I do scaling better?

James Darnley james.darnley at gmail.com
Fri Feb 14 17:05:16 CET 2014

On 2014-02-14 16:55, csparker247 wrote:
>> I cannot provide you with a quick solution but 
>> "-vf scale,scale" seems a very bad idea to me. 
> I've had concerns with that, too, but I can't think of another way to
> guarantee square pixels AND scale downs for arbitrary inputs.

You can access the aspect ratio in the "scripting" so you can scale
width and height using it.

I will post what I used fairly recently.  It is not exactly what you
want but shows the principle.  It will scale everything larger than
1024x768 to something that fits within that bound.  Otherwise it just
scales to square pixels.

> "scale=
>     w=if(lt(dar\,1.34)\, -1\, if(gt(iw\,1024)\, 1024\, iw)):
>     h=if(gte(dar\,1.34)\, -1\, if(gt(ih\,768)\, 768\, ih)),
> setsar=1"

It still didn't solve the odd sizes it that -1 can give.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 683 bytes
Desc: OpenPGP digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20140214/901ba3d3/attachment.asc>

More information about the ffmpeg-user mailing list