-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Crashes on getPlanes() for YUV format (V3 RC5) #1714
Comments
I have the same Problem with "3.0.0-rc.8" |
@mrousavy |
@robinsoncol |
@moriax Thanks, that actually solved an issue that I was having. Is that documented anywhere? Also, shouldn't that be the default pixelFormat value for the component? |
Yes. This error I have only in Android Simulator. I have pixelFormat='yuv' and I get correct format = 35. |
Finally solved the error. In my case the problem was in react-native-reanimated. Versions 3.4.0 and 3.4.1 have the bug #4838 in code and break the FrameProcessor call. Bug can be closed. |
Hey - yes the pixelFormat has to be specified - i don't know which pixel format you want. Per default, it is the most efficient platform native format, which is PRIVATE on Android, and YUV420 on iOS. I'll add some docs on that for FPs :) Also, rewriting the video pipeline now so the getPlanes and pixel formats will be greatly improved. |
@mrousavy I used your Stickman example app and just added a simple FrameProcessor to process the image with googles MLKit which triggered the same error reported as in this issue. The reason for the error is, that you use always the following Flags in CameraOutput: https://developer.android.com/reference/android/media/ImageReader#newInstance(int,%20int,%20int,%20int,%20long) |
Gotcha! I updated the implementation of all of that to now use a default ImageReader, I think that would work better |
Tried version 3.0.0. Having new error.
|
What |
Same issue for me when using the 'yuv' pixelFormat. on 3.0.0 version |
'native' works? |
Yes, native and rgb both work, |
I mean there is a wip PR to use HardwareBuffers instead, see this: https://github.com/mrousavy/react-native-vision-camera/pull/1711/files This will work with every format and should be much faster, but I benchmarked it and for some reason it is much slower than getPlanes(). That's the only reason it isn't merged yet. |
Same error than Syar-tech, im trying to use ML Kit and need the JPEG format or YUV_420_888, but when using pixelformat="yuv" is giving the error The producer output buffer format 0x1 doesn't match the ImageReader's configured buffer format 0x23. |
Just to confirm, are you all using 3.0.0 (the latest release)? And not any rc? |
Yeah @mrousavy the last release, not any rc |
Same error here, I use release version 3.0.0 |
Same, I wrote a test frame processor that only calls It gives the following error when pixelFormat = 'rgb': Also pretty much the same thing happens if I use Edit: Edit2: |
same issue on android pixel 3 / 3.0.0 release. |
Same issue for me on my android pixel. I also tried the solution of @moriax , but I'm still stuck |
I think OpenGL only deals in RGB, my ImageReader is configured to take YUV, JPEG or PRIVATE images but OpenGL just always pushes RGB (JPEG). Not sure if OpenGL can also do other formats like YUV or PRIVATE |
I experimented with using Apparently instead of rendering into OpenGL and converting to RGB, this just passes graphics buffers around. If that is true, then this is more efficient on battery, more performant (better frame rate), and it can do every format (including If anyone wants to test it, please do. |
I took current main branch and now I have next error.
|
Actually hmm, I think there's an issue when recording videos with the
|
Something is wrong in branch
|
Closing as this is a stale issue - this might have been fixed with the full rewrite in VisionCamera V3 (🥳) - if not, please create a new issue. If your issue has been fixed, consider sponsoring me on GitHub to say thanks 💖 JFYI; We now use the GPU HardwareBuffer instead of getPlanes :) |
For the Camera you get to pick one of two output formats (NV21 or YV12), so pick YV12. That's your raw YUV data. For screen capture Or Opengl es render the output will always be RGB or RGBA, so you need to pick RGBA_8888 (format 0x1) for your ImageReader, rather than YUV_420_888 (format 0x23). If you need YUV for that, you will have to do the conversion yourself. The ImageReader gives you a series of Plane objects, not a byte[], so you will need to adapt to that. change code to |
What were you trying to do?
Updating from 3.0.0-rc.4 to 3.0.0-rc.5
Reproduceable Code
What happened instead?
The app crashes on image.getPlanes(). The same when I use frame.toByteBuffer() instead of image.getPlanes().
Relevant log output
Device
Android
VisionCamera Version
3.0.0-rc.5
Additional information
The text was updated successfully, but these errors were encountered: