I'm trying to applying an encoder by using MediaCodec. The MediaFormat I use is as follows.
MediaFormat mediaFormat = MediaFormat.createVideoFormat("video/mp4v-es", 640, 480);
mediaFormat.setInteger(MediaFormat.KEY_BIT_RATE, 125000);
mediaFormat.setInteger(MediaFormat.KEY_FRAME_RATE, 15);
mediaFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT,MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV422PackedSemiPlanar);
mediaFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 5);
The demo runs well on virtual machine. However, it fails when I test it on the real machine(Samsung Galaxy Tab GT3113). The demo reports errors at the line codec.configure(mediaFormat, null /* surface */, null /* crypto */, MediaCodec.CONFIGURE_FLAG_ENCODE /* flags */); codec.start();
The logcat says:
06-24 15:16:54.582: E/ACodec(3146): [OMX.TI.DUCATI1.VIDEO.MPEG4E] does not support color format 19 06-24 15:16:54.582: E/ACodec(3146): [OMX.TI.DUCATI1.VIDEO.MPEG4E] configureCodec returning error -2147483648
06-24 15:16:54.582: E/MediaCodec(3146): Codec reported an error. (omx error 0x80001001, internalError -2147483648)
I have tried all the KEY_COLOR_FORMAT which are provied by Android, but none of them works. Can anyone help me? Thanks!