I am trying to run the example code of Media Codec API with H264 Encoder on 4.3 explained in following link of bigflake
http://bigflake.com/mediacodec/CameraToMpegTest.java.txt
I have faced following problem. -> In H264 encoder code the color format,height and width are not getting updated because there is problem in getpatameter implemetation. So i applied this patch (https://code.google.com/p/android/issues/detail?id=58834). -> After applying the patch,also encoder does not encode -> I have seen the observation like D/CameraToMpegTest( 3421): encoder output format changed: {csd-1=java.nio.ByteArrayBuffer[position=0,limit=8,capacity=8], height=144, mime=video/avc, csd-0=java.nio.ByteArrayBuffer[position=0,limit=12,capacity=12], what=1869968451, width=176}
SO why this value is getting changed, No idea... After that we always see encoder gives status of queueOutputBuffer as INFO_TRY_AGAIN_LATER. So it creates the file but it does not encode anything and it stops as
I/MPEG4Writer( 3421): Received total/0-length (0/0) buffers and encoded 0 frames. - video
D/MPEG4Writer( 3421): Stopping Video track
D/MPEG4Writer( 3421): Stopping Video track source
D/MPEG4Writer( 3421): Video track stopped
D/MPEG4Writer( 3421): Stopping writer thread
D/MPEG4Writer( 3421): 0 chunks are written in the last batch
D/MPEG4Writer( 3421): Writer thread stopped
So in my understanding it should work but looks like still encoder is not getting configured properly...
Please guide on this... Thanks
Nehal