I am using the MediaCodec class to decode a .mp4 video using the code given in this link.

I am able to get the rendered output on the screen, but when I try to access the outputBuffers[outIndex], I get a null pointer error. I cannot figure out how to access the frame buffer to do some processing on it.

有帮助吗?

解决方案

That's the expected (albeit undocumented) behavior. You can either send the output to a ByteBuffer or to a Surface, but not both.

Some additional examples that may be of interest are available here. If you decode to a SurfaceTexture you can render the texture twice, once to a View and once to a pbuffer surface. You can either use glReadPixels to get the data and process it, or do your processing in a GLES shader.

If you extract to a ByteBuffer, you have to interpret the data yourself, which is difficult on devices that use a proprietary output format. You'll note from the buffer-to-buffer CTS tests that some devices aren't checked because the format isn't known.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top