1、安装依赖包
sudo apt-get update sudo apt-get -y --force-yes install autoconf automake build-essential libass-dev libfreetype6-dev \ libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \ libxcb-xfixes0-dev pkg-config texi2html zlib1g-dev
mkdir ~/ffmpeg_sources
- ffmpeg_sources – 源文件.
- ffmpeg_build – 各种lib被安装在此文件夹.
- bin – 各种bin被安装在此文件夹
我已经把所需要的一下文件都下载整理,存在网盘,需要的可以直接获取链接:http://pan.baidu.com/s/1dD8RYEH 密码:xgoz
3、Yasm
cd ~/ffmpeg_sources wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz tar xzvf yasm-1.3.0.tar.gz cd yasm-1.3.0 ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" make make install make distclean
cd ~/ffmpeg_sources wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2 tar xjvf last_x264.tar.bz2 cd x264-snapshot* PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static PATH="$HOME/bin:$PATH" make make install make distclean
问题:不知道是不是环境变量的关系,很多标准command不能用,参考另一个笔记:linux下提示bash:command not found
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
5、libx265
265的源一直没下载下来,也暂时不用x265,所以没有安装,后续编译ffmpeg不编译x265就可以。
6、libfdk-aac
cd ~/ffmpeg_sources wget -O fdk-aac.tar.gz https://github.com/mstorsjo/fdk-aac/tarball/master tar xzvf fdk-aac.tar.gz cd mstorsjo-fdk-aac* autoreconf -fiv ./configure --prefix="$HOME/ffmpeg_build" --disable-shared make make install make distclean
sudo apt-get install nasm cd ~/ffmpeg_sources wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz tar xzvf lame-3.99.5.tar.gz cd lame-3.99.5 ./configure --prefix="$HOME/ffmpeg_build" --enable-nasm --disable-shared make make install make distclean
cd ~/ffmpeg_sources wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz tar xzvf opus-1.1.tar.gz cd opus-1.1 ./configure --prefix="$HOME/ffmpeg_build" --disable-shared make make install make distclean
cd ~/ffmpeg_sources wget http://webm.googlecode.com/files/libvpx-v1.3.0.tar.bz2 tar xjvf libvpx-v1.3.0.tar.bz2 cd libvpx-v1.3.0 PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests PATH="$HOME/bin:$PATH" make make install make clean
安装编译ffmpeg
cd ~/ffmpeg_sources wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 tar xjvf ffmpeg-snapshot.tar.bz2 cd ffmpeg PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \ --prefix="$HOME/ffmpeg_build" \ --pkg-config-flags="--static" \ --extra-cflags="-I$HOME/ffmpeg_build/include" \ --extra-ldflags="-L$HOME/ffmpeg_build/lib" \ --bindir="$HOME/bin" \ --enable-gpl \ --enable-libass \ --enable-libfdk-aac \ --enable-libfreetype \ --enable-libmp3lame \ --enable-libopus \ --enable-libtheora \ --enable-libvorbis \ --enable-libvpx \ --enable-libx264 \ --enable-libx265 \ --enable-nonfree PATH="$HOME/bin:$PATH" make make install make distclean hash -r
查看ffmpeg是否安装成功,用ffmpeg -version
之后我们就可以使用ffmpeg 将文件转化成ts文件,以备m3u8-segmenter切片,搭建hls流媒体服务器。