[Libav-user] Can't get MPEG4 decoder

Michael IV explomaster at gmail.com
Thu Nov 9 19:26:38 EET 2017


And testing the actual codecId of the video stream in the file I am also
getting NULL for avcodec_find_decoder:

        ret = av_find_best_stream(pFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1,
NULL, 0);
st = pFormatCtx->streams[ret];
AVCodecContext *dec_ctx = NULL;
AVCodec *dec = NULL;
dec_ctx = st->codec;
dec = avcodec_find_decoder(dec_ctx->codec_id);

  * where ec_ctx->codec_id == AV_CODEC_ID_MPEG4*

On Thu, Nov 9, 2017 at 7:22 PM, Michael IV <explomaster at gmail.com> wrote:

> Hi, thanks for the input. Now I am confused even more. All  I need is to
> start demuxing an mp4 file. Those codecs test above is not what I do.
> I started to check those because I am getting into trouble in this part:
>
>         pFormatCtx = avformat_alloc_context();  //ok
> AVDictionary *d = NULL;
> av_dict_set(&d, "protocol_whitelist","file", 0);  //ok
>         int ret = avformat_open_input(&pFormatCtx, in_f_name , NULL,
> &d);  //ok
>          avformat_find_stream_info(pFormatCtx, NULL) ///also ok
>
> But once I get to access the codecpar I hit  "access violation reading
> location:
>
> *pFormatCtx->streams[i]->codecpar->codec_type==AVMEDIA_TYPE_VIDEO*
>
> Because my *codecpar *is not initialized. That's what I don't understand
> here.
>
>
>
>
>
> On Nov 9, 2017 8:14 PM, "Carl Eugen Hoyos" <ceffmpeg at gmail.com> wrote:
>
>> Hi!
>>
>> > Am 09.11.2017 um 17:13 schrieb Michael IV <explomaster at gmail.com>:
>> >
>> > Hi All. What maybe a reason that  avcodec_find_decoder returns NULL ?
>> >
>> > I enabled in my FFMPEG build MOV and h264 demuxer. Configure report
>> clearly
>> > states that.
>> >
>> > But doing this test:
>> >
>> >          av_register_all();
>> >        avcodec_register_all();
>> >          avformat_network_init();
>> >          AVCodec* h264codc = avcodec_find_decoder_by_name("h264");
>>
>> This is supposed to work.
>>
>>
>> >        AVCodec* h264codc1 = avcodec_find_decoder_by_name("MOV");
>>
>> This is not the name of any decoder, mov is a file format, you will find
>> a demuxer (and a muxer) with that name (I think).
>>
>> >        AVCodec* h264codc3 = avcodec_find_decoder_by_name("MPEG4");
>>
>> There is codec "mpeg4" but that's not h264.
>>
>> >        AVCodec* h264codc4 = avcodec_find_decoder_by_name("MP4");
>>
>> See above for mov, although the same demuxer handles mov and mp4.
>>
>> >        AVCodec* h264codc5 = avcodec_find_decoder(AV_CODEC_ID_MPEG4);
>>
>> Again, this codec exists but it's not h264.
>>
>> > Only h264codc  returns a valid codec.
>>
>>
>> > The only thing I didn't do during build config was not to enable
>> libx264.
>>
>> This only means that you have no h264 encoder.
>>
>> > May this be the source of the problem? I didn't do that because I just
>> need to demux  mp4 movie and get its elementary stream.
>>
>> Then you don't care about a decoder, you only need a demuxer (and maybe a
>> parser).
>>
>> Carl Eugen
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20171109/402475d0/attachment.html>


More information about the Libav-user mailing list