Nokia N800 Tablet PDA

From MythTV Official Wiki
Jump to: navigation, search

Nokia Linux Handheld

The Nokia N800 Internet Tablet is a powerful Linux handheld computer capable of playing transcoded movies and TV shows on its beautiful 4.1" 800x480 screen. It has a stand and speakers for two people to watch at once, or you can plug in headphones. You can shrink a one hour program into 180 - 250 meg and it looks great. About 16 hours of content will fit on a 8 gig SDHC card, and the N800 holds two SDHC cards. It also fits in my jacket pocket.

The purpose of this HOWTO is to lead you toward setting up MythTV to automatcially transcode and copy programs overnight to an SD or SDHC card so you can watch on the plane, train or bus. I see people watching videos on their ipods and laptops on the train, but the N800 is a lot lighter than a laptop, has a larger and nicer screen than the iPod. Because it's Linux, open source developers are porting current apps and writing new ones.

Nokia-n800-photo.jpg

Get Latest Image from Nokia

Nokia users should periodically visit the Maemo site to obtain the latest firmware. New releases typically improve media player performance and increase stability. The July 2007 firmware release for example includes a new media player, and adds SDHC SD card support to the kernel (up to 8GB per SD slot!). You can use the Windows software provided to install the image or follow these easy Linux instructions:

http://maemo.org/community/wiki/howto_flashlatestnokiaimagewithlinux/

Manually Transcoding

Manually, you can use mencoder to transcode the files. This command does a little cropping so that the entire screen is filled with the show, and the bitrate produces a very small file but is still very clear for watching. The output is videos/pda/crop_0_20.avi and the input is a myth recording stored in file /myth/2028_20070429190000.mpg.


mencoder -oac mp3lame -lameopts abr:br=64 -af volnorm -ovc lavc -lavcopts vcodec=mpeg4:dark_mask=0.15:autoaspect:vbitrate=512:trell=yes:v4mv=yes:vpass=1 -vf crop=720:402:0:20,scale=400:240 -idx -ffourcc DIVX -ofps 29.97 -o /videos/pda/crop_0_20.avi /myth/2028_20070429190000.mpg


I record all my SD shows at 720x480. Using this scale and crop I lose a little of the bottom and top but the video plays full screen on the N800 and still looks fantastic.

Try Different Mencoder Settings

If you just want to use my settings you can skip this section. However if you care to try different mencoder settings, here are some helpful GUI and non GUI tools to try.

Media Converter is a very helpful cross platform graphical Java program you can run to play with preset and adjustable mencoder settings. It has preset for the N800, but also you can control video and audio bit rate and more with sliders and buttons. It will handle a batch of conversions at once, and there is an option produce 30 second clips only -- so you can quickly view different settings and compare them.

https://garage.maemo.org/frs/?group_id=26

This howto uses much of the mencoder command line found in the logging output of this program. It has an install for Windows and jar and shell script for Linux. There is also a Mac OS X version.

Tablet Encode is a command line tool with several presets that are guaranteed to play on the Nokia N800. It's cross platform, uses mencoder, and can even rip DVD's and convert them.


This page has all the info you need to know about video encoding for the N800, including links to other programs, scripts and transcode, mencocder and ffmpeg commands:

http://maemo.org/maemowiki/VideoEncoding

This page contains a perl script for transcoding. It has many options:

http://www.bleb.org/software/770/

Making it run in Batch from the Myth Transcode Menu

There is already a great PDA transcode script for MythTV and installation instructions. If you make a few changes it will work for your N800. Directions for downloading and installing this as script in MythTV follow. You will want to copy the script, make it executable, and then install it in Myth as a User Job. Then transcoding for the N800 will be available as an option in the Myth frontend.

On your MythTV backend machine, do this in a shell

cd /usr/local/bin
wget http://www.tux.org/~peterw/linux/pdatranscode.pl.txt
mv pdatranscode.pl.txt pdatranscode.pl
chmod +x pdatranscode.pl
pdatranscode.pl --install-job-number 4

Next time you start the MythTv frontend, you will have a new transcoding option, PDA Transcode. I access it by viewing the list of recordings in watch recordings, I choose the recording and hit the right arrow on the remote. A menu pops up and on it is Job Options. Clicking on that gives you several options, including Begin PDA Transcode.

We first need to edit the perl script to use our mencoder command and then to mount and copy the file to an SD card when done.

Edit the script

We need to modify pdatranscode.pl to specify our recordings directory and output directory, and to use our mencoder settings. Opent the file with an editor and look for the variables 'dir' and 'pda-dir', and change these two lines to reflect your setup. The 'dir' is where Myth stores your TV recordings and pda-dir is a directory you create to store your transcoded copies of the recordings. Make sure the mythtv user can write to this new directory

Edit these to match your setup

  'dir'                       => '/myth',
  'pda-dir'           => '/videos/pda',

Next, find these two lines. The transcoder is the name of the perl variable for the transcoder to use, we use mencoder, but you can put lame in here, since lame is a variable we define later. Also add your crop in here if you plant to crop.

replace these two lines:

  'transcoder'                => 'lavc',
  'scale'             => '320:240',

with these 3 lines (lame is a variable we define later):

  'transcoder'                => 'lame',
  'scale'             => '400:240',
  'crop'              => '720:402:0:20',

Next, add your mencoder command line. I replaced the psp line with my mencoder command. You can paste in your custom mencoder line or use mine. Instead of certain values, you will use the scripts variables, such as for infile, outfile, scale and crop.

replace this psp line:

 'psp' => 'mencoder -aid 0 -oac lavc -ovc lavc -of lavf -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:vbitrate=300:acodec=aac -af lavcresample=24000:volume=10.1:0 -vf harddup -lavfopts format=psp:i_certify_that_my_video_stream_does_not_use_b_frames -vf scale=368:208 -o {outfile} {infile} -quiet',

with this:

  'lame' => 'mencoder -oac mp3lame -lameopts abr:br=64 -af volnorm -ovc lavc -lavcopts vcodec=mpeg4:dark_mask=0.15:autoaspect:vbitrate=512:trell=yes:v4mv=yes:vpass=1  -vf crop={crop},scale={scale} -idx -ffourcc DIVX  -ofps 29.97 -o {outfile} {infile} -quiet',

Test

You can test it at this point. Restart the Mythfrontend if you have not since installing the user job. Then go into the watch recordings and choose a recording to transcode. I use the right arrow to bring up the menu, and choose Job Options then Begin PDA Transcode.

You can watch the output of the user job by tailing the mythbackend log. Watch out for any errors caused by typos. In a shell do this:

tail -f /var/log/mythtv/mythbackend.log

Copying To SD

In the pdatranscode.pl script, the line that actually transcodes your recording is the second line below. The first line I added for debugging. After executing the transcode it checks for an error. You can add your lines for mounting the SD card and copying the file after this section.

Find this section:

print STDERR "$config{cmd}";
my $returnCode = system($config{cmd});
# print a message if there was an error
if ( $returnCode != 0 ) {
   print STDERR "Transcoding failed for $config{infile} with error $returnCode\n";
   show the config, might help troubleshoot
  &showConfig();
}

Copying the recording to your SD card may be different for your distribution and card reader. These commands are unlikely to work on your system unless you've already set up a card reader, created the directory /media/usbdisk1 and know that /dev/sdc1 is your card reader's sd slot. Find a howto if you have not used your sd card with Linux. This worked with my USB multi-card reader on Fedora.

system("umount /dev/sdc1");
system("mount /dev/sdc1 /media/usbdisk1");
system("cp -f $config{pda-dir}/$config{outfile} /media/usbdisk1/");

Yep. Pretty cheap I know. I'm not a perl programmer.

Once this is working you can leave an sd card in the card reader and set up your schedule to PDA transcode certain shows. In the morning, swap the SD card from the Nokia with the one in the Myth Box and you have entertainment to go.