[FFmpeg-devel] [PATCH] Ensure scaled video is divisible by n

Lars Kiesow lkiesow at uos.de
Mon Jul 8 18:34:40 EEST 2019


Hi Michael,

> commit message should begin with a prefix like 
> avfilter/vf_scale: ...

Thanks for the hint. Will use that.

> what does this feature have to do with force_original_aspect_ratio ?
> i think it should not be under this if()

This really only makes sense when using force_original_aspect_ratio
since otherwise, you could just use something like scale=320:-2. The
force_original_aspect_ratio option is great to have a video fit within
a given maximum size but unfortunately, this may cause encoder issues
due to the resulting size.

But I guess that my documentation for this option wasn't the best. I'll
improve that so that it will hopefully become clear what the new option
is meant for.

> also the rounding is always down, it probably should be rounding to
> closest (for n=2 it doesnt matter but for larger divisibility like 16
> rounding down by 15 instead of rounding up by 1 seems not ideal

Good point. Thinking about this again, since I'm coupling this with
force_original_aspect_ratio anyway, it would definitely make sense to
have this comply to the `increase` or `decrease` options of that
setting, rounding up if `increase` is set, rounding down if `decrease`
is set.

I will update the code accordingly and send out a new patch in a moment.

Best regards,
Lars


More information about the ffmpeg-devel mailing list