Android的媒体codeC不工作 [英] Android MediaCodec not working

查看:147
本文介绍了Android的媒体codeC不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想c中的H.264连接的树莓派相机模块的Andr​​oid设备上codeD摄像机直接输出去$ C $,但我的code无法正常去code文件。我没有得到任何输出,并作为最后一帧,我收到了乱码的形象。

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.

由于我解析输入文件自己(这是一个H.264的字节流)为NAL单元,我留下了一个问题:当它们喂到媒体codeC的缓冲区,做我喂NAL单元分离到缓冲区中呢?

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?

推荐答案

媒体codeC 德codeR需要一个H.264基本流,和希望每个缓冲区一个存取单元。您还需要提供SPS / PPS的第一个数据包之前(通过 BUFFER_FLAG_ codeC_CONFIG 标记或将其添加到 MediaFormat )。

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).

另请参见<一个href="http://stackoverflow.com/questions/19742047/how-to-use-media$c$cc-without-mediaextractor-for-h264">this问题。

这篇关于Android的媒体codeC不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆