Answer the question
In order to leave comments, you need to log in
Width/height not divisible by 2. How to add 1 pixel?
I need to fit the video into a 1000x1000 square (let's say). If the size of some side is larger, then proportionally reduce. If it fits into a square, then leave it as it is (do not increase). Paddings up to 1000x1000 are not needed.
In short, this is the command:
-vf scale='min(1000,iw)':'min(1000,ih)':force_original_aspect_ratio=decrease
Answer the question
In order to leave comments, you need to log in
Since the question is open, I'll put in my two cents. I recently made a python program where I needed to stretch a video or shrink a video to a certain size of 1080 x 1920 using ffmpeg. Let's say the video has a size of 600x800
. For this, I used the formula
ratio = min([1080 / 600, 1920 / 800])
new_width = ratio * 600
new_height = ratio * 800
well, if the number turns out to be odd, then you need to round it up to the nearest even
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question