gpt4 book ai didi

ffmpeg - 未找到 avcodec 符号

转载 作者:行者123 更新时间:2023-12-04 22:56:24 25 4
gpt4 key购买 nike

我正在尝试在 FFMPEG 库中构建示例代码
我在我的项目中添加 libavcode.h , libavcode.a 并将标题搜索 usr/local/include 和库搜索设置为 usr/local/lib

当我编译示例时,我得到了这个错误......(所有这些都与 avcodec 库有关)

{

Undefined symbols:
"avcodec_find_encoder(CodecID)", referenced from:
video_encode_example(char const*, CodecID)in main.o
"avcodec_open2(AVCodecContext*, AVCodec*, AVDictionary**)", referenced from:
video_encode_example(char const*, CodecID)in main.o
video_decode_example(char const*, char const*)in main.o
"av_init_packet(AVPacket*)", referenced from:
video_decode_example(char const*, char const*)in main.o
"av_free(void*)", referenced from:
video_encode_example(char const*, CodecID)in main.o
video_encode_example(char const*, CodecID)in main.o
video_encode_example(char const*, CodecID)in main.o
video_decode_example(char const*, char const*)in main.o
video_decode_example(char const*, char const*)in main.o
"avcodec_alloc_context3(AVCodec*)", referenced from:
video_encode_example(char const*, CodecID)in main.o
video_decode_example(char const*, char const*)in main.o
"av_opt_set(void*, char const*, char const*, int)", referenced from:
video_encode_example(char const*, CodecID)in main.o
"av_image_alloc(unsigned char**, int*, int, int, PixelFormat, int)", referenced from:
video_encode_example(char const*, CodecID)in main.o
"avcodec_encode_video(AVCodecContext*, unsigned char*, int, AVFrame const*)", referenced from:
video_encode_example(char const*, CodecID)in main.o
video_encode_example(char const*, CodecID)in main.o
"avcodec_register_all()", referenced from:
_main in main.o
"avcodec_find_decoder(CodecID)", referenced from:
video_decode_example(char const*, char const*)in main.o
"avcodec_decode_video2(AVCodecContext*, AVFrame*, int*, AVPacket const*)", referenced from:
video_decode_example(char const*, char const*)in main.o
video_decode_example(char const*, char const*)in main.o
"avcodec_close(AVCodecContext*)", referenced from:
video_encode_example(char const*, CodecID)in main.o
video_decode_example(char const*, char const*)in main.o
"avcodec_alloc_frame()", referenced from:
video_encode_example(char const*, CodecID)in main.o
video_decode_example(char const*, char const*)in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

}
你知道我为什么会遇到这个问题吗?

谢谢

最佳答案

解决方案是将其添加到标题中,因为 FFMPEG 是用 C 编写的,我猜

extern "C"
{
#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#endif
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include "avassert.h"
#include "avutil.h"
#include "intreadwrite.h"
#include "mem.h"
}

关于ffmpeg - 未找到 avcodec 符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15072677/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com