After the 2nd pass is done, copy the video.mp4 to nokia 5800 xm or n97's memory card and open the file using file manager of nokia after removing the device from the computer.

we need to run the above two commands in the folder where video.avi is present. play around with abitrate, vbitrate, and scale values to get video quality and size of your liking. alternate formatfactory is a mencoder gpl application for windows which runs in wine, can also convert all-to-mp4.

scale=640:-3 will try to keep the video width to 640 and resize the video height accordingly. Do use the "original" aspect in nokia's mp4 player "option->aspect" for 16:9 and 4:3 aspect ratio videos.

複数の音声が入った多言語の MKV 動画を音声ストリームが複数ある MP4 にエンコード

to encode multi-audio file to mp4 we need to use the "-aid <audio stream number>" like -map 0:1 in ffmpeg)