[FFmpeg-devel] [PATCH] Scale width/height keeping aspect when given just one dimension

Daniel G. Taylor dan
Fri Sep 25 16:40:23 CEST 2009


This patch will allow FFmpeg to scale the output width/height of a
stream to a given width xor height while keeping aspect via the -s
option, which gets the ability to accept one -1 value, e.g.

ffmpeg -i input.mp4 -s 640x-1 scaled.mp4

ffmpeg -i input.mp4 -s -1x720 scaled720p.mp4

The patch modifies avcodec/utils.c to allow a single -1 value when
parsing the dimensions, and modifies ffmpeg.c to detect the -1 values
and scale accordingly. After multiplying the value is incremented by one
if it is odd.

Currently this also means you can enter -1 when using libav* but the
scaling must still be done manually in your software. I'm not sure how
this can be done inside libav* itself. Suggestions?

I tried to follow the same style as in the files. Comments and review

Take care,
Daniel G. Taylor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: auto_size.patch
Type: text/x-patch
Size: 2274 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090925/3a056550/attachment.bin>

More information about the ffmpeg-devel mailing list