user19385: I am using ffmpeg to scale video files to fit within a size of 1280:720, maintaining aspect ratio, using the below commands. This works most of the time, but every now and then a video with a weird aspect ratio comes out to a scale that is not a multiple of 2 in one of the dimensions, which throws an error when encoding to h.264. Is there a way I can keep the same scaling logic but round off that dimension to a multiple of 2?
By way of example I am currently erroring on a video which is 4:3 720:486 - which scales to 1067:720.
-i input.mov -c:v libx264 -vf scale=w=1280:h=720:force_original_aspect_ration=decrease output.mov

user1871: The scale filter has an option called force_divisible_by for this,
scale=w=1280:h=720:force_original_aspect_ration=decrease:force_divisible_by=2

19385: <p>I am using ffmpeg to scale video files to fit within a size of 1280:720, maintaining aspect ratio, using the below commands. This works most of the time, but every now and then a video with a weird aspect ratio comes out to a scale that is not a multiple of 2 in one of the dimensions, which throws an error when encoding to h.264. Is there a way I can keep the same scaling logic but round off that dimension to a multiple of 2?</p>
<p>By way of example I am currently erroring on a video which is 4:3 720:486 - which scales to 1067:720.</p>
<p><code>-i input.mov -c:v libx264 -vf scale=w=1280:h=720:force_original_aspect_ration=decrease output.mov</code></p>
 1871: <p>The scale filter has an option called <code>force_divisible_by</code> for this,</p>
<p><code>scale=w=1280:h=720:force_original_aspect_ration=decrease:force_divisible_by=2</code></p>
