All of these were tested on Ubuntu 9.10. It's possible that other distributions don't have the same video presets (-vpre) available.
The “-crf” option can be adjusted slightly if lower quality is acceptable (remember that a higher value results in lower quality). 18 works very well for cartoon-style content (e.g. Futurama, Family Guy, etc.), while 20 or 22 is acceptable for live-action video.
It is important to remember that none of the below commands specify what to do with the audio stream if one exists. If you're transcoding an input file that contains just video, this is not a problem, however if there is an audio stream, ffmpeg will default to 64kbps MP2. Transcoding the audio stream is often unnecessary, in which case you can simply tell ffmpeg to copy the audio stream(s) unchanged by inserting this into the command (before the output filename): -acodec copy
Alternatively you can use: -an to tell it to skip audio streams entirely. The same applies with subtitle streams: -sn
ffmpeg -i <input.avi> -vcodec libx264 -vpre hq -crf 18 -s 1280×720 -acodec copy -threads 0 <output.avi>
ffmpeg -i <input.avi> -vcodec libx264 -vpre hq -crf 18 -s 1920×1080 -acodec copy -threads 0 <output.avi>
ffmpeg -i <input.avi> -vcodec libx264 -vpre hq -vpre ipod640 -crf 18 -s 320×240 -acodec copy -threads 0 <output.avi>
ffmpeg -i t00_in.mkv -acodec copy -scodec copy -vcodec libx264 -vpre hq -crf 18 -threads 0 t00_out.mkv