AmN
AmN

Reputation: 331

C++, FFMpeg: Unable to find any decoder or encoder

I have been using this sample https://ffmpeg.org/doxygen/trunk/decoding__encoding_8c.html as reference for my C++ application. I have used the same code as in the given page. I have linked the libraries, placed the dlls and compiled with no errors. Everything works except that it always throws: Codec not found error.

/* find the MPEG-1 video decoder */
codec = avcodec_find_decoder(AV_CODEC_ID_MP2);
if (!codec) {
    fprintf(stderr, "Codec not found\n");
    exit(1);
}

I have changed the line to AV_CODEC_ID_MP2 in this, just to test if only the MPEG codex was missing but seems like all are missing. I have tried changing this to multiple codecs as defined in avcodec.h file (enum AVCodecID, line 189), but all return "Codec not found".

Am I missing something?

Compiler: Microsoft Visual Studio 2015 Community Edition Project Type: QTProject

Oh and I am trying to make a Video Player just to enhance my c++ skills during these holidays. First I was trying QTMediaPlayer Widget, but it was throwing crazy errors on "DirectShowPlay::doRender" or something like that. So I switched to FFMpeg, but this too doesn't work.

Thank you for reading my question.

Upvotes: 0

Views: 473

Answers (1)

AmN
AmN

Reputation: 331

Oh nevermind. It was my mistake. I forgot to avcodec_register_all(); lol

Upvotes: 1

Related Questions