A fast and dirty custom ffmpeg command you could use:
-c:v libx264 -preset fast -crf 20 -coder 1 -movflags +faststart -g 30 -bf 2 -c:a aac -b:a 384k -profile:a aac_low -pix_fmt yuv420p -f mp4
This is based on YouTube's recommended settings for uploads. The parts you want to mess with are the
preset and most importantly the
crf arguments.
crf will affect the quality of the output video. 20 is pretty good and is what is used by the TASVideos official encoding package for SD encodes. A value of 17 is visually "lossless", though a lower value can be valid to ensure a YouTube re-encode doesn't lose too much info.
Adjust the
preset argument to something that gives you an acceptable encoding time.
Check out this document for more info on valid options here.
If you need actually lossless output, you could use this:
-c:v libx264 -preset fast -crf 0 -coder 1 -movflags +faststart -g 30 -bf 2 -c:a copy -pix_fmt + -f mp4
edit: These settings are really only if you just need to dump video to watch later and need to avoid the 2gb split problem. Using lossless x264 video as input for later video processing is a bad idea and will be very slow and troublesome.