Android MediaCodec not working [closed]

一世执手 提交于 2019-12-19 04:42:13

问题


I'm trying to directly decode the H.264 encoded camera output of the Raspberry Pi camera module on an android device, but my code fails to properly decode the file. I get no output, and as the last frame I get a garbled image.

As I am parsing the input file myself (it is an H.264 byte-stream) into NAL units, I'm left with a question: when feeding them to the MediaCodec buffers, do I feed the NAL unit separator into the buffer as well?


回答1:


The MediaCodec decoder requires an H.264 elementary stream, and wants one access unit per buffer. You also need to supply SPS/PPS before the first data packet (either through the BUFFER_FLAG_CODEC_CONFIG flag or by adding it to the MediaFormat).

See also this question.



来源:https://stackoverflow.com/questions/20077240/android-mediacodec-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!