【zz】编译ffmpeg的output-example.c和api-example.c 错误
来源:互联网 发布:360管家mac版 编辑:程序博客网 时间:2024/05/18 02:40
http://blog.csdn.net/lin2221021/archive/2010/12/03/6052082.aspx
关于编译ffmpeg的output-example.c和api-example.c 错误的一些解决方法(新手文章,大家勿喷) 收藏
1../configure --enable swscale
2.make
3.make install
正常安装结束。此时/usr/local/include下会多出一个ffmpeg文件夹,里面有一些头文件,以后要用到。
/usr/local/lib下会多出libavformat.a,libavcodec.a,libavutils.a,这几个静态库在编译output_example.c的时候要用到。
4.gcc -o hh output_examples.c
错误: output_example.c:34:22: avformat.h: 没有那个文件或目录
output_example.c:35:21: swscale.h: 没有那个文件或目录
output_example.c:45: `SWS_BICUBIC' undeclared here (not in a function)
output_example.c:52: parse error before '*' token
...
解决:需要添加引用头文件的位置
5.gcc -o hh output_example.c -I/usr/local/include/ffmpeg
错误: /tmp/ccW5CPkd.o(.text+0xf): In function `add_audio_stream':
: undefined reference to `av_new_stream'
/tmp/ccW5CPkd.o(.text+0xa0): In function `open_audio':
: undefined reference to `avcodec_find_encoder'
/tmp/ccW5CPkd.o(.text+0xda): In function `open_audio':
...
解决:为编译选项添加要用到的静态库(就是前面提到的那三个.a库)
6.cp /usr/local/lib/libav*a /usr/lib
gcc -o hh output_example.c -I/usr/local/include/ffmpeg -lavformat -lavcodec -lavutil
错误: /tmp/ccI2Tg2J.o(.text+0x1f4): In function `get_audio_frame':
: undefined reference to `sin'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libavformat.a(mov.o)(.text+0x211d): In function `mov_read_cmov':
/tmp/ffmpeg/libavformat/mov.c:1186: undefined reference to `uncompress'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libavcodec.a(mpegvideo.o)(.text+0x28b0): In function `ff_print_debug_info':
/tmp/ffmpeg/libavcodec/mpegvideo.c:1328: undefined reference to `cos'
...
解决:添加lmath库
7.gcc -o hh output_example.c -I/usr/local/include/ffmpeg -lavformat -lavcodec -lavutil -lm
错误: /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libavformat.a(mov.o)(.text+0x211d): In function `mov_read_cmov':
/tmp/ffmpeg/libavformat/mov.c:1186: undefined reference to `uncompress'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libavcodec.a(cscd.o)(.text+0xb1): In function `decode_frame':
/tmp/ffmpeg/libavcodec/cscd.c:168: undefined reference to `uncompress'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libavcodec.a(dxa.o)(.text+0xde): In function `decode_frame':
/tmp/ffmpeg/libavcodec/dxa.c:233: undefined reference to `uncompress'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libavcodec.a(flashsv.o)(.text+0x3e): In function `flashsv_decode_init':
...
解决:添加zlib库
8. gcc -o hh output_example.c -I/usr/local/include/ffmpeg -lavformat -lavcodec -lavutil -lm -lz
错误undefined reference to `BZ2_bzDecompressInit'
解决添加库
gcc -o hh output_example.c -I/usr/local/include/ffmpeg -lavformat -lavcodec -lavutil -lm -lz -lbz2
9. gcc -o hh output_example.c -I/usr/local/include/ffmpeg -lavformat -lavcodec -lavutil -lm -lz -lbz2
错误 undefined reference to 'sws_scale'
解决添加库(lswscale)
gcc -o hh output_example.c -I/usr/local/include/ffmpeg -lavformat -lavcodec -lavutil -lswscale -lm -lz -lbz2
编译成功。
10.运行编译出来的东东。
[root@localhost ffmpeg]# ./hh
usage: ./hh output_file
API example program to output a media file with libavformat.
The output format is automatically guessed according to the file extension.
Raw images can also be output by using '%d' in the filename
本人使用的ffmpeg是0.6的版本。前面7条是转载别人的文章,后面两条是我遇到的问题以及解决方法。
希望以上对入门者有点帮助。
- 【zz】编译ffmpeg的output-example.c和api-example.c 错误
- 关于编译ffmpeg的output-example.c和api-example.c 错误的一些解决方法
- FFMPEG Output example.c
- ffmpeg的api-example.c的编译
- 编译output-example.c
- 编译output-example.c
- Output example.c
- c api example
- ffmpeg视屏编码(1)-api-example.c解读
- MySQL C API by Example
- api-example.c音频解码问题
- hiredis示例代码example-ac.c的编译
- [C++] CBT Hook Example
- HttpListener in C#:example
- [Home] JSON-C Example
- C#_delegate - example
- C callback function example
- alsa record example.c
- 笔记mp3
- grep命令取出两个文件中不同的行
- 回调函数的常见实现方式及速度比较
- Ethereal过滤规则
- SQL 7 计算字段 - 3. 数据处理函数
- 【zz】编译ffmpeg的output-example.c和api-example.c 错误
- 在大型Flex项目中如何构建高效的QTP测试框架
- 枚举
- 把绝对时间转换成当前时间
- zmud之自动解谜:不用数据库实现自动解谜的原理。
- 网络编程常见问题
- 使用ActionScript 3的绘图命令
- Setspn.exe
- zmud之汉字转换为数字