ffmpeg scaling not working for video

前端 未结 1 851
攒了一身酷
攒了一身酷 2020-12-18 05:44

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

相关标签:
1条回答
  • 2020-12-18 06:14

    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
    
    0 讨论(0)
提交回复
热议问题