Reputation: 547
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);
Upvotes: 12
Views: 11414
Reputation: 99
In my case the issue was that I was trying to set constant bitrate without setting the MediaFormat.KEY_QUALITY and I saw a clear message in logcat (not marked as an error) that encoder need this value, as soon as I set variable bitrate the encoder configured.
I suggest querying the available encoders for it's capabilities to see what encoder profile and level is available, also a color format need to be supported all of these is available in MediaCodecInfo.
Here is a snippet from the code I used
val encoders = getHWCapableEncoders("avc")
for (encoder in encoders) {
try {
val codecCap = encoder.getCapabilitiesForType("video/avc")
for (profile in codecCap.profileLevels ) {
if (profile.profile == MediaCodecInfo.CodecProfileLevel.AVCProfileHigh ) {
outputVideoFormat!!.setInteger(MediaFormat.KEY_PROFILE, profile.profile);
outputVideoFormat!!.setInteger(MediaFormat.KEY_LEVEL, profile.level)
break
}
}
codecCap.encoderCapabilities.qualityRange
videoEncoder = MediaCodec.createByCodecName(encoder.name)
videoEncoder!!.configure(outputVideoFormat,null, null, MediaCodec.CONFIGURE_FLAG_ENCODE)
break;
} catch (err:java.lang.Exception) {
err.printStackTrace();
}
}
videoEncoder!!.start()
And here is a function to get encoders:
fun getHWCapableEncoders(mimeType: String): ArrayList<MediaCodecInfo> {
val list = MediaCodecList(MediaCodecList.REGULAR_CODECS);
var result:ArrayList<MediaCodecInfo> = ArrayList<MediaCodecInfo>();
for(codecInfo in list.codecInfos) {
Log.i("CodecInfo", codecInfo.name)
if(codecInfo.name.contains(mimeType) && codecInfo.isEncoder && codecInfo.isHardwareAccelerated) {
result.add(codecInfo);
}
}
return result;
}
Also make sure to set the color format
outputVideoFormat!!.setInteger(MediaFormat.KEY_COLOR_FORMAT, COLOR_FormatYUV420Flexible)
This is for video encoder which is in my opinion more problematic then the audio encoder.
Upvotes: 1
Reputation: 1208
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.
Upvotes: 23
Reputation: 52353
That appears to be an internal error reported by the Qualcomm codec implementation (OMX.qcom.video.encoder.avc).
It might be harmless, it might indicate a configuration problem, or a different configuration problem, or some other configuration problem. Mostly it just seems to indicate that it didn't like your configuration, without providing any particular insight into why.
The error code is somewhat useless, so you have to start with values that are known to work and change them one at a time until something breaks. What are the actual values you're passing for bit/frame rate?
Upvotes: 7