如何使用FFmpeg将视频升级到固定分辨率? [英] How can I upscale videos with FFmpeg to a fixed resolution?

查看:134
本文介绍了如何使用FFmpeg将视频升级到固定分辨率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

示例视频的分辨率:640x788

Resolution of an example video: 640x788

新视频所需的分辨率:1920x1080

Desired resolution of the new video: 1920x1080

视频的长宽比应保持不变(左侧和右侧的区域应填充为黑色).

The aspect ratio of the video should be kept (the area left & right should be filled black).

我当前的通话如下: ffmpeg -i input.mp4 -s 1920x1080 -r 60 -aspect 1:1 -strict实验output.mp4 .这里的问题是视频有时会变窄/变宽(不保持宽高比).

My current call looks like this: ffmpeg -i input.mp4 -s 1920x1080 -r 60 -aspect 1:1 -strict experimental output.mp4. The problem here is that the video is sometimes made narrower / wider (aspect ratio is not kept).

由于我不是FFmpeg专家,所以我希望在这里寻求帮助(也许有填充属性?)

Since I am no FFmpeg expert I hope for help here (maybe there is a padding property?)

推荐答案

您将使用比例和填充过滤器来完成此操作.

You would use the scale and pad filters to accomplish this.

ffmpeg -i input.mp4 -vf scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:-1:-1,setsar=1 -r 60 output.mp4

为此使用ffmpeg v4.1或更高版本-自2015年以来,对于典型的MP4输出,就不再需要 -strict 选项,因此您的ffmpeg版本可能很旧.

Use ffmpeg v4.1 or newer for this - the -strict option hasn't been needed for typical MP4 output since 2015 so your ffmpeg build may be very old.

这篇关于如何使用FFmpeg将视频升级到固定分辨率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆