ffmpeg缩放不适用于视频

ffmpeg缩放不适用于视频

本文介绍了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...

此命令后,将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 样本 A 方面 R 它.视频播放器将视频宽度乘以此SAR以产生显示宽度.高度保持不变.因此,SAR为2的640x720视频将显示为1280x720. 1280与720(即16:9)的比例标记为 D isplay A spect R atio.

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缩放不适用于视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 02:12