lkakquestions.blogg.se

Ffmpeg scale maintain aspect ratio
Ffmpeg scale maintain aspect ratio








ffmpeg scale maintain aspect ratio

With -2 we tell the scale filter to round to the nearest even number. This happens due to a limitation of libx264. width or height not divisible by 2 (854x363)

ffmpeg scale maintain aspect ratio

Why -2 you ask? You may or may not encounter this error: We compare the aspect ratio and set a fixed width (854px) and scale the height (-2) or we do the opposite and set a fixed height (480px) and scale the width (-2). With this setting I wanted to maintain video orientation and aspect ratio while scaling it down to my desired resolution. Ffmpeg -i input.mp4 self explanatory -y overwrite files if they exist -vcodec libx264 use the h264 codec -px_fmt yuv420p select the pixel format for maximum compatibility -preset fast choose a basket of settings that will result in faster encoding -crf 24 quality setting










Ffmpeg scale maintain aspect ratio