Manual video encoding
For automatic video conversion tools, see the video encoding article.
Mencoder
The tool I use to encode video is mencoder that comes with mplayer on Linux. Always start with the cleanest video you can, and make sure it has good A/V sync before you start by watching it on a PC. Make sure the original has a frame rate greater than or equal to the one you are trying to generate.
The recommended way to run mencoder is through tablet-encoder. You can however try running mencoder directly and playing with the options. Be careful about forcing the output frame rate, however. I didn't get any good result with the below commands. Instead, I got A/V desync and bad effects due do frame rate changes, so I now use some variation of the above shell scripts.
mencoder infile.avi -oac mp3lame -ovc lavc -lavcopts vcodec=mpeg4 -vf scale=352:208 -ffourcc DIVX -ofps 15 -o outfile.avi
This will generate a 15fps 352x208 avi file.
The following mencoder command line will make smaller videos:
mencoder infile.avi -oac mp3lame -ovc lavc -lavcopts vcodec=mpeg4:mbd=1:vbitrate=300 -vf scale=352:208 -ffourcc DIVX -ofps 15 -o outfile.avi
To make even smaller, you can drop down the quality of audio to 64 kbit/s (for 300 kbit video stream, converting audio to 64 kbit versus 128 kbit yields a total save of approx 20%. Notice that for lower bitrate movies percentage is considerably higher):
mencoder infile.avi -oac mp3lame -lameopts abr:br=64 -ovc lavc -lavcopts vcodec=mpeg4:mbd=1:vbitrate=300 -vf scale=352:208 -ffourcc DIVX -ofps 15 -o outfile.avi
The differences are the block detection method (mbd=1) and a capped bitrate see man mencoder for more options
ffmpeg
It is possible to transcode a video with ffmpeg. But the video will have a corrupted fourcc header. This can be corrected with the tool avifix from transcode or by using -vtag DIVX in ffmpeg command line:
ffmpeg -i infile -vcodec mpeg4 -acodec mp3 -s 176:144 -b 200 -pass 1 outfile.avi ffmpeg -i infile -vcodec mpeg4 -acodec mp3 -s 176:144 -b 200 -pass 2 outfile.avi avifix -i outfile.avi -F "divx"
Or directly (without avifix):
ffmpeg -i infile -vcodec mpeg4 -acodec mp3 -vtag DIVX -s 176:144 -b 200 -pass 1 outfile.avi ffmpeg -i infile -vcodec mpeg4 -acodec mp3 -vtag DIVX -s 176:144 -b 200 -pass 2 outfile.avi
transcode
I just converted a DVD using transcode using the following command line:
transcode -i /dev/dvd \ - x dvd \ - T 1,1-16 \ - a 0 - j 48,0,48,0 \ - Z 240x160 \ - y xvid \ - V -w 300 \ - N 0x55 \ - b 48 \ - o output.avi
This transcodes chapters 1 to 16 of title 1. The DVD has 720x576, but uses only 720x480, so I clipped off the remaining 96 black pixels with the -j option. Output size is 240x160. Video bitrate is 300kbps, audio is 48kbps. The "xvid" codec (a symlink to xvid2 on my system) gives very good results with the default settings. Do not use "mpeg4", it needs too much processor power for decoding which causes loads of artefacts when playing on the Nokia, even if it looks good on a PC.
I used the transcode package with Debian unstable.
afterwards, I fixed the FOURCC with
avifix -i output.avi -F DIVX
The resulting AVI file has 114 MByte for 45 minutes/25fps. Things can certainly be improved by tuning xvid options using a ./xvid2.cfg, but I didn't try that yet.
Here is another example, where the DVD has 720x576 fully used for 4:3 content. I chose 256x192 as output size (4x64, 3x64). This time I used the xvid4 codec. Note that you must not use B-frames, the 770/N800 doesn't seem to be able to handle them. You can turn them off by setting max_bframes=0 in your xvid4.cfg, you can easily do this with the xvid4conf tool. After you did this, the following command line will do the rest:
transcode -i /dev/dvd \ - x dvd \ - T 1,-1 \ - a 0 - Z 256x192 \ - y xvid4 \ - V -w 300 \ - N 0x55 \ - b 48 \ - o output.avi
The -T 1,-1 option will convert the whole title 1 (all chapters). You can try a lower video bitrate by adjusting the -w parameter (300kbps in this example). Don't forget to fix the FOURCC with the avifix command (as above)! The quality is very good, and it works fine with 25fps.
Additional informations regarding transcode and IT 2006 beta :
I suggest using the following command-line :
transcode -i /dev/dvd \ - x dvd \ - T 1,-1 \ - a 0 - Z 352x208 \ - -keep_asr \ - y ffmpeg \ - F mpeg4 \ - w 300 \ - N 0x55 \ - b 48 \ - R 1 \ - o output.avi
and
transcode -i /dev/dvd \ - x dvd \ - T 1,-1 \ - a 0 - Z 352x208 \ - -keep_asr \ - y ffmpeg \ - F mpeg4 \ - w 300 \ - N 0x55 \ - b 48 \ - R 2 \ - o output.avi
using ffmpeg, there is no need to fix FOURCC. -R x is used to do two-pass encoding. --keep_asr will resize source video to fit in the specified target resolution, no need to worry about cropping or adding black borders if source isn't using the same aspect ratio (DVD often uses 1.77 anamorphic format ), transcode will take care of it. The only choice to do is target resolution : 320x208 or 240x144 for 16:9 source, 352x288 or 176x144 for 4:3 source.