Archiv der Kategorie: Linux

Lirc IR Remote with MythTV

I use one of the newer Microsoft Media Center remotes for my system. For one it was dirt cheap, does what I need it to do and does it well. Also from what I have read it is well supported by Lirc. All this proved true.
The buton layout is fairly good, it has a comfortable shape and it’s got a power button that you can program to turn off your tv set.
The IR receiver has a long USB cable. Thus it can be place almost anywhere. Even though that will probably not even be necessary as this is one of the most powerful remotes I’ve seen. It works in bright sunlight and even if the receiver is directly behind you. Something I cannot say of my rather expensive Pioneer Plasma screen.
On top of that the remote comes with two IR blasters that allow you to control a couple set top boxes for cable or satellite tv. I have never used the blasting capabilities though.
Mythbuntu makes it extremely easy to select a remote an configures it for you. Contrary to my Gentoo installation the back button on the remote stopped working. I hacked the .lircrc file of my tv user to set that button accordingly.
For now it works nicely.

# LIRCRC Auto Generated by Mythbuntu Lirc Generator
# Author(s): Mario Limonciello, Nick Fox
# Created for use with Mythbuntu
begin
remote = mceusb
prog = mythtv
button = Seven
config = 7
repeat = 0
delay = 0
endbegin
remote = mceusb
prog = mythtv
button = Right
config = Right
repeat = 0
delay = 0
endbegin
remote = mceusb
prog = mythtv
button = Mute
config = |
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Skip
config = Z
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = One
config = 1
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Down
config = Down
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Zero
config = 0
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Replay
config = Q
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Home
config = M
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Pause
config = P
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Six
config = 6
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Two
config = 2
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = ChanDown
config = Down
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = ChanUp
config = Up
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Rewind
config = <
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Forward
config = >
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Play
config = P
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = VolDown
config = [
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Stop
config = Escape
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = Back
config = Escape
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = VolUp
config = ]
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Five
config = 5
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = More
config = I
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Four
config = 4
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = OK
config = Return
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Up
config = Up
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = RecTV
config = R
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Nine
config = 9
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Three
config = 3
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Enter
config = Enter
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Eight
config = 8
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Guide
config = S
repeat = 0
delay = 0
end

begin
remote = mceusb
prog = mythtv
button = Left
config = Left
repeat = 0
delay = 0
end

xorg NVidia DVI/HDMI and a Pioneer Plasma

Getting my Pioneer PDP436-XDE to display MythTV is easy and not so easy at the same time. First off, automatic xorg configuration does not work, but with the proprietary NVidia drivers there is a 720p option.

While the panel itself has a resolution of 1024×768 pixels and a 16:10 aspect ratio the electronics espects either a 1080p or 720p signal on the HDMI input.

So I have to get the X server to output a signal at 1280x720p. I tried using the integrated Intel 945 graphics but had no luck. If anyone has gotten his system to output 1280x720p with Intel graphics let me know in the comments or contact me here.

Mythbuntu has a very minimal xorg.conf file after installation relying heavily on automatic configuration of the X server and correct EDID information that needs to be provided by the display. Unfortunately automatic configuration did not work as expected so I had to slightly modify my xorg.conf file to work correctly with my plasma display.

# File generated by xorgconfig.
# XORG.CONF for 1280x720p on a Pioneer Plasma via DVI with NVidia graphics
# NVidia proprietary driver
Section „ServerLayout“
Identifier     „Simple Layout“
Screen         „Screen 1“ 0 0
InputDevice    „Mouse1“ „CorePointer“
InputDevice    „Keyboard1“ „CoreKeyboard“
EndSectionSection „Files“
FontPath        „/usr/share/fonts/misc/“
FontPath        „/usr/share/fonts/TTF/“
FontPath        „/usr/share/fonts/Type1/“
FontPath        „/usr/share/fonts/75dpi/“
FontPath        „/usr/share/fonts/100dpi/“
EndSectionSection „Module“
Load           „dbe“   # Double buffer extension
SubSection     „extmod“
Option         „omit xfree86-dga“   # don’t initialise the DGA extension
EndSubSection
Load           „type1“
Load           „freetype“
Load           „glx“
EndSectionSection „InputDevice“
Identifier     „Keyboard1“
Driver         „kbd“
Option         „AutoRepeat“ „500 30“
# Specify which keyboard LEDs can be user-controlled (eg, with xset(1))
Option         „XkbModel“ „pc104“
Option         „XkbLayout“ „us“
EndSection

Section „InputDevice“
Identifier     „Mouse1“
Driver         „mouse“
Option         „Protocol“ „Auto“
Option         „Device“ „/dev/input/mice“
Option         „ZAxisMapping“ „4 5“
# Mouse-speed setting for PS/2 mouse.
Option         „Emulate3Buttons“
EndSection

Section „Monitor“
Identifier     „Pioneer Plasma PDP436-XDE“
VendorName     „Pioneer“
ModelName      „PDP436-XDE“
HorizSync       25.0 – 50.0
VertRefresh     59.0 – 60.0
ModeLine       „1280x720p“ 74.5 1280 1336 1472 1664 720 721 724 746 -hsync +vsync
Option         „DPMS“
Option         „UseEdidDpi“ „FALSE“
Option         „DPI“ „100 x 100“
EndSection

Section „Device“

# simeli added
Option         „UseEvents“ „True“
Identifier     „NVidia GF7300“
Driver         „nvidia“
#simeli old xorg
Option  „TVStandard“ „HD720p“

EndSection

Section „Screen“
Identifier     „Screen 1“
Device         „NVidia GF7300“
Monitor        „Pioneer Plasma PDP436-XDE“
DefaultDepth    24
Option         „ConnectedMonitor“ „DFP“
Option         „TVStandard“ „HD720p“
SubSection     „Display“
Depth       24
Modes      „1280x720p“
EndSubSection
EndSection

Backup with BackupPC

A backup only makes sense if it is done automatically and easy to use. Otherwise one usually postpones it or forgets it at all or restores are nearly impossible. For Linux in particular, there are tons of free backup solutions. Some simple tools that are powerful yet not so simple to use on their own like tar or monsters like amanda that are terrible to set up. Often it is recommended to put a small shell script in a cron job and just use tar. This works reasonably well if you don’t need to restore anything quickly. BackupPC aims to fill the gap between selfmade scripts and enterprise class solutions like amanda. It backs up virtually all OSs across the net, offering transparent compression and a web interface to manage all backups.
To back up a full linux host one need’s to exclude a number of files and directories that are created automatically at boot time.
I have  put a list in

/etc/backuppc/pc/localhost.pl
$Conf{BackupFilesExclude} = {
‚*‘ => [
‚/proc‘,
‚/dev‘,
‚/tmp‘,
‚/mnt‘,
‚/media‘,
‚/sys‘,
‚/lost+found‘,
‚/var/lib/backuppc‘,
‚/var/lib/mythtv‘,
‚/var/tmp‘,
‚/var/cache‘,
‚/var/spool‘,
‚/var/run‘,
‚/var/lock‘,
‚/var/games‘,
‚/home‘
]
};

http://kirksblog.steffensenfamily.com/
http://wiki.nerdylorrin.net/wiki/Wiki.jsp?page=BackupPC
BackupPC is not very good with bare metal restores. It appears that if your host dies, you’ll have to reinstall a minimum linux, install backuppc and – here comes the tricky part – have your old backuppc config ready to pop in, so you can roll away. Then mount the partition holding the backups unde /var/lib/backuppc and fire up backuppc. afterwards you should be able to restore your machine.
As always, test this on your box before it dies.

Linux and Bluray

I bought myself a Playstation to watch Bluray movies. But every once in a while I thought it would be nice to be able to make backups and put them in the MythVideo library just like DVDs.

Due to AACS present on Bluray discs this was a bit complicated. However I found a solution that seems reasonable for me and works very well.

The following is needed:

  • Windows XP or Vista License
  • VMware server
  • Slysoft AnyDVD HD
  • a samba share on Linux with lots of free space

The procedure is simple: Install VMware Server on your Linux host and have it access the drive – in my case /dev/scd0 directly.

screenshot of vmware server

VMWare Server optical drive selection

Windows will see the inserted disc just like a regular Windows machine. By having Windows accessing the drive directly, AnyDVD can read all sectors as its supposed to. Set up AnyDVD to rip to a samba share you’ve set up previously. That way your virtual disk is not going wild.

After the actual ripping process you can use various programs to re-encode the rip to get it down to a more manageable size. I usually set my films to end up as a 720p 4.5GB h.264 video using ripbot264. RipBot is a small Delphi program that bundles all necessary tools – quite a few – with a nice GUI.

If you use very recent releases of mencoder, mplayer, gpac, mkvtoolnix and x264 you may also use Linux directly for the encoding process which may result in a performance increase compared to using a virtual machine such as vmware.

HyRax has posted a small bash script on his blog that will do the encoding for you. You’ll need to install the required packages first:

aptitude install mencoder mplayer gpac mkvtoolnix x264

The packages in your distro may not be recent enough in which case you may wanto to compile a cvs snapshot from source.

#! /bin/bash

# =====================================================================

# Blu-ray encoding script by HyRax February 2009 http://www.serenux.com

# =====================================================================

# Make sure the user has specified what to work on.

if [ -z „$1“ ]; then

echo „\nBlu-ray movie encoding script\n—————————–“

echo „Written by HyRax February 2009\nhttp://www.serenux.com“

echo „\nUsage: $0 <m2ts file without extension>“

echo „\nExample: If your movie file is called TheDarkKnight.m2ts then\nyour usage will be: $0 TheDarkKnight\n“

exit

fi

# The crf=21 option controls encoding quality, and indirectly the final

# filesize. The higher the value, the more compression and thus smaller

# file size. Reduce the value and file size will go up. A value of 21

# should produce a file of approximately 4GB in size for a typical movie.

# Encode the video using x264, ignore the audio for now.

mencoder $1.m2ts \

-ovc x264 -x264encopts crf=21:frameref=3:bframes=3:b_pyramid:direct_pred=auto:weight_b:partitions=all:8x8dct:me=umh:mixed_refs:trellis=1:nopsnr:nossim:subq=6:level_idc=41:threads=4 \

-nosound \

-of rawvideo \

-o $1.×264

# Dump the first original audio track (should be the English track) but

# don’t re-encode it. Ignore the video.

mplayer $1.m2ts -dumpaudio -dumpfile $1.ac3

# Copy the raw x264 encoded video into an MP4 container so we can set

# the correct framerate (generally 23.976 – adjust it if MPlayer or

# MEncoder report something different)

MP4Box -add $1.×264 $1.mp4 -fps 23.976

# Finally, merge everything into a single MKV file

mkvmerge -o $1.mkv $1.mp4 –track-name 0:Eng $1.ac3

# Remove the hash in front of the next command to have the script delete

# your working files when encoding is complete.

# rm $1.m2ts $1.×264 $1.ac3

# Tell the user we’re done.

echo „All done! Your final movie file is called $1.mkv – enjoy!“

Simply copy the script to the directory containing the main m2ts file and run it with

./encodevideo.sh maintitle

leaving out the m2ts extension from maintitle.m2ts when calling the script. Videos encoded using the VC-1 codec result in errors so far. Your mileage may vary.

Keep in mind that it may not be legal in your country to employ tools to get rid of copy protection on digital media.

MythTV installation

Installation with Mythbuntu is very straightforward. Boot from CD and the installation hums along. It will ask you a few questions along the way but you can reconfigure pretty much anything afterwards.

One of the nice things in Mythbuntu is that it lets you configure and install proprietary drivers for Nvidia cards and the like right from within the control center.

Networking has been a bit of a hassle though. Mythbuntu installs the Gnome network manager by default which does not honor the settings in /etc/network/interfaces. I had trouble configuring my system with one ethernet card that is configured via DHCP and the other statically. The workaround was to simply uninstall the Network Manager all together. From that point on the config file was in charge and I was a happy man.

auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 10.0.1.10 netmask 255.255.255.0 broadcast 10.0.1.255 network 10.0.1.0 auto eth1 iface eth1 inet dhcp

More information about the subject can be found on http://ubuntuforums.org/showthread.php?t=527365and https://help.ubuntu.com/community/NetworkManager.

Mythbuntu 9.04 is out now, but I have not taken the plunge to upgrade. This may happen in a couple months or so.

[EDIT] I have in the meantime taken time to upgrade to 10.04. Everything went pretty smooth. If you are planning on using mythvideo (I heavily do) then you might like to know about the possible pitfalls that come from using the newly introduced storage groups. In short, storage groups allow you to have your videos in separate directories and/or partitions. So you don’t necessarly need to mess with LVM and the like to get one large continuous block device. Another advantage of SG is that you don’t need to mount the video directory in the same location with nfs or samba on a remote frontend. It now essentially works like TV recordings.

However storage groups are still a work in progress and switching to storage groups will render iso files non playable. I have also experienced a few other glitches such as audio being extremly slow and/or files simply not playing. I tribute that to the internal player being reworked.