In my snippet collection I have the following for this task.
ffmpeg first pass:
ffmpeg -y -i input.mp4 -pass 1 -vcodec libx264 -b 2000k -g 300 -bf 3 -refs 6 -b_strategy 1 -coder 1 -qmin 10 -qmax 51 -sc_threshold 40 -flags +loop -cmp +chroma -me_range 16 -me_method umh -subq 7 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -directpred 3 -flags2 +dct8x8+wpred+bpyramid+mixed_refs -trellis 1 -partitions +parti8x8+parti4x4+partp8x8+partp4x4+partb8x8 -acodec libfaac -ab 128k output.mp4
ffmpeg second pass:
ffmpeg -y -i input.mp4 -pass 2 -vcodec libx264 -b 2000k -g 300 -bf 3 -refs 6 -b_strategy 1 -coder 1 -qmin 10 -qmax 51 -sc_threshold 40 -flags +loop -cmp +chroma -me_range 16 -me_method umh -subq 7 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -directpred 3 -flags2 +dct8x8+wpred+bpyramid+mixed_refs -trellis 1 -partitions +parti8x8+parti4x4+partp8x8+partp4x4+partb8x8 -acodec libfaac -ab 128k output.mp4
The quality setting are 2000k = video bitrate, 128k = audio bitrat and 300 = GOP. Don't ask me what the other parameters are. :)
Interleaving with MP4Box:
MP4Box -inter 500 output.mp4
Create a thumbnail / poster image (play around with 5 to obtain your desired image)
ffmpeg -itsoffset -5 -i output.mp4 -vcodec mjpeg -vframes 1 -an -f rawvideo -s 1280x720 thumbnail.jpg
Hope this helps.