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?
-crf
instead. See FFmpeg Wiki: H.264 Video Encoding Guide for more info on that. Why did you add-refs 8
? The preset will handle refs. Lastly, you can change-f h264
to-f matroska
since that's the container format your second command uses.-refs 8
, will the preset mess it up? And do you mean crf is better than 2-pass?-refs
. Adding-refs
should override the refs set by the preset, but I'm unsure why you're setting that in the first place.-qp 0
or-crf 0
.