How to solve the Android MediaCodec error after setting “csd-0” and “csd-1”?

风流意气都作罢 提交于 2019-12-13 07:56:27

问题


I use the MediaCodec to encode video stream and i need to set the "csd-0" and "csd-1" as following according to here:

byte[] sps = { 0, 0, 0, 1, 103, 100, 0, 40, -84, 52, -59, 1, -32, 17, 31, 120, 11, 80, 16, 16, 31, 0, 0, 3, 3, -23, 0, 0, -22, 96, -108 };
byte[] pps = { 0, 0, 0, 1, 104, -18, 60, -128 };
MediaFormat format = MediaFormat.createVideoFormat("video/avc", width, height);
format.setByteBuffer("csd-0", ByteBuffer.wrap(sps));
format.setByteBuffer("csd-1", ByteBuffer.wrap(pps));
...

But i got an error:

format: {frame-rate=15, height=1280, csd-0=java.nio.ByteArrayBuffer[position=0,limit=31,capacity=31], color-format=2130708361, width=720, bitrate=819200, csd-1=java.nio.ByteArrayBuffer[position=0,limit=8,capacity=8], mime=video/avc, i-frame-interval=3}
E/ACodec  ( 2692): [OMX.Exynos.AVC.Encoder] ERROR(0x80001006)
E/MediaCodec( 2692): Codec reported an error. (omx error 0x80001006, internalError -2147483648)

PS: The os version is Android 4.4.2 and soc is Exynos5430

来源:https://stackoverflow.com/questions/32448654/how-to-solve-the-android-mediacodec-error-after-setting-csd-0-and-csd-1

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