domenica 21 aprile 2013

Sopcast stream via Mediatomb

I'd like to watch a Sopcast stream on my TV, so I'm trying to figure out a way to do it. Internet is great, the solution is very easy. I will use Mediatomb to broadcast the stream to my TV. Mediatomb is running on Ubuntu 12.10 32 bit.

First of all, let's install Sopcast:

 sudo add-apt-repository ppa:ferramroberto/sopcast

 sudo apt-get update

 sudo apt-get install sopcast-player

Let's launch Sopcast from the dash home. If Sopcast returns an error like this:

 sopcast-player : Depends: sp-auth (>= 3.0.1) but it is not installable

We have to search for sp-auth_3.2.6.deb and install it.

Now we need to configure Sopcast to use a specified outgoing port for the stream. In this way, we'll define a static URL to redirect Mediatomb to. Select Edit -> Preferences and check Static ports, select two different port for incoming and outbound port, for example 8901 and 8902 and press apply.

Now it's time to configure Mediatomb. Great solution here. Let's edit /etc/mediatomb/config.xml: we need to add this line

 <transcode mimetype="video/sopcast-x-ms-wmv" using="video-generic"/>

to the <mimetype-profile-mappings> section and this

<profile name="video-generic" enabled="yes" type="external">
         <agent command="/usr/local/bin/mediatomb-video-generic" arguments="%in %out"/>
         <buffer size="24000000" chunk-size="1024000" fill-size="120000"/>

to the transcoding profiles. Let's save the file.

As you can see, the profile above will use the script /usr/local/bin/mediatomb-video-generic to broadcast the stream. You can find the script here. Place it into /usr/local/bin and change its permissions with sudo chmod +x.

Let's have a closer look:


exec /usr/bin/ffmpeg -threads 4 -i "${INPUT}" -vcodec ${VIDEO_CODEC} -b ${VIDEO_BITRATE} \
-f ${FORMAT} - > "${OUTPUT}" 2>/dev/null

The script will use ffmpeg to transcode the stream in a well known format that a DLNA player can handle.

"Go to the mediatomb web ui, click on videos, click the plus sign to add new item, fill it out like this..."

External Link (URL) 
 Title: Sopcast 
 Protocol: http-get 
 Class: object.item.videoItem
 Description: Sopcast 
 Mimetype: video/sopcast-x-ms-wmv

Done! Restart Mediatomb with this command:

sudo service mediatomb restart

turn on your DLNA player and select the DLNA Server icon. Select the item Sopcast and enjoy the stream.

Best regards!