Showing posts with label media center. Show all posts
Showing posts with label media center. Show all posts

Tuesday, August 21, 2012

Upgrading MythTV to Mythbuntu 12.04 64-bit

As described in the previous post, the time had come to upgrade my MythTV installation. It had been installed using Mythbuntu 10.10, 32-bit. I wanted to move to the most recent version, currently Mythbuntu 12.04. There were two options available to me: upgrading the current installation, or a new install of the latest version, and copying the previous MythTV database over to it. The first option was not too appealing. Doing a distribution upgrade is a fingers-crossed, hope-this-works process a good part of the time - although I have had pretty good fortune with it on my desktop PC. If I were to go this route, I couldn't just upgrade from 10.10 -> 12.04. It would have to be 10.10 -> 11.04 -> 11.10 -> 12.04. Three complete system upgrades in succession, which would likely leave a lot of cruft left over in the installation. Lots of points of failure. The final nail in the coffin was that I wanted to move to a 64-bit installation, to take advantage of the full 4GB of memory that was installed in the system.

So a clean install it was. To prepare, I copied a number of setup files to a safe place that wouldn't be overwritten during the install. Files like:


  • mdadm.conf, from /etc/mdadm, which had the RAID configuration information. 
  • xorg.conf, from /etc/X11, which had the custom modeline used to output to my (now ancient) CRT TV. 
  • ssmtp.conf, from /etc/ssmtp, for email notification in the case of errors.
  • apcupsd.conf, from /etc/apcupsd, the setup of the APC UPS monitoring software.
  • hardware.conf, from /etc/lirc, used by LIRC to set up the Media Centre remote control.
  • the MythTV database password, from /etc/mythtv/config.xml


Not all the files would end up being needed, but I felt safer having them handy, just in case.

The installation process started from a USB stick loaded with the Mythbuntu 12.04 installer, since I don't have an optical drive in it. No room, with three drives already there. I also hooked up a monitor instead of a TV, because that needs extra setup to output to a component connection.

Since there was some left over free space on the SSD, I installed to that, leaving the 10.10 install intact for now. It went remarkably smoothly. One thing I noted was that at the beginning, there is an option to update the installer. I clicked that, and the system seemed to do nothing for quite a while. Opening up a terminal window and running "top" showed that it was in fact doing something, so I waited until it finished. Once done, the installation process could begin. It would have been nice for it to have some sort of indication that it was doing something, though.

Partway through the process, it prompted for what sort of remote control is being used. I selected "Windows Media Center remote", and the thing was set up automatically. Brilliant! Didn't need that LIRC setup file listed above.

To get the system outputting to my TV properly, I just copied the old xorg.conf file to the /etc/X11 directory (I renamed the existing file, in case I needed it again) and rebooted with a sense of hope and anxiety. A minute or so later, the screen came to life! It worked!

The big one, that I was dreading, was getting the RAID array to be seen by the new install. I still consider myself quite the mdadm novice, so I was pleasantly surprised to find that the RAID array was picked up by the new install quite easily - after installing mdadm and lvm2. This command:

sudo mdadm --assemble --scan

was all that was needed for it to scan for any drives, re-assemble the array, and write a new mdadm.conf file. Easy!

Next was seeing if LVM could find the volumes created. Running

sudo lvm pvscan
sudo lvm vgscan
sudo lvm lvscan

detected all the physical volumes, volume groups, and logical volumes, respectively. Mounting the logical volume that held the recordings was successful - I could see them all. Adding the device entry to /etc/fstab seemed to work, eventually. On the first reboot it came up with an error message, mentioning there were serious problems with the mount. Not sure what it was, but a reboot afterwards seemed to make it happy. I had installed xfsprogs, to manage and defragment XFS filesystems; maybe that helped.

Going through some of the MythTV screens brought up some error messages that it couldn't write to the drive - it turned out to be a permissions issue for the files and directories on the array. Entering

sudo chown -R mythtv:mythtv /var/lib/mythtv

changed the ownership back to the mythtv user, and it seemed happy again.

Bringing the previous database over was a painless process as well. I followed the instructions here and here and the new database came over without drama.

So far it all looks good. I may have a tweak of the VDPAU settings to see if playback can be improved any - it looks fine, but the settings have just been carried over from the previous 0.23 version. Things may have changed in the current 0.25 release.

Now that the system is updated to 12.04, which is a Long Term Support (LTS) release of Ubuntu, I won't be caught out with an obsolete version after 18 months like I was with 10.10.

As a side note, one of the main reasons for moving to 64-bit was because the Zotac IONITX-A-U motherboard, with an Atom 330, was only showing 3GB of RAM installed, even though I had two, 2GB sticks in there. I thought this was a 32 bit software issue. After installing the 64-bit OS, the free memory remained the same. Even in the BIOS, it only reported 3072MB. Strange. A bit of searching around revealed this thread on Zotac's supprt forums. As it turns out, if 4GB is installed, 512MB is reserved for system use, and then there is the amount used by the onboard Nvidia ION graphics - which I had set to the maximum allowed 512MB. So only 3GB visible. It's OK, it still runs fine, but it would have been nice to be able to use a little extra.

Tuesday, January 11, 2011

A MythTV box for the lounge room: Part 3: The build

In part 2 of this series, I went over the decision process for choosing the hardware used in the MythTV box. To sum up, I went with a Zotac IONITX-A, due to the low-power Intel Atom/Nvidia ION CPU/graphics combination, inbuilt wireless, and an included laptop-style power supply. I could also use some of the DDR2 RAM sticks that I already had.

Other items bought for the box included two more ASUS U3100 mini USB TV tuners. These supplemented the one I already had (sadly I couldn't use the PCI tuner card I had in my main PC, due to the board not having any PCI slots). I picked up a 2 terabyte Samsung ecogreen hard drive as the system and storage disk. These have had good reports of being low noise, low power consumption items.

The remote control chosen was a Hauppauge unit, as described in an earlier post.

The choice of case was driven by stock availability more than anything - initially I had chosen a Mini-ITX case from Aywun (known as Apex in some countries) but none would be arriving in stock until mid January - so I still would have been waiting. Since I wanted this to be completed as a Christmas holiday project, I looked elsewhere and found the Lian Li PC-Q07 - a rather minimal-looking aluminium case. It was a tad larger than the spot I had originally planned to put the box, but I was able to do some re-arranging inside the cabinet (like removing the video recorder - won't be needing that relic any more!) and it fits nicely.

Observations from assembly
One thing noticed when putting the various parts together is that the TV tuners would not fit together when pugged into adjacent USB slots at the back of the motherboard. Their chunky plastic bodies meant you could not plug much into a neighbouring slot. This was solved by picking up some USB extension cables and hanging the tuners off those. Using the cables also meant that I could run the tuners out the back of the cabinet into free air, rather than let them warm up the inside of the cabinet. They do get surprisingly warm during use.

To connect them to the aerial, I purchased a three-way digital TV splitter. I was concerned about losing too much signal with three plugged in, but in use the strength has been around 66-70%, enough to give trouble-free viewing.

The PC-Q07 case has nowhere inside it to allow for additional fan mounting, but it was designed to take full-sized PC components, like normal ATX power supplies, full-sized DVD drives and the like. Since there was no need for a PSU to be put in it (the motherboard I chose had its own laptop-style power brick that could sit out behind the cabinet), I rigged up a 92 mm fan in the gap where a power supply would normally go. It is set up so it is drawing in air from behind the case, supplying a stream of fresh air to the other, smaller fan on the CPU/GPU, as well as the hard drive. I just used one of the power supply mounting holes  - it seems to be holding in place just fine. To stop air short-circuiting too much straight out the back, I cut up a small piece of cardboard and used that to blank off the remainder of the gap in the power supply hole.

To get a better supply of air to the box, I borrowed a holesaw, attached it to my drill, and cut a couple of extra air holes in the back of the TV cabinet. This also provided some extra paths to lead cables from.

The infrared sensor from the remote was on a fairly long cable, so I was able to lead that out the back of the cabinet to a spot that is higher up, easier for the remote to reach.

Finally, I've left the wireless receiver for the keyboard and mouse plugged into the back for convenience - I can just bring them down from the other room if some typing or clicking is needed.

Findings from the first weeks of use
First of all, and the biggest relief, is that the Wife Acceptance Factor (WAF) is very high - she loves it. We both love having the power to watch what we want, when we want, being able to skip the ads if we've recorded a show earlier. Playback is flawless - any glitches we have aren't any worse than what we previously encountered with our HD set top box. It can handle 1080i playback perfectly smoothly. The only stutters are related to the hard drive when it is working particularly hard, like the other night when we found ourselves in the situation of recording four shows simultaneously (two were on different sub-channels on the same network, so one tuner could record them both) while watching a recording of a previous program. You could see the hard drive light blinking away pretty furiously. Oh yes, it would have also been flagging commercials at the same time. All these things can be tweaked and tuned, I've set it to only run one job at a time to give the little atom CPU some breathing room. Commercial flagging has been set to begin as soon as recording starts - I changed that from the default of waiting until a show has finished recording. So far, it hasn't slowed things down noticeably.

For the playback settings in MythTV, I have chosen the VDPAU Normal profile. I haven't tried the High Quality setting yet, the GPU may struggle with that, and Normal looks just fine to me.

Mythbuntu:
I decided to used the MythTV-oriented version of Ubuntu for this project, Mythbuntu. This runs the XFCE desktop, using less resources than Gnome would. Setup was quite simple, and I was pleased to find that Mythweb was installed by default - something I had never bothered with before on my previous desktop PC Myth install.

I would recommend this to anyone else considering a dedicated HTPC build. It is quite stripped back, however, so it is not much use for other purposes (although there is a facility to enable it to be reconfigured as a regular desktop through the Mythbuntu control panel).

CPU Use:
One CPU-hungry process I have noted is upconverting the audio stream to 5.1 Dolby Digital. Remotely logging in and checking CPU use during playback shows that with regular stereo passthrough to the optical output, usage is around 12-14%. With upconversion enabled at best quality, CPU use shoots up to around 63%.

Memory:
Memory-wise, I have followed recommendations posted elsewhere on the web and run two sticks of RAM, enabling dual-channel operation. This provides better bandwidth for the GPU in particular, improving playback performance.

I have two, one-gigabyte sticks of DDR2-800 ram installed, with the graphics set in BIOS to use the maximum 512MB. This has been quite sufficient, and I dare say that 1 GB would be enough if it weren't for the onboard graphics using some of the memory.

Power consumption:
I have a power meter (discussed in an earlier post on my other blog) connected to the wall outlet, measuring the power use of the PC, as well as the VGA-component transcoder. When idle, the unit consumes 44 Watts. Watching live TV, it uses 47 Watts. When 5.1 upconversion was enabled, it used 49 Watts, reflecting the extra CPU usage.

These figures are quite a bit higher than what I've seen elsewhere on the web - I saw a picture of a system playing a blu-ray disc using 30W. And this machine doesn't have an optical drive installed. All I can think of is the extra power draw of the TV tuners, the fan, and the fact that linux may not make the best use of power saving features of the CPU compared with windows 7. The other factor could be the power meter being out, something I'm finding quite likely. It does give pretty high voltage readings, which would as a result give an inflated Watt reading.

Final thoughts:
I'm glad the system build went off without a hitch. Performance is fine, although had I gone with a core i3 system it could have handled many more concurrent jobs like commercial flagging without breaking a sweat. Power use would have been higher, too, as too the cost.

The wireless signal is not the best, with the antenna located at the back of the motherboard hidden away at the back of the TV unit. I may try an external antenna, to let it get a better signal than the 40-ish percent it now gets. It makes copying movie files pretty slow, the way it is at the moment.

I'm wondering whether to put in a solid-state hard drive to have the operating system partition located on, to free up the workload of the storage drive. There is sometimes a delay of a few seconds when starting playback of a show. This isn't a major priority - it will probably inherit the Intel X25-V from my main system whenever I upgrade that.

Tuesday, December 28, 2010

A MythTV box for the lounge room - Part 1: getting the display to work

The first hurdle:

After a number of years trying to get a picture on my extremely fussy lounge room TV from the computer, I finally bit the bullet and ordered a VGA to component transcoder - an Audio Authority 9A60A. This is because I am still using a Panasonic TX-76PW200A CRT TV, with only component inputs. Also, since it is not in the USA, the refresh rate is 50Hz,rather than the 60Hz that the nvidia drivers support out of the box. I mentioned in an earlier post that I was going to have a task getting a working resolution to the TV, but eventually something was found. Initially I used the program Powerstrip, with my desktop system set up in the lounge. A couple of settings worked, but with pretty bad overscan. Every time I tried tweaking it a little, the display just went out of range and I was greeted with a blank screen. Disheartened, I packed up the PC and contemplated putting the transcoder on ebay.

After a couple of days' break, i thought about trying again, this time with my laptop that runs linux and has a Mobility radeon graphics chipset. Using the xrandr command, I was able to feed it a modeline that I had found on another forum. An owner of the same TV I had, had managed to get a good picture up after a bit of experimenting. Lo and behold, I was able to get a picture up!

From memory, the xrandr commands used for the laptop were:

xrandr --newmode "1920x1080i_50" 78.300 1920 2464 2520 2784 1080 1102 1117 1125 interlace +hsync +vsync

That created a new mode for the display to use.

xrandr --addmode VGA-0 1920x1080i_50

This assigns the mode to the display device - in this case, it was to the VGA external output for the monitor.

xrandr --output VGA-0 --mode 1920x1080i_50

And that final command sent the 1920x1080 resolution to the VGA output - where the ubuntu desktop came up on the TV, much to my relief!

Knowing that the TV was capable of accepting the resolution, and that the transcoder was able to output the correct timings to the TV, it was back to the main box to see how the output worked from an Nvidia card.

The Nvidia binary driver unfortunately does not accept the xrandr commands I had used with the radeon drivers on the laptop, so another method was going to have to be used. After some inital lack of success with manually editing the xorg.conf file, I had a go using nvidia's utility designed for adding things to the file, nvidia-xconfig. Using the command:

sudo nvidia-xconfig --mode=1920x1080i_50

added a mode to the xorg.conf file. I opened that file up in a text editor and had a look where it turned up. When I found it, I added the following line straght below it:

Modeline "1920x1080i_50" 78.300 1920 2464 2520 2784 1080 1102 1117 1125 interlace +hsync +vsync

I restarted the machine to let nvidia-settings find the modeline. From there, it was then selectable from the resolution dropdown box, where I could choose it. It worked again!

The final step was getting it to work when the TV was the only display hooked up. To summarise, the xorg.conf file needed to be edited to remove all references to the PC monitor I had connected as well, so the TV was the only device it detected. Have a look at the xorg.conf file here, for your reference.

One other thing I had to do was set the PC to log in automatically - since this is to be a Home Theatre PC, there will not be a keyboard connected to allow typing in a password. It's not what I was after anyway. This option can be found under System -> Administration -> Login Screen

In a later entry I'll go over the setup of the actual system, and what I've learned in its first week of use.

Sunday, November 28, 2010

Getting a media centre remote working with LIRC, in Ubuntu 10.10

Recently I bought a new remote control for my PC, to replace the one that came with my TV tuner card. I picked up a Hauppauge Media Center Remote Control Kit, model 335, which has more logically labelled buttons than what I had. It looks a bit nicer, too, an important consideration as I am attempting to finally build a Home Theatre PC to go in the lounge room.

While the previous Technisat remote worked fine in Ubuntu 10.10, I read of some other people having problems with getting remotes to work - namely the Media Centre-compatible versions. When I plugged in my new one, I also noticed the problem.

A bit of trawling around on the internet uncovered a thread at the ever-reliable Ubuntu forums. It turns out that the newer kernel includes a module for the media centre remote (mceusb), that clashes with the lirc_mceusb module you want to use, with LIRC. When the two modules are loaded, neither works.

What has to be done, is make sure only one of them gets loaded. The user uniden9 posted an excellent how-to in that thread linked above, describing two methods that are available - disabling the old lirc one, or disabling the newer, kernel built-in module. Based on other responses in the thread, most people had more luck with the second method - disabling the newer one. I guess the MythTV key bindings etc. would work better with the old version.

I have included the relevant quote from uniden9's post here, in case there is a problem accessing the forums:

2. Blacklist the kernel source drivers and use the old dkms built drivers.
-Well you already have lirc-sources-modules install and probably had this working on 10.04 or older version of ubuntu.
A. Edit /etc/modprobe.d/blacklist.conf , create it if it doesn't exist.
Add>
blacklist mceusb
line to the file and save it.
B. Update initramfs, #sudo update-initramfs -u -k all
C. reboot
D. Reconfigure lirc if its not already working.
#sudo dpkg-reconfigure lirc
On the Remote, Select "Windows Media Center Transceiver/Remote (All)
E. Thats it.
This is the method I chose after wrestling with button repeats on option 1. I use XBMC and could not figure out how to disable Ubuntu treating the remote as a keyboard device.

I used this method as well, and now have the media centre remote working just fine on my system. I'm now just waiting on the arrival of a VGA to Component Transcoder, that will hopefully allow my PC to connect with my older-style TV that has only component inputs. As an aside, although I have a graphics card that has a component-out attachment, it only puts out a 1080i, 60Hz signal. My TV, being made for the Australian, PAL-based market, requires a 1080i, 50Hz input signal. Fingers are crossed that the transcoder will allow it to work - I'll be posting an update when it arrives and I can try it out.