转换视频时保持宽高比? - ffmpeg

发布于 2024-09-08 14:39:54 字数 307 浏览 8 评论 0原文

我正在尝试将电影从 .avi 转换为 iphone 可读格式 无论我看什么,人们都会建议以下 ffmpeg 选项

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

这对于具有不同宽高比的视频来说不是一个好兆头!


如何防止宽高比发生变化?有没有办法动态设置大小?

例如,高度为 240,宽度为变量?

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 for 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蝶舞 2024-09-15 14:39:54

摘要来自此处的丰富文章:http://www .frasq.org/en/transcoding-an-audio-or-a-video-file

要使视频适合特定的显示,请使用以下公式重新计算其宽度和高度:

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

记住对宽度和高度进行四舍五入视频的高度为 16 的倍数。

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.

獨角戲 2024-09-15 14:39:54

使用任何语言的简单脚本并获取视频详细信息,并相应地调整目标尺寸,您还可以“信箱”或填充顶部和底部以获得更好的宽高比。

http://ubuntuforums.org/showthread.php?t=702188
http://stream0.org/2008/01/查找并提取视频文件-de.html
http://www.mythtv.org/wiki/Ipod_export

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文