x264 is an open source h.264 encoder. Since r1177 it includes a preset system. The give an easy way to balance quality vs encoding speed, ranging from placebo (highest quality) to ultrafast (lowest quality).
I wanted to get an idea what kind of quality/time gains could be archived with these settings. Usually the first steps of extra quality are barely noticeable in encoding time, while the last bits of quality cost significantly more. To verify this statement and to quantify it, I encoded 2 video sequences at 2 resolutions using all 9 available presets. I used PSNR as metric. I’d be the first to admit that PSNR does not correspond to quality, but it correlates reasonably well.
The results in short: the “slower” profile seems to give very high quality (-0.1dB PSNR loss) while reducing encoding time by roughly a factor 4! “veryfast” gives a substantial quality-boost (2.1dB PSNR) while only requiring 15% more encode time compared to ultrafast.
This graph shows the relative speed gain/loss vs PSNR gain/loss. The “slower” profile is taken as a reference.
Since they seem to be, here is a copy:
- ultrafast: subme 0, ref 1, me dia, b-adapt 0, partitions none, trellis 0, bframes 0, weightp 0, no-mixed-refs, no-mbtree, no-scenecut, no-deblock, no-cabac, no-8x8dct, aq-mode 0
- veryfast: subme 1, ref 1, me dia, partitions i8x8,i4x4, trellis 0, weightp 0, no-mixed-refs, no-mbtree
- faster: subme 4, ref 2, weightp 1, no-mixed-refs, no-mbtree
- fast: subme 6, ref 2, rc-lookahead 30
- medium: No changes
- slow: subme 8, ref 5, me umh, b-adapt 2, direct auto, rc-lookahead 50
- slower: subme 9, ref 8, me umh, b-adapt 2, direct auto, rc-lookahead 60, partitions all, trellis 2
- veryslow: subme 10, ref 16, me umh, b-adapt 2, direct auto, rc-lookahead 60, partitions all, trellis 2, bframes 8, merange 24
- placebo: subme 10, ref 16, me tesa, b-adapt 2, direct auto, rc-lookahead 60, partitions all, trellis 2, bframes 16, no-fast-pskip, slow-firstpass