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

Francois Visagie francois.visagie at gmail.com
Tue Aug 6 08:56:53 CEST 2013


> -----Original Message-----
> From: ffmpeg-user-bounces at ffmpeg.org [mailto:ffmpeg-user-
> bounces at ffmpeg.org] On Behalf Of James Board
> Sent: 06 August 2013 02:41
> To: ffmpeg-user at ffmpeg.org
> Subject: [FFmpeg-user] 2-pass ENcoding with mpeg (switching from
> mencoder)
> 
> I'm trying to convert from mencoder to ffmpeg, at Carl's suggestion.  I
want
> to do 2-pass encoding.  I saw this command (for pass 1) in an ffmpeg user
> guide and tried this:
> 
>     ffmpeg -y -i AI_kerndeint_ffvhuff_trim.avi -an -vcodec libx264 -vpre
> fast_firstpass -b 2000k -bt 2000k -vf "crop=1440:1080:240:0,scale=640:480"
-
> pass 1 -threads 0 /dev/null
> 
> This was the error
> 
>     /usr/local/share/ffmpeg/libx264-fast_firstpass.ffpreset: Invalid
option or
> argument: 'directpred=1', parsed as 'directpred' = '1'

This means ffmpeg does not recognise the 'directpred' option specified in
the preset file libx264-fast_firstpass.ffpreset (in turn specified by the
command line option '-vpre fast_firstpass'). This was probably caused by the
ffmpeg syntax changing since the preset file was changed.

According to http://www.ffmpeg.org/ffmpeg-all.html the current option name
seems to be 'direct-pred'. Alternatively, libx264 supports the
'-fastfirstpass' option, which you can use instead of '-vpre
fast_firstpass'.

> 
> 
> ----------------------------------------
> I saw this in another post on how to do 2-pass encoding:
> 
>     /usr/local/bin/ffmpeg -y -i AI_kerndeint_ffvhuff_trim.avi -c:v libx264
-
> preset medium -b:v 10m -pass 1 -an -f mp4 /dev/null
>     /usr/local/bin/ffmpeg -y -i AI_kerndeint_ffvhuff_trim.avi -c:v libx264
-
> preset medium -b:v 10m -pass 2 -an OUT.mp4
> 
> There was no error on the first command.  The error on the second was
>     Error while opening encoder for output stream #0:0 - maybe incorrect
> parameters such as bit_rate, rate, width or height

There probably is something wrong with the format you're passing to the
encoder. Normally I get this error when trying to pass 5.1-channel audio to
the libvo-aacenc encoder which can't handle it, but in this case you've
disabled audio with '-an' (do you really want that?). The problem therefore
is with video, and it only surfaced on the 2nd pass because the 1st pass
doesn't encode video. You'd have to inspect ffmpeg's console output for
video information it reports to try work out what video parameter may have
caused the error.

Or post the full command and uncut console output on the list.

> 
> ----------------------------------------
> 
> So, I want to use ffmpeg instead of mencoder for doing 2-pass mpeg4
> encoding.
> What's wrong with the above commands, and what's the correct way to do
> this?

All that there is to it is using '-pass 1' for the first command line and
'-pass 2' for the second. You're doing things right but just getting tripped
up by detail at this point.

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



More information about the ffmpeg-user mailing list