ffmpeg resize down larger video to fit desired size and add padding

后端 未结 3 1473
一整个雨季
一整个雨季 2020-12-25 13:43

I\'m trying to resize a larger video to fit an area that I have. In order to achieve this I calculate first the dimensions of the resized video so That it fits my area, and

3条回答
  •  遥遥无期
    2020-12-25 14:16

    Try this:

    -vf 'scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:x=(640-iw)/2:y=(480-ih)/2:color=black'
    

    According to FFmpeg documentation, the force_original_aspect_ratio option is useful to keep the original aspect ratio when scaling:

       force_original_aspect_ratio
           Enable decreasing or increasing output video width or height if
           necessary to keep the original aspect ratio. Possible values:
    
           disable
               Scale the video as specified and disable this feature.
    
           decrease
               The output video dimensions will automatically be decreased if
               needed.
    
           increase
               The output video dimensions will automatically be increased if
               needed.
    

提交回复
热议问题