[FFmpeg-user] libx264 2 pass encoding...

Andy Sheen sheen.andy at googlemail.com
Tue Oct 11 11:12:38 CEST 2011

The error suggests the default encode of x264 is to use a constant rate. 
2 pass is used to adapt the bitrate across the stream, so you can't use 
constant bitrate.

I use this as a recode command in a bash shell (bitrate 3000k):

recode_video ()
     nice ffmpeg -y -i "$1" -pass 1 -vcodec libx264 -vpre slow_firstpass 
-vpre main -b 3000k -threads 0 -f mp4 -an /dev/null;
     nice ffmpeg -y -i "$1" -pass 2 -vcodec libx264 -vpre slow -vpre 
main -b 3000k -threads 0 "rec_$1.mkv"

Note this may not work directly for you as I use an ffmpeg that is from 
January this year.

John Doe wrote on Tue 11 Oct at 10:06 UK time
> Hi,
> I am debugging my old command lines and I bumped into an x264 2 pass problem:"[libx264 @ 0x1ccd460] constant rate-factor is incompatible with 2pass."
> I understand that lossless presets won't work.
> I tried the ipod presets... same.
> I did not find any *pass presets files...
> I only got: libvpx-*, libx264-ipod* and libx264-lossless* presets.
> I tried no presets...
> I have reduced my command-lines down to the minimum:
> ffmpeg -y -i "test.mov" -pass 1 "test.m4v"
> ffmpeg -y -i "test.mov" -pass 2 "test.m4v"
> But it still fails...
> ffmpeg version N-32814-gcab2860
> libx264 r2085 8a62835
> Anyone has some working 2-pass libx264 command-lines?
> Thx,
> JD
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

More information about the ffmpeg-user mailing list