X264 encoding
These are notes, references, experiments, and ultimately the settings I've decided upon for doing x264 encodings. My goal is for playback on a high-resolution LCD display or projector and files which are Quicktime compatible. Encoding for an iPod or similar device will (probably) be better with different settings.
Notes
- trellis <=> no-dct-decimate
- trellis => no-fast-pskip
- trellis => high bitrate encoding
- CQ/CRF => dct-decimate => no trellis
- ABR => 2-pass
Always on:
- CABAC
My newer presets / settings
At this point, I just go for the goods and use high-quality settings. Also, I've stopped caring so much about full Quicktime compatibility and use "Pyramidal B-Frames".
One parameter I always check before encoding is deblock. In general, I'll try -2,-1, but sometimes the output looks over-sharpened so I'll relax it to -1,0. With noisy sources (grainy film), it's often better to just get rid of this option. Regardless, you should always encode a piece of the source and check it before encoding the whole thing.
ABR: ref=3:mixed-refs=1:bframes=3:bime=1:weightb=1:brdo=1:direct=auto:b-pyramid=1:me=umh:subq=7:analyse=all:8x8dct=1:trellis=1:no-fast-pskip=1:deblock=-2,-1:no-dct-decimate=1 CRF: ref=3:mixed-refs=1:bframes=3:b-pyramid=1:brdo=1:bime=1:weightb=1:deblock=-2,-1:subq=7:trellis=0:analyse=all:8x8dct=1:me=umh:no-fast-pskip=1
My older presets / settings
All settings trade between fast encoding times and high quality output.
Use ABR if you want a specific file size or bit rate, otherwise use CRF (since CRF is 1-pass).
In Handbrake, I set CRF to 66%.
.:. bsik (good) - a little slower than default, but noticeably better quality
ABR: ref=3:mixed-refs=1:analyse=all:bframes=3:bime=1:weightb=1:direct=auto CRF: ref=3:mixed-refs=1:analyse=all:bframes=3:bime=1:weightb=1:direct=auto:dct-decimate=1
.:. bsik (better) - slower than default, much better quality
ABR: analyse=all:bframes=3:bime=1:weightb=1:direct=auto:subme=5:ref=3:mixed-refs=1:no-fast-pskip=1 CRF: analyse=all:bframes=3:bime=1:weightb=1:direct=auto:subme=5:ref=3:mixed-refs=1:no-fast-pskip=1:dct-decimate=1
.:. bsik (best) - quite slow, kick-ass quality
ABR: me=umh:bframes=3:bime=1:weightb=1:direct=auto:subme=6:b-rdo=1:trellis=1:no-dct-decimate=1:ref=3:mixed-refs=1:analyse=all:no-fast-pskip=1 CRF: me=umh:bframes=3:bime=1:weightb=1:direct=auto:subme=7:b-rdo=1:dct-decimate=1:ref=3:mixed-refs=1:analyse=all:no-fast-pskip=1
If you don't care how long it takes, look at the Sharktooth Insane preset below. If you REALLY don't care how long it takes, do a CRF 1-pass encode at the quality you want, get the bitrate, and then do a 2-pass ABR encode at that bit rate. Not worth it to me at all.
Other presets / settings
Handbrake default:
subme=4
ATV:
bframes=3:ref=1:subme=5:me=umh:no-fast-pskip=1:trellis=2
ATV HQ:
bframes=6:ref=3:b-rdo=1:direct=auto:subme=6:trellis=1:analyse=p8x8,b8x8,i4x4,p4x4:me=umh:no-dct-decimate=1:bime=1:weightb=1:mixed-refs=1:no-fast-pskip=1
Sharktooth Insane HQ:
ref=6:mixed-refs=1:no-fast-pskip=1:bframes=3:b-rdo=1:bime=1:weightb=1:direct=auto:filter=-2,-1:subme=7:trellis=2:analyse=all:vbv-maxrate=25000:me=umh:no-dct-decimate=1
Informal experiments
bframes=3:subme=5 [22.0]
bframes=3:subme=5:me=umh [18.3]
bframes=3:subme=5:me=umh:no-fast-pskip=1 [18.3]
bframes=3:subme=5:me=umh:no-fast-pskip=1:bime=1:weightb=1 [17.9]
bframes=3:subme=5:me=umh:no-fast-pskip=1:analyse=all [17.4]
bframes=3:subme=5:me=umh:no-fast-pskip=1:bime=1:weightb=1:analyse=all [17.1]
bframes=3:subme=5:me=umh:no-fast-pskip=1:trellis=1 [17.1]
ref=3:mixed-refs=1:analyse=all:bframes=3:bime=1:weightb=1:direct=auto [19.4]
no-fast-pskip=1:ref=3:mixed-refs=1:analyse=all:bframes=3:bime=1:weightb=1:direct=auto [19.0]
subme=5:ref=3:mixed-refs=1:analyse=all:bframes=3:bime=1:weightb=1:direct=auto [16.9]
me=umh:ref=3:mixed-refs=1:analyse=all:bframes=3:bime=1:weightb=1:direct=auto [14.6]
bframes=3:subme=6:b-rdo=1:me=umh:no-fast-pskip=1 [14.5]
bframes=3:ref=3:subme=5:me=umh:no-fast-pskip=1 [15.4]
bframes=3:ref=3:subme=5:me=umh:no-fast-pskip=1:trellis=1 [14.5]
References
- x264 Options in HandBrake
- x264 Options Explained (Digital Digest)
- Avidemux2 - H264