ffmpeg 缩放不适用于视频 [英] ffmpeg scaling not working for video

查看:40
本文介绍了ffmpeg 缩放不适用于视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过 FFMPEG 更改视频文件的尺寸.我想将任何视频文件转换为 480*360 .

I am trying to change the dimensions of the video file through FFMPEG. I want to convert any video file to 480*360 .

这是我正在使用的命令...

This is the command that I am using...

ffmpeg -i oldVideo.mp4 -vf scale=480:360 newVideo.mp4

ffmpeg -i oldVideo.mp4 -vf scale=480:360 newVideo.mp4

执行此命令后,1280*720 尺寸将转换为 640*360.

After this command 1280*720 dimensions are converted to 640*360.

我还附上了视频.任何专家都需要不到一分钟的时间.有什么问题吗 ?

I have also attached video. it will take less than minute for any experts out there. Is there anything wrong ?

您可以在此处查看.(在视频中,20 秒后,直接跳转到 1:35 ,休息只是处理时间).

You can see here. (in Video, after 20 seconds, direclty jump to 1:35 , rest is just processing time).

更新:

我从这个教程中找到了命令

推荐答案

每个视频都有一个S充足的Aspect R它.视频播放器将视频宽度与此 SAR 相乘以产生显示宽度.高度保持不变.因此,SAR 为 2 的 640x720 视频将显示为 1280x720.1280 和 720 的比率,即 16:9 被标记为 Display Aspect R 比率.

Every video has a Sample Aspect Ratio associated with it. A video player will multiply the video width with this SAR to produce the display width. The height remains the same. So, a 640x720 video with a SAR of 2 will be displayed as 1280x720. The ratio of 1280 to 720 i.e. 16:9 is labelled the Display Aspect Ratio.

缩放过滤器在输出中保留输入的 DAR,因此输出看起来不会失真.它通过调整输出的 SAR 来实现.补救方法是在缩放后重新设置 SAR.

The scale filter preserves the input's DAR in the output, so that the output does not look distorted. It does this by adjusting the SAR of the output. The remedy is to reset the SAR after scaling.

ffmpeg -i oldVideo.mp4 -vf scale=480:360,setsar=1 newVideo.mp4

由于 DAR 可能不再相同,因此输出可能看起来失真.避免这种情况的一种方法是按比例缩放,然后填充黑色以达到目标分辨率.

Since the DAR may no longer be the same, the output can look distorted. One way to avoid this is by scaling proportionally and then padding with black to achieve target resolution.

ffmpeg -i oldVideo.mp4 -vf scale=480:360:force_original_aspect_ratio=decrease,pad=480:360:(ow-iw)/2:(oh-ih)/2,setsar=1 newVideo.mp4

这篇关于ffmpeg 缩放不适用于视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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