[Libav-user] Speeding up codec detection of raw bitstream

Wiebe Cazemier wiebe at halfgaar.net
Mon Feb 12 10:53:10 EET 2018

----- Original Message -----
> From: "Carl Eugen Hoyos" <ceffmpeg at gmail.com>
> To: "This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter." <libav-user at ffmpeg.org>
> Sent: Sunday, 11 February, 2018 19:51:56
> Subject: Re: [Libav-user] Speeding up codec detection of raw bitstream

> 2018-02-11 19:09 GMT+01:00 Wiebe Cazemier <wiebe at halfgaar.net>:
>> Correction, it's the following line that takes a while:
>>   avformat_find_stream_info(avFormatContext, NULL);
>> In the docs I find this note with that function: "TODO: Let
>> the user decide somehow what information is needed so
>> that we do not waste time getting stuff the user does not
>> need. ".
>> Still any options available to speed this up?
> Did you test to only enable the demuxers (and decoders) that you need?
> Carl Eugen

I was able to register only AC3 by creating an AVCodec with 'AVCodec* avcodec_find_decoder (enum AVCodecID id)' and using avcodec_register, but it didn't help much.

I did find out the AVFormat instantly recognize it as s/pdif, so apparently those frames are intact. As far as I can tell the meta data doesn't contain which codec it contains, but I need to look into that a little deeper. If it had, ffmpeg would have recognized it, I would say.

But there must be a better way, because home cinema receivers can do it instantly too.

More information about the Libav-user mailing list