So, I finally got around creating a good CMD script that generates videos fully compatible with the YouTube application. It was kind of a pain since container format profile for mp42 seems to be a MPEG-4 variant somewhat uncommon, created by Microsoft, and FFmpeg still isn't compatible with it.
So, for now, the following script generates both video and audio streams separately, with the appropiate formats. Then, MP4Box is used to multiplex both files into a single MP4 (with the correct containter format). This assumes you already have installed MP4Box, so go get it if you already don't have it.
Code:
ffmpeg -y -i "%~1" -s 400x240 -aspect 2:1 -c:v mpeg4 -b:v 400k -g 100 -profile:v 0 -level 3 -bf 2 -an "video.mp4"
ffmpeg -y -i "%~1" -vn -c:a libvo_aacenc -ar 44100 -b:a 128k -ac 2 "audio.aac"
MP4Box -brand mp42 -delay 1=1 -add "video.mp4" -add "audio.aac:sbr" "output.mp4"
DEL /F "video.mp4" "audio.aac"
You can of course modify the video/audio stream settings to suit your needs (except changing the applied codecs), but be warned: don't set values too high unless you wanna end up getting a buffering hell.
Foxi4 is right, though. We need to find out which other containers/codecs are compatible with the YouTube player, in order to see if we can generate videos with better compression rates and overall a better playback experience.
If anyone is interested, I didn't have enough time nor motivation to set myself up a home HTTP server, so I used
www.qfs.mobi to upload the test files from my PC and then I logged in from my 3DS to play them.
P.S.: Use "-c:a aac -strict -2" instead of "-c:a libvo_aacenc" in line 2 if you didn't include the "-enable-libvo-aacenc" flag in your FFmpeg build.
EDIT: Here's an example video (use your 3DS to navigate all the way here):
http://qfs.mobi/f1117423.