Handbrake has presets for the iPhone, AppleTV 2 and 3, iPod and other devices.
These make use of a rather recent bundled version of libx264 – so it usually produces really good quality. When choosing settings, make sure you use the Constant Rate Factor instead of a fixed or average bitrate (or check that it's not over 2 Mbit/s; see later for more). It usually results in better average quality than just trying to squeeze the bitrate.
Handbrake doesn't allow you to perform "real" batch encoding by default. Handbrake has a queue which you can fill with input video one-by-one, but it's tedious. You can use HandBrakeBatch to do the job instead.
If you want to stick to FFmpeg, you can use the presets and level/profile settings supplied with the
libx264 encoder to generate iPhone-compatible output video. The basic command you can use for iPhone 4s would be:
ffmpeg -i input.mp4 -c:v libx264 -crf 24 -c:a libfaac -b:a 192k out.mp4
Tune the value on
-crf for quality. Lower means better, higher means worse quality. Sane values range from 19 to 25.
The iPhone 3GS and lower only support the Baseline profile (i.e. use
-profile:v baseline) and Level 3.0 (i.e.
-level 3.0). Don't forget to scale the video accordingly with
-s:v 960×540 for example.
See this blog entry for more info on encoding for Apple devices, which would go far beyond what I can explain here.