直接编译tutorial03.c是会报错的
来源:互联网 发布:矢量条码生成器mac 编辑:程序博客网 时间:2024/04/28 07:34
root@ubuntu:/home/zhangbin/code# gcc -o tutorial03 tutorial03.c -lavformat -lavcodec -lz -lm `sdl-config --cflags --libs`
tutorial03.c:1:28: error: ffmpeg/avcodec.h: No such file or directory
tutorial03.c:2:29: error: ffmpeg/avformat.h: No such file or directory
tutorial03.c:16: error: expected specifier-qualifier-list before ‘AVPacketList’
tutorial03.c: In function ‘packet_queue_init’:
tutorial03.c:29: error: ‘PacketQueue’ has no member named ‘mutex’
tutorial03.c:30: error: ‘PacketQueue’ has no member named ‘cond’
tutorial03.c: At top level:
tutorial03.c:32: error: expected declaration specifiers or ‘...’ before ‘AVPacket’
tutorial03.c: In function ‘packet_queue_put’:
tutorial03.c:34: error: ‘AVPacketList’ undeclared (first use in this function)
tutorial03.c:34: error: (Each undeclared identifier is reported only once
tutorial03.c:34: error: for each function it appears in.)
tutorial03.c:34: error: ‘pkt1’ undeclared (first use in this function)
tutorial03.c:35: error: ‘pkt’ undeclared (first use in this function)
tutorial03.c:45: error: ‘PacketQueue’ has no member named ‘mutex’
tutorial03.c:47: error: ‘PacketQueue’ has no member named ‘last_pkt’
tutorial03.c:48: error: ‘PacketQueue’ has no member named ‘first_pkt’
tutorial03.c:50: error: ‘PacketQueue’ has no member named ‘last_pkt’
tutorial03.c:51: error: ‘PacketQueue’ has no member named ‘last_pkt’
tutorial03.c:52: error: ‘PacketQueue’ has no member named ‘nb_packets’
tutorial03.c:53: error: ‘PacketQueue’ has no member named ‘size’
tutorial03.c:54: error: ‘PacketQueue’ has no member named ‘cond’
tutorial03.c:56: error: ‘PacketQueue’ has no member named ‘mutex’
tutorial03.c: At top level:
tutorial03.c:59: error: expected declaration specifiers or ‘...’ before ‘AVPacket’
tutorial03.c: In function ‘packet_queue_get’:
tutorial03.c:61: error: ‘AVPacketList’ undeclared (first use in this function)
tutorial03.c:61: error: ‘pkt1’ undeclared (first use in this function)
tutorial03.c:64: error: ‘PacketQueue’ has no member named ‘mutex’
tutorial03.c:73: error: ‘PacketQueue’ has no member named ‘first_pkt’
tutorial03.c:75: error: ‘PacketQueue’ has no member named ‘first_pkt’
tutorial03.c:76: error: ‘PacketQueue’ has no member named ‘first_pkt’
tutorial03.c:77: error: ‘PacketQueue’ has no member named ‘last_pkt’
tutorial03.c:78: error: ‘PacketQueue’ has no member named ‘nb_packets’
tutorial03.c:79: error: ‘PacketQueue’ has no member named ‘size’
tutorial03.c:80: error: ‘pkt’ undeclared (first use in this function)
tutorial03.c:88: error: ‘PacketQueue’ has no member named ‘cond’
tutorial03.c:88: error: ‘PacketQueue’ has no member named ‘mutex’
tutorial03.c:91: error: ‘PacketQueue’ has no member named ‘mutex’
tutorial03.c: At top level:
tutorial03.c:95: error: expected ‘)’ before ‘*’ token
tutorial03.c: In function ‘audio_callback’:
tutorial03.c:139: error: ‘AVCodecContext’ undeclared (first use in this function)
tutorial03.c:139: error: ‘aCodecCtx’ undeclared (first use in this function)
tutorial03.c:139: error: expected expression before ‘)’ token
tutorial03.c:142: error: ‘AVCODEC_MAX_AUDIO_FRAME_SIZE’ undeclared (first use in this function)
tutorial03.c: In function ‘main’:
tutorial03.c:170: error: ‘AVFormatContext’ undeclared (first use in this function)
tutorial03.c:170: error: ‘pFormatCtx’ undeclared (first use in this function)
tutorial03.c:172: error: ‘AVCodecContext’ undeclared (first use in this function)
tutorial03.c:172: error: ‘pCodecCtx’ undeclared (first use in this function)
tutorial03.c:173: error: ‘AVCodec’ undeclared (first use in this function)
tutorial03.c:173: error: ‘pCodec’ undeclared (first use in this function)
tutorial03.c:174: error: ‘AVFrame’ undeclared (first use in this function)
tutorial03.c:174: error: ‘pFrame’ undeclared (first use in this function)
tutorial03.c:175: error: ‘AVPacket’ undeclared (first use in this function)
tutorial03.c:175: error: expected ‘;’ before ‘packet’
tutorial03.c:179: error: ‘aCodecCtx’ undeclared (first use in this function)
tutorial03.c:180: error: ‘aCodec’ undeclared (first use in this function)
tutorial03.c:215: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
tutorial03.c:219: error: ‘CODEC_TYPE_AUDIO’ undeclared (first use in this function)
tutorial03.c:291: error: ‘packet’ undeclared (first use in this function)
tutorial03.c:302: error: ‘AVPicture’ undeclared (first use in this function)
tutorial03.c:302: error: expected ‘;’ before ‘pict’
tutorial03.c:303: error: ‘pict’ undeclared (first use in this function)
tutorial03.c:312: error: ‘PIX_FMT_YUV420P’ undeclared (first use in this function)
tutorial03.c:313: error: expected expression before ‘)’ token
tutorial03.c:326: error: too many arguments to function ‘packet_queue_put’
root@ubuntu:/home/zhangbin/code#
改了一下头文件
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
会去/usr/local/include/libavcodec/avcodec.h寻找。
root@ubuntu:/home/zhangbin/code# vi tutorial03.c
root@ubuntu:/home/zhangbin/code# gcc -o tutorial03 tutorial03.c -lavformat -lavcodec -lz -lm `sdl-config --cflags --libs`
tutorial03.c: In function ‘audio_decode_frame’:
tutorial03.c:106: warning: ‘avcodec_decode_audio2’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3593)
tutorial03.c: In function ‘main’:
tutorial03.c:295: warning: ‘avcodec_decode_video’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3655)
/tmp/cc6TCXLI.o: In function `main':
tutorial03.c:(.text+0xa23): undefined reference to `img_convert'
collect2: ld returned 1 exit status
undefined reference to 'img_convert',sws_scale替换了img_convert
问题出现在我下载的ffmpeg的版本不一样,我是用svn下载了最新的版本,在这个版本的函数库里没有img_convert函数,在0.4.8以前的版本中还有这个函数,新版本中用sws_getContext和sws_scale代替了。简单说明如下:
新版本的ffmpeg添加了新的接口:libswscale来处理图像缩放。
以前使用img_convert来把RGB转换成YUV12,现在使用新的接口。新接口更加标准和快速,而且里面有了MMX优化代码。换句话说,它是做缩放更好的方式。
用来缩放的基本函数是sws_scale。但一开始,必需建立一个SwsContext的概念。这将进行想要的转换,然后把它传递给 sws_scale函数。类似于在SQL中的预备阶段或者是在Python中编译的规则表达式regexp。要准备这个上下文,使用 sws_getContext函数,它需要源的宽度和高度,我们想要的宽度和高度,源的格式和想要转换成的格式,同时还有一些其它的参数和标志。然后我们像使用img_convert一样来使用sws_scale函数,唯一不同的是我们传递给的是SwsContext。
具体说明看tutorial08.txt (在什么地方?)
还有想对woshizp说:我会发一封邮件给你,把我最近学习ffmpeg的心得给你。
最后谢谢morris88
================================================
root@ubuntu:/etc/vim# vi vimrc
==============================================
发现原文是tutorial01.c
修改tutorial01.c发现:
root@ubuntu:/home/zhangbin/code# vi tutorial01.c
root@ubuntu:/home/zhangbin/code# gcc -o tutorial01 tutorial01.c -lavformat -lavcodec -lz
tutorial01.c: In function ‘main’:
tutorial01.c:128: warning: ‘avcodec_decode_video’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3655)
tutorial01.c:141: warning: ‘sws_getContext’ is deprecated (declared at /usr/local/include/libswscale/swscale.h:191)
/tmp/ccALn29e.o: In function `main':
tutorial01.c:(.text+0x425): undefined reference to `sws_getContext'
tutorial01.c:(.text+0x47f): undefined reference to `sws_scale'
collect2: ld returned 1 exit status
======================================================================
然后测试一下:
root@ubuntu:/home/zhangbin# tutorial01 oldboy.mp4
tutorial01: command not found
root@ubuntu:/home/zhangbin# ./tutorial01 oldboy.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'oldboy.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isom
creation_time : 2010-10-31 03:36:12
Duration: 00:42:37.76, start: 0.000000, bitrate: 506 kb/s
Stream #0.0(und): Video: h264, yuv420p, 672x378 [PAR 1:1 DAR 16:9], 471 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc
Metadata:
creation_time : 2010-10-26 15:52:54
Stream #0.1(und): Audio: aac, 44100 Hz, stereo, s16, 31 kb/s
Metadata:
creation_time : 2010-10-31 03:36:14
==========================
这次我选了一个305kB的mpg文件,因为作者给的参考就是mpg格式的。
- 直接编译tutorial03.c是会报错的
- ffmpeg 入门教程编译通过版 tutorial03.c(ffmpeg 0.8.11)
- clucene mac os 10.9编译会报错的解决办法
- eclipse下不能编译.ftl文件,会报错的解决方法
- 会报错的,是什么原因?
- ffmpeg 0.6.3 能用的tutorial03
- HashMap map编译时为什么会报错
- 为什么在子线程中直接new Handler会报错?
- $_POST传值定义的变量在直接加载这个php文件的时候会报错的问题解决方法
- 下面的代码中编译器会报一个错误,你知道是哪个语句错了吗?
- php mkdir()第一个参数必须是已经存在的路径,否则会报错
- js delete 即使是删除一个不存在的属性也不会报错
- plsql是可以写多个select的,但是一定要加上;号,不然就会报错
- Android Studio 中的汉字在编译的时候会报错的问题
- 导入编译的时候eclipse会报错,org.cocos2dx.lib.Cocos2dxActivity 也找不到
- ubuntu 下面libxml2的安装与使用--注意 -lxml2 不放置在最后编译会报错!
- 105-使用GData进行DOM解析XML的时候,最初编译会报错,解决办法
- IAR 8.3以后的版本编译TI BLE Stack会报错
- .net实现导出Word、Excel格式文件
- Android上让View自动更新的另一种办法(非线程)
- QT 的信号与槽机制介绍
- xv6的中断分析
- sqlserver2005的配置。(Connections could not be acquired from the underlying database)
- 直接编译tutorial03.c是会报错的
- PHP博客 – 专注PHP研发:http://www.frostsky.com/
- 国际化及本地化页面---------ADF Faces入门(文档阅读)
- 过年
- 学习笔记 第五章
- Asp.NET调用C++写的dll
- BI基础概念
- 帮个忙,谁有sina app engine的邀请码,给一个,谢谢!
- C#中将DateTimePicker控件清空的方法!