ffmpeg 编译


 ./configure --prefix=/usr/local/ffmpeg  --enable-pic --enable-shared  --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads  --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-x11grab 
  1. Download yasm source code from http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
  2. Unpack tar xvzf yasm-1.2.0.tar.gz
  3. cd yasm-1.2.0
  4. Configure and build:

    ./configure && make -j 4 && sudo make install


1、下载ffmpeg-2.6.3.tar.bz2、last_x264.tar.bz2、yasm-1.2.0.tar.gz   http://download.csdn.net/detail/xl4025/8919329
2、libx264需要yasm,所以先安装yasm
3、安装ffmpeg的依赖包
libfaac、libmp3lame、libtheora、libvorbis、libxvid、libxext、libxfixes
wget https://www.nasm.us/pub/nasm/releasebuilds/2.14rc0/nasm-2.14rc0.tar.gz
tar xzf nasm-2.14rc0-xdoc.tar.bz2
cd nasm*
./configure;make;sudo make install

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

tar xfj last_x264.tar.bz2;
cd x264-*

sudo apt-get install libx264-dev libfaac-dev libmp3lame-dev libtheora-dev libvorbis-dev libxvidcore-dev libxext-dev libxfixes-dev


4、解压ffmpeg
tar -xjvf ffmpeg-2.6.3.tar.bz2
对ffmpeg进行编译安装
./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab --enable-libvorbis 


make
make install


5、当中问题
1)、执行 ffmpeg -i "/home/user/down/flv/001.flv" -acodec copy -vcodec libx264 -b 560k -bf 6 -s 682*310 -f mp4 "/home/user/test/001.mp4"遇到错误
Unknown encoder 'libx264' 错误 由于已经安装过libx264、迷茫找了很久找到
Unknown encoder 'libx264'. Installing the package libavcodec-extra-53
In Ubuntu 14.04 LTS the package that is needed is called libavcodec-extra-54 (and libav-tools)
安装libavcodec-extra-53
apt-get install libavcodec-extra-53


进入到
/usr/local/ffmpeg/bin 目录下把
复制到/usr/local/bin下
在命令中直接运行
ffmpeg


提示
built with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --prefix=/usr/local/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab --enable-libvorbis
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...


原文地址:https://www.cnblogs.com/mtcnn/p/9410042.html