您的位置:首页 > 其它

ffmpeg 编译 安装 使用

2013-04-16 16:29 357 查看
开始接触音视频的相关知识,在此做个笔记,会继续完整

1 下载 ffmpeg-1.2 源码

2 下载 x264 源码

编译安装x264库

./configure --disable-asm

make

sudo make install

编译ffmpeg

./configure --disable-yasm --enable-static --disable-shared --enable-libx264 --enable-gpl

make

sudo make install

使用 在qt 中使用

.pro中添加

INCLUDEPATH += -I/usr/local/include/

LIBS += -L/usr/local/lib -lavformat -lavcodec -lavutil -lswscale \

-lpostproc -lavfilter -lswresample -lavdevice -lx264 -lm -lz -lpthread

千万注意LIBS的依赖顺序啊,否则会让你崩溃的

#include <iostream>

extern "C" //这个要有

{

#include <libavcodec/avcodec.h>

#include <libavformat/avformat.h>

}

using namespace std;

int main()

{

AVFormatContext *pFormatCtx;

av_register_all(); //开始使用吧

return 0;

}

代码学习阶段

参照代码学习,很好的教程,源码可从网上下载 https://github.com/chelyaev/ffmpeg-tutorial

ffmpeg-tutorial-master

编译

需要sdl 首先安装

sudo apt-get install libsdl1.2-dev

然后

make

参照代码 和 文档说明

相关资料 源码已经上传到 http://download.csdn.net/detail/liuhongxiangm/5264957
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: