YouTube videos of HQ and HD quality are already using H.264 video and AAC audio. You can simply copy and paste the video and audio from the FLV container and place it into a MP4 container with FFmpeg. Building off of what TheBuzzSaw says, here is an example from the HQ version of the interestingly hilarious UAF Nanook Hockey Open 07-08 "Highway to the Danger Zone" movie:
Maybe I only think it's funny because I went to school there. Anyway, this will copy the audio and video into a MP4 file without re-encoding. This preserves the quality and is fast. The ~/ is a shortcut to your home folder.
ffmpeg -i FlashYpLhof -acodec copy -vcodec copy ~/hockey.mp4
Edit: Looking closer at the HQ files, they appear to already be using the MP4 container.