-
Notifications
You must be signed in to change notification settings - Fork 26
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
Getting Exception ava.lang.UnsupportedOperationException: The producer output buffer format 0x1 doesn't match the ImageReader's configured buffer format 0x4. #1
Comments
On what device are you facing this issue if I may know? :) |
I have the same Issue on a Samsung S4 mini GT-I9195, Android Version 6.0.1. |
I also have the same crash on my Nexus 5x. If I use ARGB_8888 it doesn'T crash, but i get a black image. Would be nice if you could figure out what's wrong. I was investigating the last two days to get an image (bitmap) out of the current screen... |
I changed as follows: Seems to work |
@moster67 I also tried this one, but just got a black image on my Nexus 5x. Do you get a correct image? |
I'm really sorry. I realise that this issue is bugging a lot people. |
@Fishfield I tried on Nexus4 but I will this evening try on some other devices and then report back. |
@omerjerk No worries. I still appreciate your work and that you shared it with us. |
I searched around in the interenet a lot the last months and the solution with the ImageReader API was the most found answer. I am just curious why it worked for them although the solution was exactly the same as mine. @omerjerk did it ever work for you? |
@omerjerk I am curious about how you implemented it in your screenshot application on the play store? |
Hi, |
Hi @Raphdeumax If you are getting a black image while screenshotting youtube app, it might be possible that youtube has made it's display secure. You can read about secure display here - https://developer.android.com/reference/android/view/Display.html#FLAG_SECURE |
@omerjerk, Thanks for your repsonse, i will investigate on the secure flag. |
For information, i has the same problem using OpenGL. |
Hello, thank you |
worked on my Samsung phone, but no save to media folder as of yet |
The producer output buffer format is 0x1 in some android emulator,and is 0x2 in some android emulator, I don't get the compatible idea |
I think what can we do is catch the exception and get the producer output format info, then recreate the ImageReader in the format |
I got an error saying that |
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 |
Process: com.jni.screenshotter, PID: 1511
java.lang.UnsupportedOperationException: The producer output buffer format 0x1 doesn't match the ImageReader's configured buffer format 0x4.
at android.media.ImageReader.nativeImageSetup(Native Method)
at android.media.ImageReader.acquireNextSurfaceImage(ImageReader.java:298)
at android.media.ImageReader.acquireNextImage(ImageReader.java:344)
at android.media.ImageReader.acquireLatestImage(ImageReader.java:248)
at in.omerjerk.libscreenshotter.Screenshotter.onImageAvailable(Screenshotter.java:107)
at android.media.ImageReader$ListenerHandler.handleMessage(ImageReader.java:548)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
The text was updated successfully, but these errors were encountered: