Discussion:
[FFmpeg-user] libx264 2 pass encoding...
John Doe
2011-10-11 09:06:48 UTC
Permalink
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
Jonathan Tanant
2011-10-11 09:09:54 UTC
Permalink
Hi,

I use these ones to convert my movies to an iPhone/iPod compatible x264 :

ffmpeg -i "./input.mov" -sameq -r 25 -pass 1 -s 1024x512 -vcodec libx264 -vpre slow_firstpass -vpre ipod640 -b 1500kb -aspect 2:1 -threads 0 -f ipod -y output.mp4
ffmpeg -i "./input.mov" -sameq -r 25 -pass 2 -s 1024x512 -vcodec libx264 -vpre slow -vpre ipod640 -b 1500kb -aspect 2:1 -threads 0 -f ipod -y output.mp4

Best,

Jonathan.
Post by John Doe
Hi,
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...
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
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Jonathan Tanant
2011-10-11 09:09:54 UTC
Permalink
Hi,

I use these ones to convert my movies to an iPhone/iPod compatible x264 :

ffmpeg -i "./input.mov" -sameq -r 25 -pass 1 -s 1024x512 -vcodec libx264 -vpre slow_firstpass -vpre ipod640 -b 1500kb -aspect 2:1 -threads 0 -f ipod -y output.mp4
ffmpeg -i "./input.mov" -sameq -r 25 -pass 2 -s 1024x512 -vcodec libx264 -vpre slow -vpre ipod640 -b 1500kb -aspect 2:1 -threads 0 -f ipod -y output.mp4

Best,

Jonathan.
Post by John Doe
Hi,
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...
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
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Andy Sheen
2011-10-11 09:12:38 UTC
Permalink
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
Post by John Doe
Hi,
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...
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
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
John Doe
2011-10-11 10:08:46 UTC
Permalink
Post by Andy Sheen
John Doe wrote on Tue 11 Oct at 10:06 UK time
Post by John Doe
I am debugging my old command lines and I bumped into an x264 2 pass
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...
... -vpre slow_firstpass -vpre main ...
... -vpre slow -vpre main
... -vpre slow_firstpass -vpre ipod640 ...
... -vpre slow -vpre ipod640 ...
Thanks for your replies.
The problem is that:
  File for preset 'slow' not found
  File for preset 'slow_firstpass' not found
Jonathan Tanant
2011-10-11 10:13:08 UTC
Permalink
Post by John Doe
Post by Andy Sheen
John Doe wrote on Tue 11 Oct at 10:06 UK time
Post by John Doe
I am debugging my old command lines and I bumped into an x264 2 pass
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...
... -vpre slow_firstpass -vpre main ...
... -vpre slow -vpre main
... -vpre slow_firstpass -vpre ipod640 ...
... -vpre slow -vpre ipod640 ...
Thanks for your replies.
File for preset 'slow' not found
File for preset 'slow_firstpass' not found
$ ls ffmpeg/ffpresets/
libvpx-1080p.ffpreset
libvpx-1080p50_60.ffpreset
libvpx-360p.ffpreset
libvpx-720p.ffpreset
libvpx-720p50_60.ffpreset
libx264-ipod320.ffpreset
libx264-ipod640.ffpreset
libx264-lossless_fast.ffpreset
libx264-lossless_max.ffpreset
libx264-lossless_medium.ffpreset
libx264-lossless_slow.ffpreset
libx264-lossless_slower.ffpreset
libx264-lossless_ultrafast.ffpreset
Any idea from where I could get these presets...?
Sorry, I don't know, I just got them "out from the box".
FFmpeg 0.6, compiled from the sources on Aug 9 2010.

================================================
FFmpeg version 0.6, Copyright (c) 2000-2010 the FFmpeg developers
built on Aug 9 2010 14:35:37 with gcc 4.2.1 (Apple Inc. build 5664)
configuration: --prefix=/opt/local --enable-gpl --enable-postproc --enable-swscale --enable-avfilter --enable-avfilter-lavf --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libdirac --enable-libschroedinger --enable-libfaac --enable-libfaad --enable-libxvid --enable-libx264 --enable-libvpx --enable-libspeex --enable-nonfree --mandir=/opt/local/share/man --enable-shared --enable-pthreads --disable-indevs --cc=/usr/bin/gcc-4.2 --arch=x86_64
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.19. 0 / 1.19. 0
libswscale 1.11. 0 / 1.11. 0
libpostproc 51. 2. 0 / 51. 2. 0
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
================================================

Jonathan.
Post by John Doe
Thx,
JD
_______________________________________________
ffmpeg-user mailing list
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
John Doe
2011-10-11 13:45:40 UTC
Permalink
Post by Jonathan Tanant
Sorry, I don't know, I just got them "out from the box".
FFmpeg 0.6, compiled from the sources on Aug 9 2010.
Found an svn comment from 2011-04-16:
"Remove now useless ffpresets for x264, use -preset"

So I replaced -vpre with -preset and tried the presets listed from x264:
 ultrafast superfast veryfast faster fast medium slow slower veryslow
But still get "constant rate-factor is incompatible with 2pass."

JD
James Darnley
2011-10-11 15:39:59 UTC
Permalink
Post by John Doe
But still get "constant rate-factor is incompatible with 2pass."
If you want to use 2-pass, set a bitrate.
John Doe
2011-10-11 16:10:31 UTC
Permalink
Post by James Darnley
Post by John Doe
But still get "constant rate-factor is incompatible with 2pass."
If you want to use 2-pass, set a bitrate.
Indeed, problem solved.
I thought it would choose the input bitrate as default for the output...

Thx,
JD

Loading...