本文介绍了FFmpeg-使用宽高比更改视频的分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部.

如何使用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

200/100=2

400/2 = 200

400/2=200

即100x200

对于第二个视频,它将是:

For second video it will be:

400/100 = 4

400/100=4

700/4 = 75

700/4=75

即100x75

有可能吗?

推荐答案

ffmpeg -i <input> -vf scale=720x406,setdar=16:9 <output>

这篇关于FFmpeg-使用宽高比更改视频的分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 22:08