-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Hi to all involved, I really enjoy using your package.
I just recently came across an issue where the width and height of some videos had odd numbers an the error that through was
[executeThumbnailGenerationLinux] Stderr: width not divisible by 2 (447x800)
[vost#0:0/libx264 @ 0000022e5adaec80] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
The code I ran that affected this was:
FilterChain(
inputs: [videoStream.videoOnly],
filters: [
if ((aspectRatio ?? 0) >= 1) ScaleFilter(width: 800, height: -1),
if ((aspectRatio ?? 0) < 1) ScaleFilter(width: -1, height: 800),
],
outputs: [outputStream.videoOnly],
),
);
What i realized is that using ffmpegg on the cli allows you to use '-2" for width or height which ensures that these issues dont happen.
Therefore I just ended up extended the the Filter class and simply changed your assert statements from "-1" to "-2".
See my version below:
PageMeScaleFilter({
this.width,
this.height,
this.eval,
this.interl,
this.swsFlags,
this.param0,
this.param1,
this.size,
}) : assert(width == null || width >= -2),
assert(height == null || height >= -2),
assert(eval == null || eval == 'init' || eval == 'frame'),
assert(interl == null || interl == 1 || interl == 0 || interl == -1);
This completely solves my issue, so I was wondering if you would like me to submit a PR with the changes.
Have a great day.
Cheers
Metadata
Metadata
Assignees
Labels
No labels