简体   繁体   English

C ++,FFMpeg:找不到任何解码器或编码器

[英]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. 我一直在使用此示例https://ffmpeg.org/doxygen/trunk/decoding__encoding_8c.html作为我的C ++应用程序的参考。 I have used the same code as in the given page. 我使用了与给定页面中相同的代码。 I have linked the libraries, placed the dlls and compiled with no errors. 我已经链接了库,放置了dll,并且编译没有错误。 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. 我已经将行更改为AV_CODEC_ID_MP2,只是为了测试是否仅缺少MPEG Codex,但似乎所有内容都不存在。 I have tried changing this to multiple codecs as defined in avcodec.h file (enum AVCodecID, line 189), but all return "Codec not found". 我尝试将其更改为avcodec.h文件(枚举AVCodecID,第189行)中定义的多个编解码器,但全部返回“找不到编解码器”。

Am I missing something? 我想念什么吗?

Compiler: Microsoft Visual Studio 2015 Community Edition Project Type: QTProject 编译器:Microsoft Visual Studio 2015社区版项目类型:QTProject

Oh and I am trying to make a Video Player just to enhance my c++ skills during these holidays. 哦,我正试图制作一个视频播放器,目的只是为了增强我的c ++技能。 First I was trying QTMediaPlayer Widget, but it was throwing crazy errors on "DirectShowPlay::doRender" or something like that. 首先,我尝试使用QTMediaPlayer Widget,但是它在“ DirectShowPlay :: doRender”或类似的东西上引发了疯狂的错误。 So I switched to FFMpeg, but this too doesn't work. 所以我切换到FFMpeg,但这也行不通。

Thank you for reading my question. 感谢您阅读我的问题。

Oh nevermind. 哦,没关系。 It was my mistake. 是我的错 I forgot to avcodec_register_all(); 我忘了avcodec_register_all(); lol 大声笑

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM