Thanks! Which software would you recommend?
I personally use VirtualDub for most of my needs. There's a 2-pass encoding option build into x264vfw. This simply encodes a dummy stream that's empty but the audio is still encoded normally so you're better off disabling audio during the first pass, then enabling things for the second pass.
My first encounter with a 2-pass encoding was with NeroBurner, which did 2 passes on Mpeg2 video before making a master file for burning to DVD. Experimenting I could put something like 8-10 episodes of an anime looking really decent using that technique. Can't remember what I was doing. But it was certainly effective.