[FFmpeg-trac] #10279(undetermined:new): "width not divisible by 2" error with force_original_aspect_ratio=reduce
FFmpeg
trac at avcodec.org
Fri Mar 24 00:13:43 EET 2023
#10279: "width not divisible by 2" error with force_original_aspect_ratio=reduce
-------------------------------------+-------------------------------------
Reporter: php4fan | Type: defect
Status: new | Priority: normal
Component: | Version:
undetermined | unspecified
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Summary of the bug:
How to reproduce:
I have a file with a resolution of 480x848.
I try to convert it with:
{{{
ffmpeg -i "input.mp4" -vcodec libx264 -acodec aac -strict -2 -vf
"scale='min(800,iw)':'min(800,ih)':force_original_aspect_ratio=decrease"
"output.mp4"
}}}
I get the stupid error:
{{{
width not divisible by 2 (453x800)
}}}
This is stupid, because I'm not giving you an exact width. I'm asking you
to force the aspect ratio, and 453 is the result of computing a width to
force the aspect ratio.
Given that you are computing the width, it's up to you to round it to the
nearest multiple of 2 if needed. Just like you don't complain about the
computed width not being an integer, but you silently round to the nearest
integer, in pretty much the same way you should round it to the nearest
multiple of 2 (or 4 or whatever the requirement is) if the codec so
requires.
According to https://trac.ffmpeg.org/wiki/Scaling:
> Some codecs require the size of width and height to be
> a multiple of n. You can achieve this by setting
> the width or height to -n:
> ffmpeg -i input.jpg -vf scale=320:-2 output_320.png
but I don't see how that would be applicable here.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/10279>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list