Sunday, December 24, 2006

MythTV

I've just been trying to set up a MythTV system, I've had the hardware for this for a while but until my TV broke I hadn't found the time to work on it.

My planned hardware was a P3 system for both frontend and backend. However the Debian MythTV packages take over 250M of memory for each of the frontend and backend programs (more than 500M for Myth programs alone), combine that with some memory use for MySQL, for the X server, and for the rest of a functional Linux system and a machine with 512M of RAM does not perform well. Unfortunately it seems that most (if not all) desktop P3 systems only support 512M of RAM (at least none of my collection of P3 machines does). P3 server systems support considerably more RAM (I used to have a SMP P3 server with 1G of RAM), but a server class machine is not what you want in your lounge room. P4 systems support more RAM but also take more than twice the electricity of P3 systems. The extra electricity use is a waste for a machine that will probably run 24*7, and also requires extra cooling (and therefore probably louder fans which is bad for a machine used for playing audio). Given that I desire the capabilities of a P4 in terms of RAM support and electricity use that is not excessive, my options are one of the recent Intel Core CPUs or AMD64 (both of which apparently use less electricity - not sure whether they would use as little as a P3) or a CPU designed for low power use (maybe a Via). Either option costs more than I prefer to spend (I want to use a second-hand machine valued at $129).

Of course if I could get Myth to use less memory then that would allow me to run both parts of MythTV on the one machine. Please offer any advice you can think of in regard to minimising memory use for Myth on Debian.

Given that I am unlikely to be able to optimise memory use as much as I desire it seems that I will have to go to a split model and try using an existing Pentium-D server machine as the backend and the P3 as a frontend. The up-side of this is that I can turn off the frontend machine when it's not being used (the server runs 24*7 anyway). I will need to get more RAM for the Pentium-D machine, but I had wanted to do that anyway.

The next thing I will have to do is to write SE Linux policy for MythTV and find out why /usr/lib/libmp3lame.so.0.0.0 needs both execmod and execstack (and either fix the library or write policy to permit that accss). I'm happy to have a MythTV server program running on a stand-alone machine with unrestricted access to all resources, but when it's going to run on a machine that is more important to me I need to lock it down.

Now to the design of MythTV. It's unfortunate that they don't support better multitasking options. One feature I would like to see is the ability to play MP3s in the background and then have the music pause whenever TV is selected. When I watch a live show (such as the news) I would like to listen to MP3s before it starts and then at the end of the show (and maybe during commercial breaks) have the MP3 playing resume where it left off. This is exactly the traditional lounge-room functionality we are all used to, when a commercial starts you mute the TV and un-pause the CD player! The advantage of MythTV is that you could do both with a single button - or even automatically with advert recognition!

The method of selecting MP3 files to play is also a little cumbersome and the option to add a song after the current one in the play list doesn't seem to work. Also it's a pity that there is no convenient option to sort the music list by artist, genre, or sone name - there are grouping options but they are all separate and I would like to change the sorting via a single key press.

The startup sequence of MythTV regenerates some images (which takes a few seconds), it seems that this is something that could be cached for a faster startup. Also when I add new MP3 files to the store I have to manually request a re-scan. It's a pity that it can't just check the size and time-stamp of the directories which contain MP3 files and do an automatic re-scan if they change.

6 comments:

Anonymous said...

A few points, since I'm running a 3 tuner backend right now on a 256meg p2-400 due to some hardware death:

a) most of that myth ram is virtual - it maps heaps of crap for no good reason. I used to run my frontend on a 128meg k7 (@650mhz), and honestly, it had no problems in actual usage.

b) That said, you probably want some grunt _somewhere_ for transcode/commercial skip. but that's another issue entirely... it doesn't have to be your 'at the tv' box.

c) Also, a p4 is more likely to have reasonable ACPI power managment support - meaning that you can throttle the thing down to lower power usage when it's sitting idle, which if you're not recording a lot is much of the time.

Anonymous said...

I had mythtv 0.18 running on a Celeron with only 384MB of RAM (ivtv card though, so hardware mpeg2 encoding), and it ran smoothly. mythtv 0.20 did not, still trying to tweak it a bit (it's broken atm after trying to start over from scratch). So stick with mythtv 0.18 and you should be fine.
Also, you can disable the innodb mysql backend, which is overkill for this setup, and saves you quite a bit of memory.

Anonymous said...

Consider MPD for your music playing needs. It's not part of MythTV but it will allow you to play music apart from the Myth frontend. It's not quite what you're looking for, but with a web UI for MPD it should work nicely.

Anonymous said...

Hi Russell,

This seems like a rather astounding amount of memort for this sort of application. I have used a Brooktree 'WinTV' card and mplayer and I don't think it requires anywhere near that. Both the 'WinTV' and of course mplayer are well supported on Linux. (I prefer Gentoo personally) I have an old HP Vectra my boss gave me that is almost identical (p3 - 500MHz) to your old box and its limited to 256m of ram. I don't watch TV much but this has got me currious. It definitely works well on an Opteron amd64 2200MHz with 2G of ram with FreeBSD v7. I have Linux-2.6.19 on the little box and are very happy with it. The latest kernel is quite a performer and should be up to this task. With mplayer you get a DVD player, VCR and the capability to play almost any format. I've never used the GUI as the cmdline interface is excellent.

BillSF

etbe said...

jaymz/julian, my tests of a P4 system with a default install of Fedora showed it as using more than twice as much energy as a P3. I will give it another go and show you my settings to see if you can advise on a better way of doing it, but my tests so far indicate that an idle P3 is better than an idle P4 for energy use.

Incidentally if some of my server consolidation work on Xen goes according to plan I'll have some machines that are better than a P2-400 with no use. In that case I would be happy to give you a machine (I'm surprised you didn't take up one of my previous offers of free hardware).

Thanks for the suggestion regarding MySQL, I'll try disabling innodb. Is there any easy way of converting the tables? MySQL isn't really my thing...

I have been considering other music players, I will eventually check MPD out. But an advantage of having MythTV do it all is that the machine can be used by guests with minimal learning required.

Thanks for the suggestions everyone, and merry Christmas!

Anonymous said...

- "better multitasking options"
- "music pause whenever TV is selected"
- "option to add a song after the current one"

Maybe you should try Freevo. It does all the above for me on a P3 with 320MB RAM.