demuxer.cpp:(.text+0x8a): undefined reference to `avformat_open_input(AVFormatContext**, char const*, AVInputFormat*, AVDictionary**)'
时间: 2024-08-14 14:05:19 浏览: 138
`demuxer.cpp:(.text+0x8a): undefined reference to 'avformat_open_input(AVFormatContext**, char const*, AVInputFormat*, AVDictionary**)'` 这是一个链接时未找到的错误,通常出现在使用FFmpeg库的C++代码中。这个错误表明编译器在尝试连接(link)过程中找不到`avformat_open_input`函数的定义,这可能是由于以下几个原因:
1. **缺少头文件包含**: 没有包含必要的FFmpeg头文件,如`<libavformat/avformat.h>`,你需要确保包含了该文件,以便告诉编译器函数原型。
2. **库路径设置不正确**: 如果FFmpeg库不是系统默认搜索路径的一部分,你需要添加正确的库目录到`LD_LIBRARY_PATH`或者项目的构建配置中。
3. **未链接FFmpeg库**: 编译期间可能只链接了源代码需要的部分,但运行时需要完整的FFmpeg库。确认链接命令中是否包含了`-lavformat`或其他相关库选项。
4. **版本兼容问题**: 确保使用的FFmpeg版本与你的代码兼容,某些API可能会在不同版本之间有所改变。
相关问题
const AVClass rtsp_demuxer_class = { .class_name = "RTSP demuxer", .item_name = av_default_item_name, .option = options, .version = LIBAVUTIL_VERSION_INT, };
这是一个定义了 AVClass 结构体变量 rtsp_demuxer_class 的代码段。AVClass 结构体用于存储 FFmpeg 库中的类成员(class members),包括类名、选项和版本等信息。在这个示例中,AVClass 结构体的 class_name 字段被设置为 "RTSP demuxer",表示这个类是用于 RTSP 协议的解复用器。item_name 字段设置为 av_default_item_name,表示该类的默认项名可以由 FFmpeg 库提供的 av_default_item_name() 函数生成。option 字段指向一个 AVOption 数组,其中包含了一些可供使用者配置的选项。version 字段设置为 LIBAVUTIL_VERSION_INT,表示该类的 FFmpeg 版本要求为 LIBAVUTIL_VERSION_INT 所定义的版本号。
License: nonfree and unredistributable WARNING: arm-linux-gnueabihf-pkg-config not found, library detection may fail. libavutil/avconfig.h is unchanged libavcodec/parser_list.c is unchanged libavcodec/bsf_list.c is unchanged libavformat/demuxer_list.c is unchanged libavformat/muxer_list.c is unchanged libavformat/protocol_list.c is unchanged
这段信息来自于 FFmpeg 的编译输出,其中包含了几个不同的内容:
1. `License: nonfree and unredistributable`:这是 FFmpeg 中 libx264 库的许可证信息,说明该库是非自由和不可再分发的。
2. `WARNING: arm-linux-gnueabihf-pkg-config not found, library detection may fail.`:这是一个警告信息,说明在编译 FFmpeg 时没有找到 `arm-linux-gnueabihf-pkg-config` 工具,这可能会导致库检测失败。
3. `libavutil/avconfig.h is unchanged`、`libavcodec/parser_list.c is unchanged` 等类似的信息:这些是编译过程中自动生成的文件,如果没有被修改,就会输出这些信息,表示没有更新过文件。
需要注意的是,由于 libx264 的许可证限制,如果你要将 FFmpeg 与 libx264 一起编译并分发,需要确保你符合许可证的要求。
阅读全文
相关推荐















