What does error code -1010 in Android MediaCodec mean?

Chickin Nick picture Chickin Nick · Apr 28, 2016 · Viewed 7.8k times · Source

Here is the stack trace:

 E/ACodec: [OMX.qcom.video.encoder.avc] configureCodec returning error -1010
 E/ACodec: signalError(omxError 0x80001001, internalError -1010)
 E/MediaCodec: Codec reported err 0xfffffc0e, actionCode 0, while in state 3
 E/MediaCodec: configure failed with err 0xfffffc0e, resetting...
W/System.err: android.media.MediaCodec$CodecException: Error 0xfffffc0e
W/System.err:     at android.media.MediaCodec.native_configure(Native Method)
W/System.err:     at android.media.MediaCodec.configure(MediaCodec.java:1778)

Crash is on Nexus 6P.

Initialization of mediaCodec:

videoCodec = MediaCodec.createEncoderByType(MIME_VIDEO_CODEC_H264);

        MediaFormat videoFormat = MediaFormat.createVideoFormat(MIME_VIDEO_CODEC_H264, imageWidth, imageHeight);
        videoFormat.setInteger(MediaFormat.KEY_BIT_RATE, camera.getBitrate());
        videoFormat.setInteger(MediaFormat.KEY_FRAME_RATE, camera.getFrameRate());
        videoFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
        videoFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 0);
        videoCodec.configure(videoFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);

Answer

Nic Robertson picture Nic Robertson · Oct 25, 2016

I had this issue while i was trying to encode 16:9 videos to .h264 and change the frame size (it worked fine with 4:3).

The fix for me was to ensure that the height and width of the output format were divisible by 2. If they weren't, I just rounded them up so they did.