简体   繁体   English

FFmpeg似乎是版本冲突

[英]FFmpeg seems to be version conflict

I am using git version of ffmpeg( renewed after old version succesful using) , when i try to compile my project i get 我正在使用ffmpeg的git版本(在成功使用旧版本后更新),当我尝试编译我的项目时,我得到了

 /usr/local/lib/libavcodec.a(opusdec.o): In function `opus_decode_subpacket':
/home/user/projects/ffmpleglast/ffmpeg/libavcodec/opusdec.c:376: undefined reference to `swr_is_initialized'
/usr/local/lib/libavcodec.a(opusdec.o): In function `opus_decode_frame':
/home/user/projects/ffmpleglast/ffmpeg/libavcodec/opusdec.c:222: undefined reference to `swr_is_initialized'
/usr/local/lib/libavcodec.a(opusdec.o): In function `opus_init_resample':
/home/user/projects/ffmpleglast/ffmpeg/libavcodec/opusdec.c:163: undefined reference to `swr_init'
/home/user/projects/ffmpleglast/ffmpeg/libavcodec/opusdec.c:169: undefined reference to `swr_convert'
/usr/local/lib/libavcodec.a(opusdec.o): In function `opus_decode_frame':
/home/user/projects/ffmpleglast/ffmpeg/libavcodec/opusdec.c:236: undefined reference to `swr_convert'
/usr/local/lib/libavcodec.a(opusdec.o): In function `opus_flush_resample':
/home/user/projects/ffmpleglast/ffmpeg/libavcodec/opusdec.c:117: undefined reference to `swr_convert'
/usr/local/lib/libavcodec.a(opusdec.o): In function `opus_decode_subpacket':
/home/user/projects/ffmpleglast/ffmpeg/libavcodec/opusdec.c:408: undefined reference to `swr_close'
/usr/local/lib/libavcodec.a(opusdec.o): In function `opus_decode_flush':
/home/user/projects/ffmpleglast/ffmpeg/libavcodec/opusdec.c:557: undefined reference to `swr_close'
/usr/local/lib/libavcodec.a(opusdec.o): In function `opus_decode_close':
/home/user/projects/ffmpleglast/ffmpeg/libavcodec/opusdec.c:579: undefined reference to `swr_free'
/usr/local/lib/libavcodec.a(opusdec.o): In function `opus_decode_init':
/home/user/projects/ffmpleglast/ffmpeg/libavcodec/opusdec.c:629: undefined reference to `swr_alloc'

Seems to be version conflict? 好像是版本冲突? but how to delete wrong libs? 但是如何删除错误的库? they seem to be todays build. 他们似乎是今天的建筑。

ls -l /usr/local/lib
-rw-r--r-- 1 root root  136509684 may   29 14:47 libavcodec.a
-rw-r--r-- 1 root root    1853574 may   29 14:47 libavdevice.a
-rw-r--r-- 1 root root    9689456 may   29 14:47 libavfilter.a
-rw-r--r-- 1 root root   46282270 may   29 14:47 libavformat.a
-rw-r--r-- 1 root root    2092250 may   29 14:47 libavutil.a
-rw-r--r-- 1 root root      67942 may   12 11:29 libBasicUsageEnvironment.a
-rw-r--r-- 1 root root    2200164 apr.  10 10:11 libfftw3.a
-rwxr-xr-x 1 root root        872 apr.  10 10:11 libfftw3.la
-rw-r--r-- 1 root root      94188 may   12 11:29 libgroupsock.a
-rw-r--r-- 1 root root    2236084 may   12 11:29 libliveMedia.a
-rw-r--r-- 1 root root     546506 may   29 14:47 libswresample.a
-rw-r--r-- 1 root root    4813716 may   29 14:47 libswscale.a
-rw-r--r-- 1 root root      14588 may   12 11:29 libUsageEnvironment.a

I was getting these same kinds of errors when I was building a DLL which tried to pull in the ffmpeg DLLs. 当我构建试图引入ffmpeg DLL的DLL时,我遇到了同样的错误。

I was missing the extern C statement around the ffmpeg include files : 我在ffmpeg包含文件周围缺少extern C语句:

extern "C"
{
#include "include\libavcodec\avcodec.h"
#include "include\libavformat\avformat.h"
#include "include\libavformat\avio.h"
#include "include\libswscale\swscale.h"
#include "include\libavutil\dict.h"
#include "include\libavutil\frame.h"
}

I also found that I needed to add the DLLs to the solution as dependencies or use the pragma statements to get it to include. 我还发现我需要将DLL作为依赖项添加到解决方案中,或使用pragma语句来将其包括在内。

#pragma comment(lib, "..\\..\\..\\..\\contrib\\ffmpeg\\lib\\avformat.lib")
#pragma comment(lib, "..\\..\\..\\..\\contrib\\ffmpeg\\lib\\swscale.lib")
#pragma comment(lib, "..\\..\\..\\..\\contrib\\ffmpeg\\lib\\avutil.lib")

This was on windows and simply tells VS that the lib files specified detail the interfaces for DLLs in those same locations. 这是在Windows上,只是告诉VS,指定的lib文件详细说明了相同位置DLL的接口。 You won't need that on linux as your -lavformat etc statements should cover it, but I suspect you might need the extern C part. 您不需要在Linux上使用它,因为您的-lavformat etc语句应该可以覆盖它,但是我怀疑您可能需要extern C部分。

If its still not helping, maybe use verbose mode on the compile/link so you can see what's coming in from which locations. 如果仍然无法解决问题,则可以在编译/链接上使用详细模式,以便您查看来自何处的内容。

You probably have also ffmpeg installed in system (in /usr/lib and /usr/include). 您可能还已经在系统中安装了ffmpeg(在/ usr / lib和/ usr / include中)。 Try to force include path with -I parameter (/usr/local/include) and library path with -L parameter (/usr/local/lib) 尝试使用-I参数(/ usr / local / include)强制包含路径,使用-L参数(/ usr / local / lib)强制包含库路径

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

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