4845 explained code solutions for 96 technologies

ffmpegHow to change video resolution and keep aspect ratio

In order to keep aspect ratio, set only one target dimension (width or height) and leave the other one as -1:

ffmpeg -i in.mp4 -vf scale=-1:180 out.mp4ctrl + c
-i in.mp4

input video file


apply specific video filters


change video resolution to specified size


width will be calculated automatically based on aspect ratio


set height to 180 pixels


resulting video file