首页 > 技术文章 > linux 安装ffmpeg库

groundsong 2016-01-21 19:09 原文

添加变量

export FFMPEG_HOME=/opt/ffmpeg


Yasm:

wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz


tar -zxvf yasm-1.3.0.tar.gz

./configure --prefix="$FFMPEG_HOME" --bindir="$FFMPEG_HOME/bin"

make

make install


添加至环境变量
export "PATH=$PATH:$FFMPEG_HOME/bin"

 


libx264:

ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2

tar -jxvf last_x264.tar.bz2

./configure --prefix="$FFMPEG_HOME" --bindir="$FFMPEG_HOME/bin" --enable-shared

make

make install


yum install libtool

libfdk_aac:

yum install git

git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git

autoreconf -fiv

./configure --prefix="$FFMPEG_HOME" --enable-shared

make

make install

 

libmp3lame:

http://downloads.sourceforge.net/lame/lame-3.99.5.tar.gz

tar -jxvf lame-3.99.5.tar.gz

./configure --prefix="$FFMPEG_HOME" --bindir="$FFMPEG_HOME/bin" --enable-shared --enable-nasm

make

make install


FFMPEG:

PKG_CONFIG_PATH="$FFMPEG_HOME /lib/pkgconfig"

export PKG_CONFIG_PATH

./configure --prefix="$FFMPEG_HOME" --extra-cflags="-I$FFMPEG_HOME/include" --extra-ldflags="-L$FFMPEG_HOME/lib" --bindir="$FFMPEG_HOME/bin" --enable-shared --extra-libs=-ldl --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libx264

make

make install

 

 

 

安装完 编译程序 


g++ -o shot main.cpp -lavcodec -lavformat -lswscale -ljpeg -I /opt/ffmpeg/include/ -L /opt/ffmpeg/lib/

推荐阅读