2010 02 in the Stream Discovering and Streaming Multimedia Files with Coherence and Upnp


Discovering and streaming multimedia files with Coherence and UPnP
In the Stream
Although many folks know UPnP as the pesky feature they disabled on their WiFi router, the AV options of
UPnP let users set up and auto-discover media servers.
By Ben Martin
imagerymajestic, 123Rf
The UPnP AV specification [1] defines an environment for streaming photos, audio, and video files from a
file server to a variety of client devices. Some AV servers also allow the client to query the server for media
files. MythTV, for instance, lets you find all the programs that ran on a given date or every episode of a series
you previously recorded.
Of course, you might be thinking that streaming and downloading are common tasks that do not require a
special new specification. The benefit of using a UPnP server instead of just viewing video files with
conventional tools is that you can use your PS3 or set top box to consume these video files from the web and
make them available locally. The lines between video content on the web and locally stored video content
begin to blur. Once your UPnP environment is up and running, you can browse and view files from a PS3 or
mobile phone as well as a client computer.
A UPnP configuration consists of three parts:
" the MediaServer, which hosts the files and allows clients wishing to view those files to stream them
over the network.
" the MediaRenderer, a client that displays media
" the Controller
Normally the renderer and controller are rolled into one piece of software; for example, the VLC media player
can take keyboard controls and also render video content.
You might already be using UPnP AV-enabled software without realizing it. MythTV can expose itself as an
AV MediaServer; VLC and XBMC can act in the Controller and Renderer roles. If you want to experiment
with your own UPnP server, the open source Coherence MediaServer [2] is an easy alternative. This article
shows how to get started with setting up your own Coherence UPnP environment.
In the Stream 1
Getting Coherent
Coherence is packaged for Fedora 11 as python-Coherence. Using yum to install it will bring in a bunch of
other Python packages and might cost 10MB of disk space, depending on what else you already have
installed. At the time of this writing, the packaged version of Coherence for Fedora 11 is 0.6.2. Coherence is
also packaged for Ubuntu Jaunty as python-coherence and for openSUSE as Coherence.
Unfortunately, the Coherence package for Fedora 11 does not include either a default configuration or service
init files to start a general server instance on the machine. There is a coherence.conf.example configuration
file in /usr/share/doc/python-Coherence-0.6.2. Using the example configuration file, and creating a new Linux
user for added security, you can get a UPnP AV server up and running fairly quickly with Coherence.
To begin, you might like to add a new user and group to your server machine to run the UPnP server. If you
are not running a centralized user server, it is convenient to find a user and group ID that is not already in use
on your local Linux machines and add the new upnp group and upnpuser user to all of your Linux machines at
once with the same numeric identifiers.
Because the 10009 numbers were not in use on my network, I used them with the commands below. Locking
the upnpuser account will stop anyone from trying to log in to that account, which is fine - you can still start
the UPnP server without needing to log in.
# groupadd -g 10009 upnp
# useradd -g 10009 -u 10009 upnpuser
# usermod --lock upnpuser
The commands in Listing 1 first change to the upnpuser account and then copy the example configuration file
to ~/.coherence, where the Coherence server expects to find the configuration file. All you have to do is set up
an FSStore (FileSystem Store), telling it what name you would like clients to see it as and where your media
files are located.
Coherence looks in your home directory by default, so a path to the Video directory will result in exposing
/home/upnpuser/Video. Copy some test content to ~/Video and start Coherence (Listing 1). If all goes well,
your UPnP AV server should be up and running.
Listing 1: Starting Coherence
01 # su -l upnpuser
02 $ mkdir ~/Video
03 $ cp /usr/share/doc/python-Coherence-0.6.2/coherence.conf.example ~/.coherence
04 $ edit ~/.coherence
05 ...
06 web-ui = yes
07 ...
08 [plugins]
09 ...
10 [[FSStore]]
11 name = "Local video files"
12 content = Video
13 $ cp /.../my-test-media.avi ~/Video
14 $ coherence
Now start up the VLC media player on a machine on your network and select View/Playlist from the menu. If
you do not see Universal Plug'n'Play as an option in the Playlist window, select Media/Services
Discovery/Universal Plug'n'Play discovery from the main VLC menu.
In the Playlist window, you should see Local video files under the Universal Plug'n'Play group (as shown in
Figure 1). Opening Local video in the treelist on the right side of the window will show you all of the media
files you copied into ~/Video on the UpnP server. As you can see in Figure 1, a bug in VLC 1.0.1 causes video
files to appear twice.
In the Stream 2
Figure 1: Viewing video file information in the VLC Playlist window.
You can export more than one directory by separating the directory names with commas in the content setting
for your FSStore.
For VLC version 1.0.1, you can enable UPnP in the playlist by selecting Tools/Preferences and Show
Settings/All from the bottom left of the preferences dialog. You should then see a playlist entry in the list on
the left, which contains a Services Discovery subentry where you can enable UPnP by default.
If you do not see your UPnP server from your client, you might need to add a multicast route on the server
machine. For example, the command line below will add a route, sending packets to eth0. Some UPnP
programs will fall back to using broadcast network traffic if they do not find anything with multicast
capability.
route add -net 239.0.0.0 netmask 255.0.0.0 eth0
The Web Interface
Notice that I enabled the web interface with the web-ui=yes setting in the preceding configuration.
Screenshots of the web interface are shown in Figures 2, 3 and 4. As you can see, there isn't much eye candy.
The web interface includes many XML files that are best consumed by a computer rather than a human.
However, you can drill down into the content link for a share and get links to media files that let you stream
over HTTP to a web client or some other application.
Figure 2: Top level of the web interface.
Figure 3: Viewing the local video files directory in the web interface.
In the Stream 3
Figure 4: Following the content link of the video files directory.
For example, you could use MPlayer (or any other client) that might not even have UpnP support but can grab
content from a web server. Having a direct HTTP link to the content also comes in handy when you want to
transfer a few media files to your laptop to view on the road.
Video from the Internet
Coherence has support for obtaining video data from the BBC, Movie trailers from Apple, video from Ted
Talks, and images from various photo sharing sites. At the time I tested the system, Apple did not work
through Coherence. The Ted Talks worked perfectly. Content from the BBC is mostly through MP3 audio
files, and some of those files are not available to users "outside of the UK." Adding these video and audio
sources to your Coherence server is as simple as adding the plugin to your configuration and telling
Coherence how often (in hours) to obtain updates from those services (Listing 2).
Listing 2: Adding Audio and Video Sources
01 [plugins]
02 ...
03 [[BBCStore]]
04 name = BBC
05 refresh = 1
06
07 [[AppleTrailersStore]]
08 name = Apple Trailers
09 refresh = 4
10
11 [[TEDStore]]
12 name = TEDtalks
13 refresh = 2
UPnP Ready Clients
Both Totem and Rhythmbox can consume content from UPnP servers. Install the totem-upnp and
rhythmbox-upnp packages, respectively. Totem (Figure 5) presents the content in a deeper tree view than
Rhythmbox (Figure 6), which might help you find the broadcast you are after, but Totem can't seek in large
video files. (I tested Totem version 2.26.3 using GStreamer 0.10.24 - later versions might improve this
situation.) As Rhythmbox is primarily an audio player, it doesn't show or play most video files from a UPnP
server. VLC allows seeking in video media from UPnP servers, but you have to wait for the content up to the
point you have seeked to be copied over the network. And even when running on gigabit networks, seeking in
a 10GB file by copying the intermediate content can make for an interesting test of patience. The Media
Streamer client for Maemo works reasonably well but has rather limited codec support. I had trouble playing
the BBC through Media Streamer, but Ted Talks came through just fine.
In the Stream 4
Figure 5: Listening to the BBC through Totem.
Figure 6: Listening to the BBC through Rhythmbox.
Final Words
Some common video and audio players already support UPnP. Remember, too, that UPnP AV has explicit
support for the separation of the controller from the content playback, so you should be able to run a controller
on a touch screen device like a maemo tablet to tell a video player such as VLC to start, stop, or skip the
current file.
INFO
[1] Universal Plug and Play: http://en.wikipedia.org/wiki/Universal_Plug_and_Play
[2] Coherence: http://coherence.beebits.net/
THE AUTHOR
Ben Martin has worked on filesystems for more than 10 years. He offers consulting services focused on
libferris, filesystems, and search solutions.
In the Stream 5


Wyszukiwarka

Podobne podstrony:
Bee Gees Islands in the stream
Impacting sudden cardiac arrest in the home A safety and effectiveness home AED
Growing Up in the Universe Designed and Designoid Objects cz 2
Nugent 5ed 2002 The Government and Politics in the EU part 1
Phoenicia and Cyprus in the firstmillenium B C Two distinct cultures in search of their distinc arch
Knutsen, Witchcraft and Magic in the Nordic
Images and Impressions Experiences in a Tomb in the Kilmartin Valley
No Man s land Gender bias and social constructivism in the diagnosis of borderline personality disor
2012 vol 07 Geopolitics and energy security in the Caspian region
Turn Young An exploration in to the mind, sex and health
Mettern S P Rome and the Enemy Imperial Strategy in the Principate
20 Seasonal differentation of maximum and minimum air temperature in Cracow and Prague in the period

więcej podobnych podstron