[FFmpeg-user] 2-pass ENcoding with mpeg (switching from mencoder)

Francois Visagie francois.visagie at gmail.com
Wed Aug 7 17:24:35 CEST 2013

> -----Original Message-----
> From: ffmpeg-user-bounces at ffmpeg.org [mailto:ffmpeg-user-
> bounces at ffmpeg.org] On Behalf Of James Board
> Sent: 07 August 2013 16:37
> To: FFmpeg user questions
> Subject: Re: [FFmpeg-user] 2-pass ENcoding with mpeg (switching from
> mencoder)
> >> The only thing in the ffmpeg output from the 2ns pass that looks
> problematic is:
> >>     [libx264 @ 0x206f040] constant rate-factor is incompatible with
> >>2pass
> >>     ....
> >>     Error while opening encoder for output stream #0:0 - maybe
> >>incorrect parameters such as bit_rate, rate, width or height
> >>
> >
> >CRF is one way of controlling the resulting bitrate, target bit rate
> >and 2-pass encoding is another. You can't use both at the same time.
> I'm not using both.  At least not intentionally.  Here were my commands:
>    ffmpeg -y -i IN.avi -c:v libx264 -preset medium -b:v 10m -pass 1 -an -f
> /dev/null

'-f rawvideo' instead of '-f mp4' may be a bit faster. You can also add
'-fastfirstpass 1'.

>    ffmpeg -y -i IN.avi -c:v libx264 -preset medium -b:v 10m -pass 2 -an
> OUT.mp4
> Is the -preset option setting CRF?  I don't know.  I cut-and-pasted that
> command from examples I found on the web.

I don't see how CRF gets specified either. For reference, here are the
command lines I use:

ffmpeg -y -i INPUT -an -c:v libx264 -preset veryslow -fastfirstpass 1 -f
rawvideo -b:v 2500000 -pass 1 NUL
ffmpeg -y -I INPUT -c:v libx264 -preset veryslow -b:v 2500000 -pass 2

> What would be an example for doing 2-pass encoding, with the libx264
> codec, at a video rate of 10 million bits per second, and merely copy the
> audio from input file to output file, and using an mp4 format?

ffmpeg -y -i INPUT -an -c:v libx264 -preset veryslow -fastfirstpass 1 -f
rawvideo -b:v 10000000 -pass 1 NUL
ffmpeg -y -I INPUT -c:a copy -c:v libx264 -preset veryslow -b:v 10000000
-pass 2 OUTPUT.mp4

'-preset' according to your preferences, of course.

> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

More information about the ffmpeg-user mailing list