1、先安装yasm,编译x264所需
http://yasm.tortall.net/Download.html
tar xzf yasm-1.1.0.tar.gz
cd yasm-1.1.0
./configure
make
make install
2、安装x264
http://www.videolan.org/developers/x264.html
tar xjf last_x264.tar.bz2
cd x264-snapshot-20110912-2245
./configure --enable-shared --prefix=/usr
make
make install
3、安装ffmpeg
http://ffmpeg.org/download.html
./configure --enable-libx264 --enable-gpl --enable-shared --prefix=/usr
make
make install
4、转码
新一些版本的ffmpeg应该是
ffmpeg -i av.mov -threads 0 -pass 1 -vcodec libx264 -preset medium_firstpass -s 400x240 -b 200k -an 1.mp4
ffmpeg -i av.mov -threads 0 -pass 2 -vcodec libx264 -preset medium -s 400x240 -b 200k -an 1.mp4
因为preset是x264内建的
旧的
4、加入libx264的preset
新的ffmpeg之中不知道为什么把x264的几个preset拿掉了,可以参考
http://trac.perian.org/browser/ffmpeg/ffpresets
把拿掉的几个preset补充进去。preset的存放目录在/usr/share/ffmpeg
ffmpeg -i av.mov -threads 0 -pass 1 -vcodec libx264 -vpre medium_firstpass -s 400x240 -b 200k -an 1.mp4
ffmpeg -i av.mov -threads 0 -pass 2 -vcodec libx264 -vpre medium -s 400x240 -b 200k -an 1.mp4