I have some hidef video that I shot using my D90 and a fantastic lens, but I had the camera rotated 90 degrees. While x264 supports lossless rotating, you won’t find any software out there that implements it, so we have to re-encode. So here is a command I use to go from x264 to x264 at nearly identical quality to what my camera shoots.
mencoder -vf rotate=2 -ovc x264 -x264encopts bitrate=5000:subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid:weight_b:threads=3 -oac copy DSC_6225.AVI -o Rotated.avi