native code encoder

799 views
Skip to first unread message

manoj soni

unread,
May 10, 2015, 2:13:35 AM5/10/15
to andro...@googlegroups.com
Hi,
I am trying to use media codec in ndk for hardware encoding. I am referring to the sample native-codec in the new android ndk release. I get failure while I try to configure the encoder. Below are my configuration parameter. I would really appreciate if I can get any help to figure out what could be the problem. 

              

        encoder = AMediaCodec_createEncoderByType("video/avc");

        AMediaFormat *encformat = AMediaFormat_new();

AMediaFormat_setInt64(encformat,AMEDIAFORMAT_KEY_BIT_RATE,125000);

AMediaFormat_setFloat(encformat,AMEDIAFORMAT_KEY_FRAME_RATE,15.0);

AMediaFormat_setInt64(encformat,AMEDIAFORMAT_KEY_COLOR_FORMAT,0x00000013);

AMediaFormat_setInt32(encformat,AMEDIAFORMAT_KEY_WIDTH,352);

AMediaFormat_setInt32(encformat,AMEDIAFORMAT_KEY_HEIGHT,288);

AMediaFormat_setInt32(encformat,AMEDIAFORMAT_KEY_MAX_WIDTH,352);

AMediaFormat_setInt32(encformat,AMEDIAFORMAT_KEY_MAX_HEIGHT,288);

AMediaFormat_setInt32(encformat,AMEDIAFORMAT_KEY_I_FRAME_INTERVAL,5);

AMediaFormat_setInt32(encformat,AMEDIAFORMAT_KEY_STRIDE,352);

AMediaFormat_setString(encformat,AMEDIAFORMAT_KEY_MIME,"video/avc");


      AMediaCodec_configure(encoder,encformat,NULL,NULL,AMEDIACODEC_CONFIGURE_FLAG_ENCODE);


following is the error that I get [OMX.qcom.video.encoder.avc] configureCodec returning error -38.  I am not sure what error -38 means. Also I would like to know if there is any way we can get verbose log from ACodec.Cpp file (any file inside stage fright code). 


Thanks,



Tatyana Blagodarova

unread,
Apr 26, 2016, 1:15:34 PM4/26/16
to android-ndk
Hi, sorry for late response, but in case if it's still important for someone the answer is: you should use AMediaFormat_setInt32 instead of AMediaFormat_setInt64 in all this methods.
Reply all
Reply to author
Forward
0 new messages