MythTV to phone (.3gp) transcoder script and Bluetooth transfer

I built a perl script that can be used as a "User Job" from within mythtv to convert a recorded TV program into a cell phone (.3gp) movie. It makes uses of mythname.pl to get the show and title (for the filename) and mplayer/mencoder and ffmpeg to do the actual transcoding.

Unless you want to drop your files off in the /var/lib/mythtv/for_phone directory, you will need to edit the output directory.  I've found that 35 minutes of TV gets shrunken down to 24-30megs when in .3gp format when transcoded at a generous 80/16 (video/audio bitrate).

Script to transcode from mythtv files to .3gp files

I wrote a second script to transfer any files in this directory to my phone via bluetooth OBEX push every night. I use cron to start the phoneTransfer.pl script up each night, and it looks for any .3gp files in the directory and tries to copy them to my phone. If successful, it removes them from the directory.  Note that my Motorola V3xx has an annoying feature where it will receive OBEX bluetooth files into phone memory, and NOT to the default download location (which can be set to the memory card). If your phone is similar, you will have to copy files from the phone's memory to the memory card so that your phone's memory doesn't get full. If your phone's memory gets full, it will refuse further bluetooth transfers until you move the files over to a memory card. 

Script that does a bluetooth transfer to phone

Note that to use this script you will have to find your phone's bluetooth mac address (using "hcitool scan") and put it in the script. Also, you should pair your phone with your computer, and set your phone up to automatically accept OBEX push/FTP transfers unless you want to manually approve each video transfer.

How to import all windows fonts to Ubuntu (Gutsy)

I do NOT recommend importing all of your windows fonts to Linux. Sure, you paid for windows, and should be able to use all the windows fonts on any OS you want, but Microsoft (and their lawyers) may not feel the same way. Read your license agreement carefully. Instead, you should install the freely released and  licensed to all for any use Microsoft "core" fonts. (Also, Arial-9 killed my firefox install)

But, if after that warning you still want to import all of your Microsoft Windows truetype fonts from your windows partition to your linux partition and install them system wide, here is what to do:

Gain root privileges: sudo bash

Make a directory to store the fonts: mkdir  /usr/share/fonts/truetype/msfonts

Find the fonts on your windows partition, for me this was /media/sda1/Windows/Fonts

copy the fonts over: cp /media/sda1/Windows/Fonts/*.ttf  /usr/share/fonts/truetype/msfonts 

Re-create the font cache:   fc-cache -f -v

Turning off Video Overlay on Linux (Ubuntu 7.10)

The old version of the X.org ati x-server would do a true "clone" of my Thinkpad X31's LCD display out the VGA port on the back of the laptop. The new version shipped with Ubuntu 7.10 (gutsy) however doesn't do a true clone, so video overlays (called Xv in linux) will display movies on the LCD but not on the external VGA monitor.

So when you give a presentation with a movie, you can see the movie, but your audience can not! My X31 is able to play most movies without Xv so I decided not to use it. In windows, you can fix this problem by turning off Video Overlay in the display driver control panel. However, under Linux, you have to tell each of your movie players to use something besides Xv.  Standard X11 works, but won't allow you to scale videos. I prefer to use OpenGL, which works very nicely with the open source ati driver.

To make mplayer use OpenGL, edit the ~/.mplayer/config file and add the line "vo=gl2".

To make totem use OpenGL, edit the ~/.gnome2/Totem/xine_config file to include a line  as follows: "video.driver:OpenGL"

BTW- If you are unable to get video showing on your external VGA output, you can run the following command to set up a "clone" or "mirror" display:

 xrandr –output LVDS –mode 1024×768 –output VGA-0 –mode 1024×768 –same-as LVDS

Fixing IPW2200 system hang with WEP 802.11

After installing an IPW2200 mini-pci 802.11g wireless card, my wife complained that her system would freeze for a minute while attempting to connect to an 802.11 (WEP) network for the first time. After the initial time-out and failure, wireless network connections would work fine until the computer was rebooted. 

As it turns out, I was experiencing the same problems with my laptop, but I hadn't noticed it because I use suspend/resume a lot more than my wife, and I would go a week or so before doing a full reboot. (One failure to connect to a wireless network per week is a lot less noticeable than one every morning.)

After doing a lot of rebooting and troubleshooting, I isolated a few lines in my /var/log/syslog that appeared to be associated with the freezeup:

eth2: could not initialize WEP: load module ieee80211_crypt_wep
ieee80211_crypt_wep: could not allocate crypto API arc4

Even though my system (Ubuntu 7.04) had the arc4 crypto module, it didn't appear to be loading correctly. I added "arc4" to my /etc/modules file to force it to be loaded, and that appears to have fixed the problem.

D-link DWL-G122 with WPA under Linux

The D-Link DWL-G122 USB 802.11g (revision B1) wifi adaptor works great for open or WEP encrypted networks and is supported by Ubuntu out of the box. Unfortunately, the open source driver doesn't support WPA2 (and only supports WPA via non-standard iwpriv settings, and even then, the support is flaky).

I was able to get it to connect to a WPA network once, following Jermey's instructions. But the network connection was not reliable (as in, I never got it to connect again).

To make it work with the standard wpa_supplicant package, I had to break down and use ndiswrapper to wrap the windows XP drivers. (I also had to blacklist the default rt2570 kernel module). Hopefully the Open Source rt2x00 kernel module will start to support this device (and others based on this chipset) in the future for WPA/WPA2 security.

Even after I used the ndiswrapper, it would only connect to a WPA Personal / TKIP access point. (I could not get it to work with the AES or AES+TKIP settings on WPA or to work with WPA2 at all.)

To make the ubuntu system auto-load wpa_supplicant on boot, Continue reading

Screen Scraping Amazon Album Art for MythTV

mythtv icon

I wanted to get Album Art for all of my (newly ripped) songs on my MythTV box. 

Thierry has a nice perl script which finds album art on Amazon and automatically downloads it, but unfortunately for me the music plugin for MythTV has upgraded their database schema and the script no longer worked.  I am using the trunk SVN code, so it's a bit more up-to-date than the latest packaged release, but this means that scripts designed for the packaged versions may not work. (This specific script had a problem finding the correct directory to store the album art, so all the album art was stored in the root directory, overwriting itself with each album.)

Luckily, I know just enough SQL and Perl to be dangerous, so I whipped up a few changes to his code that fixed my problem (after exploring the new database format). The updated script is here if anybody needs it.

UPDATE: I also added features that allow you to run the script multiple times (if an albumart.jpg file already exists, it will skip that album) and improved the searching (if "album by artist" is not found, it will try searching by "album" name only).

Updated New File: amazon_album_art_scraper.txt (Thanks to Mike Wilson for updates to Amazon’s HTML!)

OLD FILE: Amazon Album Art Scraper Script

Saving a mms streaming video to a file using mencoder

Copying a streaming video to a file using mencoder.

I wanted to watch Randy Pausch's last lecture on my home media PC as opposed to my laptop. It has MythTV, which can be used to watch any file on the hard disk. Unfortunately, you can't just download the a file, as his lecture is hosted by a streaming server. The specific URL is:

mms://wms.andrew.cmu.edu/001/pausch.wmv  

wget won't work, so I had to use mencoder to download the stream and copy it to a file on my hard disk. The command line I used was:

 mencoder mms://wms.andrew.cmu.edu/001/pausch.wmv -o randy.wmv -oac copy -ovc copy

(The -oac and -ovc are the output audio and video codec specfiers, and I have set it to just copy. If you would prefer the file be transcoded to a different format, you could specify a specific codec (xvid with ogg vorbis sound, for example) and mencoder would transcode the file (possibly losing some quality) at the same time.

 

Encrypted home directory under Ubuntu linux 7.04 & 7.10

Lock on doorUsing directions from Felipe Alfaro Solana, I set up an encrypted home directory in Ubuntu 7.04. I only had one problem, that exhibited an error message as follows:

Command failed: Incompatible libdevmapper 1.02.08 (2006-07-17)(compat) and kernel driver

This was caused by the dm_mod module not being loaded. I fixed it for the session by issuing a  modprobe dm_mod command, and fixed it forever by adding dm_mod to my /etc/modules file.

Continue reading