I'd like to convert a lot of video files to flash video for our company's website. I have a requirement that all of the videos must be in 360p format, so their size would be Nx360.

FFMpeg uses -s argument to specify target resolution as WxH. I don't know Width, as it depends on source file aspect ratio. If source is 640x480, target will be 480x360. If source is 848x480, target will be 636x360.

Is there a way to do it with some switch of ffmpeg? That it will preserve aspect ratio and I'll only specify the height of target video?

I could easily solve it by making a program that will launch ffprobe to get source video size, calculate aspect ratio and then calculate a new width.

link|improve this question

70% accept rate
feedback

1 Answer

up vote 4 down vote accepted


You could try adding this video filter: -vf "scale=-1:360"

-1 in this case means variable / unknown,
thus
-vf "scale=-1:360"
means
-vf "scale=variable:360".

This filter resizes the video to preserve the aspect ratio of the input, keeping 360 as the height. For me this achieved the same result as you are looking for :)

link|improve this answer
In this case you omit the -s parameter, as ffmpeg calculates the size-related parameters for you. – user65600 Feb 1 '11 at 9:52
thanks! you're the man! – Axarydax Feb 1 '11 at 10:12
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.