开发者

Maintain aspect ratio when converting video? - ffmpeg

I'm trying to convert movies from .avi to an iphone readable format wherever I look, people suggest the following options for ffmpeg

ffmpeg -s 320x240 -aspect 320:240 [...]

This does not bode well f开发者_高级运维or videos with a different aspect ratio!


How can I keep the aspect ratio from changing? Is there a way to set the size dynamically?

e.g. have the height to be 240 and the width variable?


Abstract from a rich article found here : http://www.frasq.org/en/transcoding-an-audio-or-a-video-file

To fit a video for a particular display, recompute its width and its height with the following formular:

aspect_ratio_of_display = width_of_display / height_of_display
aspect_ratio_of_video = width_of_video / height_of_video

if aspect_ratio_of_video > aspect_ratio_of_display
then
    height = (height_of_video / aspect_ratio_of_video) and width = width_of_display
else
    width = (height_of_display x aspect_ratio_of_video) and height = height_of_display

Remember to round the width and the height of the video to a multiple of 16.


Use a simple script in whatever language and get the video details, and adjust accordingly for a target size, you can also "letter box" or pad the top and bottoms for a better aspect ratio.

http://ubuntuforums.org/showthread.php?t=702188 http://stream0.org/2008/01/find-and-extract-video-file-de.html http://www.mythtv.org/wiki/Ipod_export

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜