Tuesday, January 18, 2011

Streaming SopCast from Linux Box to Playstation 3 or any other DLNA/UPnP-Client

SopCast is quite a popular P2P video streaming client.It is very similar to TVU, PPLive, PPStream and others. One good thing about SopCast is, that a fully supported client for Linux exists, that is somewhat stable and performs well.Since you generally stream TV-Programs with SopCast it is desireable to watch them an an actual TV-Set as opposed to a monitor or a laptop screen. Of course the easiest way to watch the streams on TV would be to hook up your computer or laptop to your TV using HDMI or DVI-Ports but the procedure of connecting and disconnecting your computer to your TV is really uncomfortable. However, many of us either have a DLNA-Client of some kind either integrated into a TV (most newer Samsung, Panasonic and Philips have) or hooked up to the TV in form of a streaming box (WD TV Live HD, AC Ryan Playon) or a gaming console, like the Sony PlayStation 3. So in many cases it is safe to assume that your multimedia equipment and your computers can communicate with each other via LAN or WIFI. Since you can't run a SopCast client directly on your DLNA-Clients you need to run it on a computer and stream the content using DLNA-Protocol to your DLNA-Clients. Now, there are plenty of ways to accomplish this using a Linux box and free software, here's the way i found to be the most convenient for me:

- A Linux box (maybe it works with windows the same way)
- SopCast for Linux
- The Playstation Media Server (PMS), for which you will need to have Java installed

When you start to receive a video stream with SopCast, the program will serve the video on a local socket, just as if you would have installed a small web server. We will then use PMS to serve that video stream to your PS3 (or any other DLNA-Client) as video content. You will then be able to scroll through you media list on your PS3 and select the SopCast stream just like any other video content.

1) Download and unpack SopCast for Linux and Playstation Media Server (PMS).

1a) If you haven't got java installed do this now, as you'll need it for PMS. For Debian you can do it like this:

sudo apt-get install sun-java6-jdk

1b) If you are running a 64-Bit environment you'll need to install some 32-Bit libraries for the SopCast client: libpthread.so, libstdc++.so, libm.so and libgcc_s.so. In Debian you need to install these packages:

sudo apt-get install ia32-libs libc6-i386 lib32gcc1

2) In the directory where you extracted PMS edit the file WEB.conf.Add the following line anywhere in the internet TV section:


3) Start the SopCast client from the directory where you extracted the SopCast archive like this:

./sp-sc-auth XXX 3908 8908 > /dev/null &

In this case XXX stands for the sopcast-URL of the stream you want to watch.

4) Start PMS by running the shell script PMS.sh from the PMS directory.

4a) If you are on a 64-Bit environment and run into problems with PMS you should install the 32-Bit java runtime and change the PMS.sh shell script. In Debian you can install the 32-Bit java runtime this way:

sudo apt-get install ia32-sun-java6-bin

Then replace line 39 of PMS.sh with this:

JAVA=`dpkg -L ia32-sun-java6-bin|grep jre/bin/java

5) On your Playstation or any other DLNA-Client, the PMS should be recognized. Browse to Web->TVs on your PMS and there you should see the SopCast entry.

I have tested this with a Playstation 3, but it should just as well work with any other DLNA-Client. In case it doesn't... just leave a comment :)


Alex Baiatu said...

This sounds good!

Do you have an idea how to do it on windows?



Unknown said...

Thanks for this!

I'm now viewing a Sopcast feed via PS3 Media Server and my Hisense MP800 (Realtek based player).

Just in case anyone else who follows this guide has the same issue I did - I was getting a couple of seconds of video before the stream froze (however this was an improvement over my lengthy attempts with Mediatomb - hadn't managed to get any Sopcast picture at all...)

Turned out my player was wrongly detected as a Popcorn Hour but all I had to do was move "PopcornHour.conf" out of the renderers subfolder, and next time I connected it used Realtek.conf.

Don't know what relevant settings this actually affects, but the picture stayed on this time and was rock steady.

Thanks again

Unknown said...

Hi Alex,

theoretically it should work pretty much the same way on Windows. As far as i know the Sopcast opens up a port on localhost. However, i don't know which port that is. But you can find out the port using the command "netstat -l"