Well, no reply during the weekend means I experimented a bit myself.
It looks like for MP4 container format the requirements are H264 video codec set to Main or Baseline profile, and AAC audio codec set to LC profile. An upload with H264/High and AAC/HE was rejected, but I didn’t dig deeper to find out if it was one or both settings that caused the rejection. I also haven’t looked into bitrate restrictions.
All media are reencoded on Twitter’s end, even if they match exactly with what Twitter itself produces qua codec/profile/bitrate/resolution. Several video resolutions are produced, 1280×720, 640×360 and 320×180 for 16:9 aspect ratio, and 480×360 and 240×180 for 4:3 aspect ratio (maybe there’s a 960×720 too; didn’t test). It seems that uploaded video resolutions that don’t match these are reduced to the next lower one. REST output always reports the same bitrates, but actual bitrates vary quite a lot. I’d estimate the average to be ~3.33b/px/s for the middle resolutions. The 1280×720 resolution has a H264 Main profile, the middle ones have a Baseline profile (and a level of 2.1, if that’s interesting for anyone).
Since everything is reencoded anyway, it’s probably best to upload in the highest resolution and quality available, and not try to match Twitter’s output. I just tested a small video that ended up larger than the original, but (obviously) looked worse. The reencoding also doesn’t copy any metadata, so it’s pointless to add tags like title, author, cover art, copyright or language 