EncodingForOpieplayer2

= Encoding for Media Player 2 =

This page should give some Information about how to recode Movies so they are usable for a small iPAQ Screen and the current state of development of Media Player 2.

General
In theory, Media Player 2 is capable of playing all Movies for which he has codecs, but in practice this does not work every time. Due to limitations of the screen size and the resolution of the Handheld the Movie needs to be much smaller then for a Desktop PC. Although storage Cards are getting bigger, storage Space is limited and handling this limited Space makes it neccessary to adjust the needed Space with the Size and Quality of the Clip. Also i experienced some Problems with resolutions apart from 176x144(QCIF), 240x176 and 320x240(QVGA), Media Player 2 simply Segfaults in such case.

Using mencoder
There is a really nice Tut for using mencoder, of course I found it after I had some fun with transcode:

http://www.cs.unc.edu/~hensley/zaurus/encode.html

Getting Started
To get started with encoding a Movie you need several things on the Device and on your Desktop:

Handheld: -opie-mediaplayer2 and opie-mediaplayer2-skin-default -Codecs: -libxine-plugin-ao-out-oss -libxine-plugin-decode-ff -libxine-plugin-decode-mad -libxine-plugin-dmx-audio -libxine-plugin-dmx-avi -libxine-plugin-dmx-mpeg -libxine-plugin-inp-file -libxine1

Desktop: -Avifile -MPlayer -MJpegtools -Mpeg2Dec -Transcode

With Debian you can use deb ftp://ftp.nerim.net/debian-marillat/ unstable main in your /etc/apt/sources.list to get those things.

This should be enough to create an AVI file.

Gathering Information
We need some Information about the Input File, like Framerate and Resolution. The easiest way to get this is to start playing it with mplayer, it shows this somewhere ;)

Encoding
This shall not be a complete transcode tutorial, there are enough on the Web. Maybe you should read some of them before proceeding.

In this example we will recode an OGM file to an AVI. The Outfile will be a XVID, resolution 240x176, with a bitrate of 300 and MP3 Sound.

$ transcode -i INFILE.OGM -x mplayer,ogg -f 25 --export_fps=15 -o ausgang -J fps=25:15 -V -y xvid,lame  -Z 240x176,fast -w 300

Now I'll explain the Options I used:

-i: the Inputfile -x: Here come the Problems ;)  This Option specifies the Decoder for Video,Audio. Here i Use mplayer for Video and ogg for Audio. In theory one can use mplayer for both, but it is slow and may cause problems. Encoders and Decoders can be found in the transcode Wiki and in the Man page, as OGM is "some video codec" and OGG Sound, we need ogg to decode sound. For AVI Files af6 from the Avifile package is a good and fast choice, works also for MP3 Sound. -f: The Input Framerate. It's most times 25 or 29.xxx, see "Gathering Information" --export_fps=: This should be the Framerate for the Pocket Device. As we need to safe Space and CPU, 15fps is a good choice for most films. -o: The Outfiles will have this tag in the name. -J x: Optional Modules transcode should use, here we need the fps converter. There is a second one called modfps. There are more good Modules, like normalize for the Sound. -y: The Video Encoders. Here we need to select a good one ;) As Media Player 2 is capable of Playing AVI, xvid is a good choice with Space and Quality. lame is an MP3 Encoder, the Audio Format of AVI. -Z: The Resolution of the Outputfile, I made good experiences with 240x176, as my iPAQ3850 has not that much CPU Power to get 320x240 working properly. ,fast is the fast way of resizing it. -w: This is the bitrate of the movie, 300 is good for most cases. If you've got very low Space, you can try something about 200, like some Tutorials say.

For big movies with low CPU Power this needs much time... so go and get some Coffee :-)

More Options:
There are -B and -X to rescale the Video and keep the aspect Ratio by inserting some black bars or removing them. Those need some Calculation and reading, as this is complicated I won't explain them here. Get a full Tutorial for them on the net.

multiplex
Afterwards you'll have two files, one ausgang and ausgang.mp3, one are the Pics and one is the Sound. We need to get them together in a AVI Container with avimerge: $ avimerge -o OUTPUTFILE -i ausgang -p ausgang.mp3

-i: Specifies the Video file -p: Specifies the Sound File

Now you should have got a Small File with Sound and Video that wants to be played on your iPAQ/Z/...

Afterwards
You need to play some time with the Options until you have a good Output. Some De/Encoders are not right for the file you want to convert. transcode's -c option allows you to specify a range of frames i.e. 1-10000 which shall be encoded, you can make a test run with some frames before you let him recode hours with bad Options.

Some Words about my Device. I've got an iPAQ 3850, 200Mhz ARM. With more CPU Power you can use a higher Resolution and with more Memory (CF/SD/MMC) a higher bitrate, although a higher Bitrate needs more CPU, too.

Links
http://transcoding.org - Main Page of transcode http://www.linuxforen.de/forums/showthread.php?t=50974 - Good German transcode Tutorial