FFmpeg - 使用宽高比更改视频的分辨率 [英] FFmpeg - Change resolution of the video with aspect ratio
问题描述
全部.
如何使用 FFmpeg 更改具有纵横比的视频的分辨率?
How to change resolution of the video with aspect ratio with FFmpeg?
有选择http://manpages.ubuntu.com/manpages/oneiric/man1/ffmpeg.1.html
-s size
Set frame size. The format is wxh (ffserver default = 160x128,
ffmpeg default = same as source). The following abbreviations are
recognized:
和
-aspect aspect
Set the video display aspect ratio specified by aspect.
aspect can be a floating point number string, or a string of the
form num:den, where num and den are the numerator and denominator
of the aspect ratio. For example "4:3", "16:9", "1.3333", and
"1.7777" are valid argument values.
例如,我有两个输入视频:
For example, I have two input videos:
- 200*400 分辨率
- 400*700 分辨率
我需要制作分辨率为 100*200 的输出视频.
I need to make output video with 100*200 resolution.
如果我使用 -s 100x200 运行 ffmpeg,那么第二个视频的纵横比将很差.
If I will run ffmpeg with -s 100x200, then second video will have bad aspect ratio.
如何按宽度限制输出视频,按高度自动纵横比?
How can I limit output video by width, with auto aspect ratio by height?
例如,我只想为输出视频指定宽度 100px,而 ffmpeg 必须自动计算具有正确纵横比的高度.
For example, I want specify for the output video only width 100px and ffmpeg must automatically calculate height with right aspect ratio.
对于第一个视频,它将是:
For first video it will be:
200/100=2
400/2=200
即 100x200
对于第二个视频,它将是:
For second video it will be:
400/100=4
700/4=75
即 100x75
有可能吗?
推荐答案
ffmpeg -i -vf scale=720x406,setdar=16:9 <输出>
这篇关于FFmpeg - 使用宽高比更改视频的分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!