Alex Rivera | Logout

FFMPEG scaling, how to set scale so width AND height don't exceed a certain amount?

Asked 2012-08-28T04:09:01.497
8

I have 2 videos, one is 500 pixels by 100 pixels (just an example, like something recorded sideways on an iphone). And a 1980 x 400 pixels videos. I need the video to convert maintaining aspect ratios. I know of the -vf scale filter such as -vf scale=-1:320, but that only takes the width and scales the height accordingly. My 500 x 100 video would be 320px wide and 1600 pixels tall. That's bad, I need it to be max 500 pixels tall and max width of 320 (just example sizes).

How would I configure the -vf scale function to do that?

Using latest ffmpeg 0.11

Recap: scale any video to max 500 height : 320 width while keeping aspect ratio

Edit
Report

1 Answer

2

You don't need to use vf scale. Just give -s widthxheight and it will scale to that size. For aspect ratio use -aspect Eg. I have a 320x240 file that I want to convert to 360x240 with black bands on the side

ffmpeg -i input.mp4 -acodec copy -vcodec mpeg4 -s 360x240 -aspect 4:3 out.mp4

That's it.

answered 2012-08-28T04:41:43.163

Your Answer