ffmpeg scaling not working for video

2020-02-12 09:46发布

问题:

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

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 ?

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

UPDATE :

I found the command from this tutorial

回答1:

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.

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

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


标签: video ffmpeg