I am unable to create an media/avc encoder when the OMX.google.h264.encoder is used, I get some pretty strange output:
I/VideoStreamer﹕ Selected color format: 21
I/VideoStreamer﹕ Format: {height=480, slice-height=480, crop-left=0, width=640, crop-bottom=480, crop-top=0, mime=video/avc, stride=640, crop-right=640}
I/VideoStreamer﹕ Width: 640 Height: 480
I/OMXClient﹕ Using client-side OMX mux.
I/SoftAVCEncoder﹕ Construct SoftAVCEncoder
I/ACodec﹕ setupVideoEncoder succeeded
E/OMXNodeInstance﹕ OMX_GetExtensionIndex failed
E/SoftAVCEncoder﹕ Failed to initialize the encoder: -8
E/ACodec﹕ [OMX.google.h264.encoder] ERROR(0x80001001)
E/MediaCodec﹕ Codec reported an error. (omx error 0x80001001, internalError -2147483648)
Whereas the code works on other devices. How can I figure out why the OMX.google.h264.encoder is failing with such an unhelpful error?
For reference: I probe for the list of available encoders, then probe for the list of supported color formats. I work around a few bugs where a device crashes on color format 19 by forcing it to color format 21. I can provide code samples, but it's this specific encoder and I'm at a loss how to figure out what this error is telling me.
EDIT: Found the failure AVCENC_LEVEL_FAIL but still not sure what this is telling me. As far as I know it is not possible to set the level the AVC encoder should use.
The problem with your device is that it probably lacks hardware encoder. Software h264 encoder has significantly limited functionality - among other things it cuts out high quality profiles, because these are likely to under-perform on low-end devices.
If you are working on your own, custom device, you may want to remove this limitation among with setting the encoder level to AVC_LEVEL5_1
. This will unlock your stagefright library and you'll be able to encode high quality videos using software codec.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With