[Libav-user] Question about MediaCodec decoder in FFmpeg

Zhen Mike mikezhen0707 at gmail.com
Wed May 16 12:45:57 EEST 2018


    Hello.
    I'm using FFmpeg-built-in MediaCodec decoder to decode h264 stream like
this:

```
    AVCodec *codec = avcodec_find_decoder_by_name("h264_mediacodec");
    AVCodecContext *context = avcodec_alloc_context3(codec);
    int ret = avcodec_open2(context, codec, NULL);
    if(ret < 0)
    {
        __android_log_print(ANDROID_LOG_ERROR, "ffmpeg", "fail open
codec.[%d]", ret);
    }
```

    I get the error message. But if I write this way:

```
    AVCodec *codec = avcodec_find_decoder(AV_CODEC_ID_H264);
    AVCodecContext *context = avcodec_alloc_context3(codec);
    int ret = avcodec_open2(context, codec, NULL);
    if(ret < 0)
    {
        __android_log_print(ANDROID_LOG_ERROR, "ffmpeg", "fail open
codec.[%d]", ret);
    }
```

    Program runs quite fine. I guess it's about some factors in
AVCodecContext. If so, could you inform me of what these factors are?

    Best wishes!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180516/453d2636/attachment.html>


More information about the Libav-user mailing list