Nokia N800 Tablet PDA

From MythTV Official Wiki
Revision as of 03:50, 30 April 2007 by Chrismcnally (talk | contribs) (Test other Options)

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 4 hours of content will fit on a 2 gig SD card, and the N800 holds two 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 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

You need to have the latest image from Nokia to have a stable media player. You can use the Windows software provided to install the image or follow these easy Linux instructions:

http://maemo.org/maemowiki/HOWTO_FlashLatestNokiaImageWithLinux?highlight=%28CategoryFlashing%29

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.

Test other Options

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

I pulled most of the mencoder command line out of 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.


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

There is already a great PDA script contribution for MythTV, and a few mods will make it work for you 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.

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

Now in the Myth frontend, when you are looking at your list of recorded programs, you can select a recording and PDA Transcode it. Use the right arrow on the remote and choose Job Options and then 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

Edit pdatranscode.pl and change these two lines to reflect your setup. The 'dir' is where myth stores your 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

  '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:

  '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',


Edit pdatranscode.pl and change these two lines to reflect your setup. The 'dir' is where myth stores your 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

  '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.

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

change to:

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

next, add your mencoder line. I replaced the psp line with my mencoder command. You can paste in your cutom mencoder line or use mine. Instead of certain values, you will use the scripts variables 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',

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. 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 that it checks for an error. After that you can ad your lines for mounting the sd card and copying the file.

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. This is how it worked with my USB multi-card reader on Fedora.

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

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