Tuesday, 25 March 2008

Eureka!

I've finally found a workable solution for streaming live tv around the network. I knew of MediaPortal a good while ago, before I had Windows Mediacenter. It's basically an open source MCE clone for windows, written almost entirely in .NET.

When I looked at it previously it wasn't very stable. Certainly it did not compete with MCE for reliability or presentation. More recently however I've heard better things about it. In questions about streaming TV posted on various fora, the answers often have pointed at MediaPortal. I have not had a chance to check it out until now.

The key new feature is their TV Server engine. It runs as a service on your central server where the tuners are located. It provides the ability to stream any channel from any number of BDA compatibile tuners via the standard streaming protocol RTSP, to multiple clients on the network. Critically it also allows the client to change channels remotely. That's the feature which other solutions I've used have not had - and is what makes them all but useless for my requirements.

By default the client application is another instance of MediaPortal (MP), but searching around the MP website I saw that one of the developers had produced a small .NET application which provides the TV streaming without the rest of MP. Now don't get me wrong, MP is a much more polished solution these days and it does seem to be more reliable, however it is a bit overkill for what I want to do and will not run under Linux. Having a lightweight solution is more appropriate, at least to start with.

The client application basically looks after the connection and remote control of the server. It instructs the server to start broadcasting a specific channel to a client on the network. The application then starts the prevalent VLC player to receive the stream. This is great because it does only the bear minimum required. Change channel in the client application, and VLC is restarted pointing at the new stream.

Multiple clients can connect to the server and as long as there are free tuners available, they can tune into other channels simultaneously. On top of that, each stream seems to take only around 6% of the CPU on the server in comparison with other solutions I've seen where it can take more than 20%. That makes it quite scaleable for multiple tuners.

I've had a look at the code in the client application too, as it's written in C#. It's really not complicated, and relies on a small featureset of MP. I'm going to have a go at porting it to Mono under Linux as there would seem to be no reason why it wouldn't work. VLC already exists for Linux so that would allow me to use this solution over cheaper client workstations rather than having to install Windows on each of them.

No comments: