View Full Version : x264 1st & 2nd Pass Options?
adamlau
8th June 2011, 21:53
Should I add preset=veryslow to the first pass? Can I remove tune=film from the first pass without affecting encoding quality?
Established bitrate (to match the original source) in the first pass according to the mencoder manpage:
'The first pass may use either average bitrate or constant quantizer. ABR is recommended, since it does not require guessing a quantizer.'
The manpage also recommends that:
'You might want to deactivate some CPU-hungry options, apart from the ones that are on by default.'
Do preset=veryslow and/or tune=film constitute said CPU-hungry options? Thanks.
mencoder Red.Cliff.2.2009.mp4 -oac mp3lame -lameopts preset=extreme -ovc x264 -x264encopts pass=1:preset=veryslow:tune=film:bitrate=1095:threads=auto -o /dev/null
mencoder Red.Cliff.2.2009.mp4 -oac mp3lame -lameopts preset=extreme -ovc x264 -x264encopts pass=2:preset=veryslow:tune=film:bitrate=1095:threads=auto -o Red.Cliff.2.2009.mpg
Use same settings in both passes except for pass=N. The film tune doesn't have much of an effect on encoding time in either pass. Veryslow preset sets --b-adapt 2 --bframes 8, which slow the first pass down, but that's the price of using very slow settings and encoding two passes. Make sure you use a recent MEncoder build so that it does fast first pass automatically. With older builds you also need to add turbo=1 to the first pass settings.
What do you mean by "matching bitrate to the original source"?
adamlau
9th June 2011, 02:05
Use same settings in both passes except for pass=N. The film tune doesn't have much of an effect on encoding time in either pass. Veryslow preset sets --b-adapt 2 --bframes 8, which slow the first pass down, but that's the price of using very slow settings and encoding two passes. Make sure you use a recent MEncoder build so that it does fast first pass automatically. With older builds you also need to add turbo=1 to the first pass settings.
What do you mean by "matching bitrate to the original source"?
Thanks, nm. I ended up using the same settings in both passes as mencoder would throw various x264 warnings if equivalent preset settings were not used between both passes. And unlike xvid (which rejects bitrate setting on the first pass), x264 appears to prefer an explicitly stated ABR on the first run. Using mencoder built from mplayer-export-2011-04-26 and x264 from x264-snapshot-20110605-2245. I have noticed preset=veryslow to be around six times slower during the second pass than using no preset at all (during the first and second passes). As you mentioned, tune=film did not have any appreciable effect on the encoding time of the first pass, but the quality was noticeably improved over the same file run with the same encoding commands less tune=film in a side-by-side mplayer comparison. By matching bitrates, I mean I am setting the bitrate of the output file to the same bitrate as the original source (1095 kbps). Or is it recommended to go higher, as in 1500 (plenty of battle action in the film)? BTW, the two-pass x264 file simply blew away three-pass lavc (ffmpeg-0.7-rc1) and two-pass xvid (xvidcore-1.3.2) files in overall detail, clarity and color rendition and was most faithful in reproducing the look and feel of the original source as well...
smok3
9th June 2011, 08:46
you may want to check the crf option in x264.
http://mewiki.project357.com/wiki/X264_Settings#crf
GodofaGap
9th June 2011, 08:55
If you are going to use the same bitrate for the video why aren't you using -ovc copy?
adamlau
12th June 2011, 13:12
you may want to check the crf option in x264.
http://mewiki.project357.com/wiki/X264_Settings#crf
I might give that a shot this time around (adding frameref=5:global_header) and see what a single-pass crf=1.0 can do...
If you are going to use the same bitrate for the video why aren't you using -ovc copy?
I would have (and tried), but the original source did not come with a global header written to the appropriate location. Had to transcode to write it in.
LoRd_MuldeR
12th June 2011, 14:13
"crf=1.0", huh? :eek:
If that's not a typo, you will get an extremely large file with that setting! I would recommend to start with something like CRF=18 for excellent quality (and adequate file size).
Also: Instead of overwriting individual parameters manually, such as the number of ref frames, it is probably better to use x264' preset system - whatever MEncoder's syntax for that is.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.