General

Nokia N95 has quite good video support. However, the specification how to make them is left mostly on "Use Nokia Media Converter" instructions. Especially Linux users are left in the dark. So here is my work on subject.

My current conversion script.

Requirements:

Formats

Accepted formats can be found from Nokia Forum. These formats do not tell which feature set of h264 specification videos can utilize.

H264

It too almost 2 months for finding the correct parameters for h264 files. As you might guess advanced format like h264 is not as simple as one might think. It has many profiles and features which are either supported or not. The following mencoder line generates Simple profile compatible videos. Simple profile is also called as Baseline profile (see above wikipedia article).

The reason for using mencoder rather than e.g. x264 was that my original videos were in raw DV format and ffmpeg codecs were somehow broken and could not read my DV files from old Panasonic DV camera. Mencoder can be forced to use particular DV codec whereas ffmpeg could not.

Working combinations:

Next plays otherwise OK but video in slow motion (no hw acceleration?) and only without extra apps running (memory problem?)

# For $SCALE, "352:264" works for 4:3 movies, and "352:200" works for 16:9
X_SCALE=416
Y_SCALE=312
X_ASPECT=4
Y_ASPECT=3
A_BITRATE=64
FPS=15
echo "======================================================"
echo ""
echo "x264 pass 1 of 1..."
echo ""
echo "======================================================"
mencoder -vf lavcdeint,scale=${X_SCALE}:${Y_SCALE},format=i420 -ovc x264 -x264encopts \
nocabac:nopsnr:crf=21:subq=7:me=3:me_range=24:frameref=16:mixed_refs:threads=2:bframes=0:nob8x8mv:no4x4mv:no8x8mv:no8x8dct:bitrate=${V_BITRATE} \
         -nosound \
         -lavdopts threads=2 \
         -fps ${FPS} -of rawvideo -o temppi.264 ${V_NAME}
# Sound
mplayer -vc null -vo null -ao pcm:fast ${V_NAME}
faac --mpeg-vers 4 audiodump.wav
echo "======================================================"
# Combine into mp4 container
MP4Box -new -add temppi.264 -add audiodump.aac \
       -fps ${FPS} ${BASENAME}${1}-${V_BITRATE}-${FPS}-${X_SCALE}.mp4
rm -f temppi.264 audiodump.wav audiodump.aac
echo "======================================================"

MP4

MPEG-4 is same as DivX 4/5 (from man mencoder). The only difference is container format. N95 RealPlayer does not understand avi files rather they should be in MP4 container.

Working combinations if video bitrate is 400:

Bitrate 800

Bitrate 1500

Bitrate 1500

X_SCALE=640
Y_SCALE=480
X_ASPECT=4
Y_ASPECT=3
A_BITRATE=64
FPS=25 
echo "======================================================"
mencoder -ofps $FPS -o temppi.m4v -of rawvideo \
         -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=${V_BITRATE}:threads=2 \
         -vf lavcdeint,scale=${X_SCALE}:${Y_SCALE} -lavdopts threads=2 \
         ${V_NAME}
echo "======================================================"
# Sound
mplayer -vo null -vc null -ao pcm:fast ${V_NAME}
faac --mpeg-vers 4 audiodump.wav
echo "======================================================"
# Combine into mp4 container
MP4Box -new -add temppi.m4v -add audiodump.aac -fps $FPS \
       -brand mp42 -isma ${BASENAME}${1}-${V_BITRATE}-${FPS}-${X_SCALE}.mp4
rm -f temppi.m4v audiodump.wav audiodump.aac
echo "======================================================"

DivX/Xvid AVI

Using divxplayer also avi files are available for N95. Tested with Raw DV to 720x576 [divx|xvid] up to 1500 bitrate. Xvid seems to work better than DivX.