Post subject: x264 encoder settings
Joined: 11/1/2007
Posts: 100
I was bumping heads with someone in #x264 on our fair (not) freenode, and he made some points that I thought I'd mention: * Three-pass is probably unnecessary, as the quality gain would be negligable. His actual words were "you only need to use pass=3 if you intend to use more passes after the second; if you intend to do that, you're probably confusing x264 with an MPEG-2 encoder" and "[three passes instead of two max] isn't a very good suggestion; the time is better spent doing something else". * I use umh with range 64, whereas he suggests esa with range 16 "might be better", and would probably be faster, and "on your kind of footage esa might be particularly useful, dunno". * qpel is useless (but is forced on in x264 anyway). * qp_step (which I set to 50) is only used in VBV mode (while I use average bitrate). Then I was told to RTFM. The mencoder manual didn't count, and the x264 manual (which he linked to) was similarly useless.
Joined: 11/1/2007
Posts: 100
I decided to do some tests. I tested CRF first. I set CRF to 40 (so I could get a good amount of artifacts for comparison), then ran ABR three-pass using the same average bitrate, which came out to be 334Kbps. The left frame is CRF, while the right is ABR three pass. All other settings are identical. The quality difference speaks for itself. Note that CRF isn't like this the whole time. This happens after the background flashes white, and it tends to look like crap for the next 10-20 frames. It also doesn't get the benefit of analysis that multi-pass encoding does, so the encoder logo, for example, suffers visually. In fact, most of the video tends to suffer visually. The background also tends to "shimmer" in CRF, while the ABR encode manages to maintain background quality throughout the video. I really can't recommend CRF after this. EDIT: I re-ran the test using CRF 40 on the newest x264 binary, and the resulting bitrate was much lower (94.75Kbits). ABR three-pass with similar bitrate ended up with very similar if not identical quality.
Senior Moderator
Joined: 8/4/2005
Posts: 5777
Location: Away
On topic of motion search range: the number there is a number of pixels, so it's safe to assume that if nothing within the game moves at 64 pixels per frame (in any direction applicable to the search type), it won't make sense to crank it up there. Exhaustive search may help with very fast AND complex movement, like if the screen is scrolling at a high speed and there are multiple background layers with other kind of motion going on there (a good example is S3&K, where Angel Island 2 and Sandopolis 1 exhibit exactly that kind of complexity). If unsure, take the part that you think is the hardest for encoder to handle out (1-2 minutes should be just enough), and do a test encoding (3-pass umh vs. 3-pass esa) to see if there are any benefits from exhaustive search. Also, don't forget that motion search range is basically multiplied by the amount of reference frames, so if you're using esa, it might make sense to lower the frameref to 10-12, definitely not 15-16 unless you want to wait for eternity for the last little bit of quality. On topic of two-pass vs. three-pass: the difference in global PSNR between 2nd and 3rd passes is usually about 0.5-2%, which is about the same kind of difference as between using umh and esa for almost every case. Expect the difference between 3rd and any subsequent pass to be lower than 0.5% (and thus, absolutely negligible).
Warp wrote:
Edit: I think I understand now: It's my avatar, isn't it? It makes me look angry.