ffmpeg : width not divisible by 2 (when keep proportions)

Viewed 4147

I try to reduce the dimensions of video:

ffmpeg -i input.mp4 -y -acodec aac -ac 2 -ab 160k -vcodec libx264 -vf "scale=-1:'min(720,ih)'" -f mp4 output.mp4

I got :

width not divisible by 2 (405x720)

I tried with:

 -vf "scale=-1:'min(720,ceil(ih/2)*2)'"

Go the same because I need to keep width propotions

Any idea ?

I already read that without success:

FFMPEG (libx264) "height not divisible by 2"

2 Answers

Use

scale='bitand(oh*dar,65534)':'min(720,ih)'

This will rescale the width proportional to the output height and then reduce it an even value.

Use "scale=-2:'min(720,ih)'"

In general you can put -N to force it to be a multiple of N when keeping the aspect ratio, so if you were using a codec that required widths to be a multiple of 16, you could use -16 for the width.

Related