H.264 multi-pass encoding with FFmpeg

ffmpegh.264video

I would like to encode a video in H.264 with multi-pass. I tried :

ffmpeg -y -ss 00:00:12.0 -i "c:\vid\example.mkv" -vframes 420 -vcodec libx264 -preset veryslow -refs 8 -b:v 1200k -an -pass 1 -f h264 /dev/null

ffmpeg -y -ss 00:00:12.0 -i "c:\vid\example.mkv" -vframes 420 -vcodec libx264 -preset veryslow -refs 8 -b:v 1200k -acodec copy -pass 2 "c:\vid\encoded.mkv"

but it shows error messages :

/dev/null: No such file or directory

ratecontrol_init: can't open stats file

Error while opening encoder for output stream #0:0 – maybe incorrect parameters
such as bit_rate, rate, width or height

Did I do something wrong? I'm not sure how to use multi-pass with FFmpeg by the way, any ideas how to fix the error?

Best Answer

Windows doesn't have /dev/null. Use NUL instead.

For more details, see the FFmpeg Wiki post on H.264 encoding.

Related Question