ffmpeg 编译问题

unix_net 2010-12-15 11:26:20
交叉编译ffmpeg 没有问题,安装也没有问题,可是在编译例子时出现头文件找不到
是交叉编译配置有问题吗???
opt/Atmel/arm-2007q1/bin/arm-linux-gcc -o tt tutorial01.c -lavformat -lavcodec -lz -lm
tutorial01.c:22:21: error: avcodec.h: No such file or directory
tutorial01.c:23:22: error: avformat.h: No such file or directory
tutorial01.c:27: error: expected ')' before '*' token
tutorial01.c: In function 'main':
tutorial01.c:50: error: 'AVFormatContext' undeclared (first use in this function)
tutorial01.c:50: error: (Each undeclared identifier is reported only once
tutorial01.c:50: error: for each function it appears in.)
tutorial01.c:50: error: 'pFormatCtx' undeclared (first use in this function)
tutorial01.c:52: error: 'AVCodecContext' undeclared (first use in this function)
tutorial01.c:52: error: 'pCodecCtx' undeclared (first use in this function)
tutorial01.c:53: error: 'AVCodec' undeclared (first use in this function)
tutorial01.c:53: error: 'pCodec' undeclared (first use in this function)
tutorial01.c:54: error: 'AVFrame' undeclared (first use in this function)
tutorial01.c:54: error: 'pFrame' undeclared (first use in this function)
tutorial01.c:55: error: 'pFrameRGB' undeclared (first use in this function)
tutorial01.c:56: error: 'AVPacket' undeclared (first use in this function)
tutorial01.c:56: error: expected ';' before 'packet'
tutorial01.c:59: error: 'uint8_t' undeclared (first use in this function)
tutorial01.c:59: error: 'buffer' undeclared (first use in this function)
tutorial01.c:82: error: 'CODEC_TYPE_VIDEO' undeclared (first use in this function)
tutorial01.c:111: error: 'PIX_FMT_RGB24' undeclared (first use in this function)
tutorial01.c:113: error: expected expression before ')' token
tutorial01.c:118: error: 'AVPicture' undeclared (first use in this function)
tutorial01.c:118: error: expected expression before ')' token
tutorial01.c:123: error: 'packet' undeclared (first use in this function)
tutorial01.c:133: error: expected expression before ')' token
...全文
1412 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
神-气 2012-10-22
  • 打赏
  • 举报
回复
当然,这看起来你似乎把ffmpeg文件夹放到了C:\msys\1.0\local\include下面了?

一般的话不要这样放,最好是:INCLUDEPATH += "C:\ffmpeg
神-气 2012-10-22
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 的回复:]

你好我在用QT的.pro中包括了:
LIBS += -L -lavcodec -lavformat -lswscale -lavutil
LIBS += -L "C:\msys\1.0\local\lib\libavcodec.a"
LIBS += -L "C:\msys\1.0\local\lib\libavformat.a"
LIBS += -L "C:\msys\1.0\loca……
[/Quote]

加上:INCLUDEPATH += "C:\msys\1.0\local\include
*_潇_* 2012-10-20
  • 打赏
  • 举报
回复
你好我在用QT的.pro中包括了:
LIBS += -L -lavcodec -lavformat -lswscale -lavutil
LIBS += -L "C:\msys\1.0\local\lib\libavcodec.a"
LIBS += -L "C:\msys\1.0\local\lib\libavformat.a"
LIBS += -L "C:\msys\1.0\local\lib\libswscale.a"

INCLUDEPATH += "C:\msys\1.0\local\include\libavcodec"
INCLUDEPATH += "C:\msys\1.0\local\include\libavformat"
INCLUDEPATH += "C:\msys\1.0\local\include\libswscale"
INCLUDEPATH += "C:\msys\1.0\local\include\libavutil"

在.cpp中包括了:
extern "C"
{
#include "libavcodec\avcodec.h"
#include "libavformat\avformat.h"
#include "libswscale\swscale.h"
#include "libavutil\avutil.h"
};

但是编译时出错:
..\ffmpeg\/ffmpegdecoder.h:8:36: error: libavcodec\avcodec.h: No such file or directory

..\ffmpeg\/ffmpegdecoder.h:9:38: error: libavformat\avformat.h: No such file or directory

..\ffmpeg\/ffmpegdecoder.h:10:36: error: libswscale\swscale.h: No such file or directory

..\ffmpeg\/ffmpegdecoder.h:11:34: error: libavutil\avutil.h: No such file or directory

请问该怎么解决!
unix_net 2010-12-17
  • 打赏
  • 举报
回复
/tmp/ccGkfo7v.o: In function `audio_decode_frame':
tutorial04.c:(.text+0x3c8): undefined reference to `av_free_packet'
/tmp/ccGkfo7v.o: In function `main':
tutorial04.c:(.text+0xb90): undefined reference to `av_free_packet'
tutorial04.c:(.text+0xbc4): undefined reference to `av_free_packet'
collect2: ld returned 1 exit status

av_free_packet 这个函数怎么会没有呢?
hainei_ 2010-12-16
  • 打赏
  • 举报
回复
将程序改动:

#include "libswscale/swscale.h"

main中加入:

struct SwsContext *ctx;

//注意,这里是PIX_FMT_RGB24,它决定了图片的格式
ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height,
pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height,
PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL);

sws_scale(ctx, pFrame->data, pFrame->linesize,
0, pCodecCtx->height,pict.data, pict.linesize);
hainei_ 2010-12-16
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 unix_net 的回复:]
换成:
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
然后编译出现下面问题,怀疑库是不是没有装好

/opt/Atmel/arm-2007q1/bin/arm-linux-gcc -o tt tutorial01.c -I/public/usrlib/include -L/public/usrlib/l……
[/Quote]

新版本的ffmpeg已经不用img_convert了,换成了sws_scale()
你把img_convert换成sws_scale应该就可以了,当然用sws_scale要先定义参数
struct SwsContext *ctx;
……

CyberLogix 2010-12-15
  • 打赏
  • 举报
回复
连接出错,没有找到img_convert这个函数,这个应该在libavutil中把
unix_net 2010-12-15
  • 打赏
  • 举报
回复
换成:
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
然后编译出现下面问题,怀疑库是不是没有装好

/opt/Atmel/arm-2007q1/bin/arm-linux-gcc -o tt tutorial01.c -I/public/usrlib/include -L/public/usrlib/lib -lavformat -lm -ldl -L/public/usrlib/lib -lavutil -L/public/usrlib/lib -lavcodec -lz
/tmp/ccgdE6Ov.o: In function `main':
tutorial01.c:(.text+0x3d8): undefined reference to `img_convert'
collect2: ld returned 1 exit status
hainei_ 2010-12-15
  • 打赏
  • 举报
回复
新版的要换成:
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"

2,541

社区成员

发帖
与我相关
我的任务
社区描述
专题开发/技术/项目 多媒体/流媒体开发
社区管理员
  • 多媒体/流媒体开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧