Hi everyone,<br><br>I am trying to use FFmpeg's mediacodec wrappers on Android to speed up some h264 decoding.<br><br>First if someone has a good exemple of how to use ffmpeg + mediacodec natively I would be pleased to see it !<br><br>I have compiled ffmpeg using --enable-decoder=h264_mediacodec --enable-mediacodec --enable-hwaccel=h264_mediacodec and I have trouble using the mediacodec decoder. I detect the h264_mediacodec but cannot open it (return is -542398533, not very explicit). Do I have to set the codec context in some special manner to use HW acceleration ? Also h264 and h264_mediacodec seems to have the same id, how would the decoder know which one to use ? <br><br>Regards,<br>Yoann<br><br><br><br>int open_stream_component(VideoState *vs, int stream_index){<br><br>    AVFormatContext *format_context = vs->format_context;<br>    AVCodecParameters *codec_parameters = NULL;<br>    AVCodecContext *codec_context = NULL;<br>    AVCodec *codec = NULL;<br>    AVDictionary *options_dict = NULL;<br>    SDL_AudioSpec wanted_spec, spec;<br><br>    codec_parameters = format_context->streams[stream_index]->codecpar;<br><br>    AVCodec * cdc = av_codec_next(NULL);<br>    while(cdc != NULL){<br>        SDL_Log("%s\n", cdc->long_name);<br>        cdc = av_codec_next(cdc);<br>    }<br><br>    if(codec_parameters->codec_type == AVMEDIA_TYPE_VIDEO){<br>      codec = avcodec_find_decoder_by_name("h264_mediacodec");<br>    } else if(codec_parameters->codec_type == AVMEDIA_TYPE_AUDIO){<br>      codec = avcodec_find_decoder_by_name("aac");<br>    }<br><br>     SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Codec is %s \n",codec->long_name);<br><br>    codec_context = avcodec_alloc_context3(codec);<br>    avcodec_parameters_to_context(codec_context, codec_parameters);<br>    codec_context->codec_id = codec->id;<br><br>    // Error here<br>    int ret = 0;<br>    if((ret = avcodec_open2(codec_context, codec, &options_dict)) < 0) {<br>        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't open codec, ret = %d", ret);<br>        return -1;<br>    }<br>    <br>    /* end of code */ <br>}<br>    <br>Corresponding Logcat  :<br>01-05 17:30:04.350: W/SDL/APP(12633): Main thread tid : 12659<br>01-05 17:30:04.470: V/SDL(12633): onWindowFocusChanged(): true<br>01-05 17:30:15.610: I/SDL/APP(12633):  ===== Setting input file ===== <br>01-05 17:30:15.610: I/SDL/APP(12633): In set_in_path : in_filepath = /storage/emulated/0/Movies/test.mp4<br>01-05 17:30:15.610: I/SDL/APP(12633):  ===== Start ===== <br>01-05 17:30:15.610: W/SDL/APP(12633): demux_thread tid : 13218<br>01-05 17:30:15.700: I/SDL/APP(12633): Network stream open and header read<br>01-05 17:30:15.800: I/SDL/APP(12633): H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10<br>01-05 17:30:15.800: I/SDL/APP(12633): H.264 Android MediaCodec decoder<br>01-05 17:30:15.800: I/SDL/APP(12633): MJPEG (Motion JPEG)<br>01-05 17:30:15.800: I/SDL/APP(12633): AAC (Advanced Audio Coding)<br>01-05 17:30:15.800: I/SDL/APP(12633): MP3 (MPEG audio layer 3)<br>01-05 17:30:15.800: I/SDL/APP(12633): Codec is H.264 Android MediaCodec decoder <br>01-05 17:30:15.800: E/SDL/APP(12633): Can't open codec, ret = -542398533<br>01-05 17:30:15.810: I/SDL/APP(12633):  ===== Stop ===== <br><div><br><br></div>