chipweinberger / flutter_quick_video_encoder

Quickly encode raw RGB images & PCM audio to MP4 video using the hardware h264 encoder
The Unlicense
7 stars 0 forks source link

buffer overrun (ArrayIndexOutOfBoundsException) if width or height is odd #8

Open bnehring38 opened 2 months ago

bnehring38 commented 2 months ago

rgbaToYuv420Planar() expects width and height to be even numbers, or at least a multiple of 4. Otherwise it will index off the end of yuv420[] with the vIndex, which it expects to neatly fit in the last quarter of the array.

What is the solution here? If this is a hard requirement then I think it should check width and height are both even, or at least divisible by 4. If there's a more elegant solution to coerce the dimensions up to even numbers, then that would be better. We currently have a design that has an odd-numbered width, and we'd like to know if there's a solution to fix it down in this library.

chipweinberger commented 2 months ago

open a PR

odd width/height is usually not supported in hardware