I do not suggest using x264 from repository. It will likely be very outdated and not contain ffms2 input
First we need to get basic compiling dependencies (available in your repositories):
yasm, libgpac-dev, subversion, git, automake, pkg-config
Second we need to download and compile (do not use from repository) in this order: ffmpeg, ffms2, then x264:
Code: Select all
#get and compile ffmpeg and disable all but video decoders
cd /home/<usr>/source/
#svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk --revision {2010-07-01} ffmpeg #use this syntax to checkout older ffmpeg if current is broken
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg
./configure --disable-everything --enable-gpl --enable-postproc --enable-protocols --enable-demuxer=matroska,ogg,avi,h264,mov,m4v,mpegts,mpegvideo --enable-decoder=h264,vc1,wmv*,mpeg2video,mpeg1video,mpeg4,theora,vp8 --enable-parser=h264,mpeg4video,mpegvideo,vc1,vp8
sudo make install
Code: Select all
#get and compile ffms2
cd /home/<usr>/source/
svn checkout http://ffmpegsource.googlecode.com/svn/trunk/ ffms2
cd ffms2
./configure
make
sudo make install
Code: Select all
#get and compile x264 with ffms2 input
cd /home/<user>/source/
git clone git://git.videolan.org/x264.git x264
cd x264
./configure
make
sudo make install
Code: Select all
x264 <input>.mkv --preset slow --crf 18 --tune film --level 41 --colormatrix bt709 --output <output>.mkv
If you want more exotic filters that are not included in x264 filter code, you can use mplayer (from repo, or compiled your self) to decode and pipe cropped/resized/filtered source input to x264. This is the most common method using linux pipes:
(NOTE: if piping from mplayer/ffmpeg you do not need to compile x264 with ffms2/lavf input)
Code: Select all
mkfifo pipe.y4m
x264 pipe.y4m --preset slow --crf 18 --tune film --level 41 --colormatrix bt709 --output <output>.mkv & mplayer <input>.mkv -vf <crop/resize/filter> -benchmark -vo yuv4mpeg:file=pipe.y4m -nosound -really-quiet
And of course read 'x264 --fullhelp' for x264 options, and mplayer man page for more information on cropping and resizing (you can use mplayer -vf cropdetect to sort of auto cropping)
This guide was written for linux, but similar method will work in OSX/windows. (windows has to use raw stdout/stdin pipe)
update 07-03-2010: changed commandline to be more readable and avoid compile errors in ffmpeg
update 07-17-2010: x264 now supports basic crop/resize natively