Using the XBox 360 as an HTPC with uShare

Using the XBox 360 as an HTPC with uShare

Introduction and Features

uShare is an UPnP (TM) A/V & DLNA Media Server. It implements the server component that provides UPnP media devices with information on available multimedia files. uShare uses the built-in http server of libupnp to stream the files to clients.[/i] Originally, uShare was developed for use with GeeXboX, a LiveCD version of Linux aiming at turning PCs into small Home Theatre systems. We'll save our thoughts on GeeXboX for another time, but we do want to look into uShare. We discovered uShare as an way of connecting Microsoft's XBox360 to a Linux PC. uShare is currently at its 1.0 release. With a version number of 1.0, it should say that the program works and is both stable and safe. Let's look at what exactly uShare can do for us: - XBox 360 support - PlayStation 3 support - DLNA Compliant - Provides us access to videos, audio, and images - Written in C, so it's fast! The one thing it can't do that we'd love to see in the future is acting as an UPnP Media Adaptor and thus. This means it can't transcode files into formats acceptable by clients, which is a pain! The XBox 360 will only accept a limited amount of formats, and most of them aren't the best quality or best compression.

Installing uShare

At the time of this writing, uShare is not currently in Gentoo or Ubuntu's package repositiories. I imagine beacuse it's intended for the GeeXboX distribution and most people don't use UPnP devices for multimedia. Who knows, maybe BIOS_LEVEL will start managing packages for it? In the mean time, you can get the source code, rpm, or .deb from the homepage. Since we're using Gentoo in this review, we opted to download the source. The only dependencies of uShare are GCC 2.95 or later, and libupnp 1.4.2 or later. Both of these can found in most repositories and atleast GCC should be installed by default in most installations. After you've got these installed, we can compile the source. They recommend using the -Os CFLAG (which you can edit in /etc/make.conf, or just in front of the configure script. I use -O2 on my system, and uBox works fine with it.
./configure --prefix=/usr
make
Let's install it in /usr/bin so we can run it from anywhere.
make install-strip
The install process didn't take long at all on our AMD Athlon X2 3500+ system with 2GB of Crucial Ballistix Tracer DDR2 RAM. I don't imagine it would take long on any processor faster than 1GHz. Now that the installation is complete, let's look at using uShare.

Using uShare

uShare worked for us right away. We just glanced at ushare --help to figure out what options we need to use the program with the XBox 360.
Options:
   -n, --name=NAME              Set UPnP Friendly Name (default is 'uShare')
   -i, --interface=IFACE        Use IFACE Network Interface (default is 'eth0')
   -f, --cfg=FILE               Config file to be used
   -p, --port=PORT              Forces the HTTP server to run on PORT
   -c, --content=DIR            Share the content of DIR directory (default is './')
   -w, --no-web                 Disable the control web page (enabled
        by default)
   -o, --override-iconv-err     If iconv fails parsing name, still add to media contents (hoping the renderer can handle it)
   -v, --verbose                Set verbose display.
   -x, --xbox                   Use XboX 360 compliant profile
   -d, --dlna                   Use DLNA compliant profile (PlayStation3 needs this)
   -D, --daemon                 Run as a daemon.
   -V, --version                Display the version of uShare and exit
   -h, --help                   Display this help
You can run uShare as a daemon if you want. I'd like to eventually set up an rc script to use with Gentoo so it starts at boot. For now, we're using the command to run the server. uShare expects at least one directory argument, specifying where multimedia files are stored. For each directory you include, you must specify it with -c. Also, you may want to change the interface uShare listens on with -i. uShare doesn't look for a valid or working ethernet interface, so if eth0 isn't the interface you want to use, make sure you change it. Let's look at how we decided to use uShare:
ushare -n Galactica -c /opt/music -c /opt/movies -x -i eth1
We named our server Galactica (same as the machine name), and specified two folders where multimedia files can be found. -x gives us XBox 360 functionality, which is our purpose for trying this software. Finally, we're using eth1 as our interface. uShare doesn't actively look for new or updated content. You'll either have to restart the server when you need to refresh, or use the webserver to refresh the content. To access the web server, point a browser to http://ip_address:port/web/ushare.html. The default port is 49152. You'll be greeted by a plain and simple page with options to update and manage shares.

Using the 360

From Dashboard, we selected "media", then "music", "movies", or "pictures". Select "computer" from sources and hit okay until the 360 begins scanning for computers. It shouldn't take more than a few seconds for it to see your uShare server. You're then presented with the usual categories to view your music such as genre, album, artist, songs, etc. You should be able to play anything from there. I ran into some issues with music. All of my music is in the MP3 format, but the XBox doesn't recognize all versions of MP3 apparently. I have no explanation for this. Otherwise, as long as your files meet XBox compatibility, you shouldn't have any issues.
  • MPEG-1 with MPEG audio
  • MPEG-2 with MPEG audio or AC-3 audio
  • WMV 7, 8, & 9 with WMA Standard or WMA Pro audio
  • WMV Image 1 & 2 (Photo Story 1, 2, & 3)
  • Windows Media Audio (WMA) Standard
  • WMA Pro
  • WMA Lossless
  • MP3
In comparison, uShare will share the following filetypes:
  • Video files: asf, avi, dv, divx, wmv, mjpg, mjpeg, mpeg, mpg, mpe, mp2p, vob, mp2t, m1v, m2v, m4v, m4p, mp4ps, ts, ogm, mkv, rmvb, mov, qt
  • Audio files: aac, ac3, aif, aiff, at3p, au, snd, dts, rmi, mp1, mp2, mp3, mp4, mpa, ogg, wav, pcm, lpcm, l16, wma, mka, ra, rm, ram
  • Images files: bmp, ico, gif, jpeg, jpg, jpe, pcd, png, pnm, ppm, qti, qtf, qtif, tif, tiff
  • Playlist files: pls, m3u, asx
  • Subtitle files: dks, idx, mpl, pjs, psb, scr, srt, ssa, stl, sub, tts, vsf, zeg
  • Various text files: bup, ifo
Big difference in support there, and I'm sure most of the problems you'll run into are video-related.

Extending uShare with shell scripts

Since uShare provides you with a basic web interface, the only command line options available are for configuring the program. With the web interface, you're given management over shares. You can add or delete, or add new shares. This is useful, especially if you tend to download or rip a lot of files. Use MythTV to record live TV? No problem, just use the web interface to refresh your shares. Since there is, as of yet, no ebuild for Gentoo, I had to install uShare from source. That's all fine and peachy, but I want uShare to start when my computer boots. I wrote a short rc-script to do what I need it to do. You can extend it further, possibly creating an /etc/conf.d configuration file for it. Since the only uPnP media device I have is the XBox, I didn't see any reason to go beyond this. Some of you may have to edit "-i eth1" to "-i eth0", or just remove that part all together. Since my laptop is rarely rarely plugged into the network, I let uShare run over wireless.
#!/sbin/runscript
# Copyright 2007 Sean Potter
# Distributed under the terms of the GNU General Public License, v2 or later

depend()
{
  need net
  use logger
}

start() {
        ebegin "Starting uShare with XBox 360 Support"
        start-stop-daemon --start --background --pidfile /var/run/ushare.pid --make-pidfile --exec /usr/bin/ushare -- -i eth1 -x -c /opt -n $HOSTNAME
        eend $?
}

stop () {
        ebegin "Stopping uShare with XBox 360 Support"
        start-stop-daemon --stop --quiet --pidfile=/var/run/ushare.pid
        eend $?
}
I'm sure there are plenty of other creative ways to extend uShare with scripts. If you wanted, you could probably code an interrupt that forces uShare to refresh it's shares. That's a little beyond the scope of this article, but join the discussion in our forums and we'd be glad to help you with any ideas you have.

The Future

We had the opportunity to interview Benjamin Zores, the developer of uShare. We got inside his head and found out where uShare started and where it was going in the near future. BIOS_LEVEL: First off, we'd like to thank for uShare's XBox 360 compatibility. Ben Zores: Thanks, although XboX360 compatibility isn't uShare's strongest point. BL: To start off, can you tell us a little more about yourself and your involvement with GeeXboX? BZ: I'm one of the GeeXboX original authors (2 were involved) and I'm leading the distribution for over 4 years now. I can be seen as main developer and team manager. I'm also involved in a few other OSS that GeeXboX makes use of, such as MPlayer and FFMpeg, and of course, other OSS i've created, uShare being one of them. BL: Were there any reasons aside from GeeXboX that prompted the development of uShare? Was XBox 360 or Playstation 3 compatibility planned from conception? BZ: Actually, uShare was designed (and released) way before XboX 360 and PS3 came out iirc. For the little story, I used to work on UPnP A/V protocol for some job in the past. Although I don't like much the protocol itself, it became some kinda industrial reference and was pretty easy to set up. I've then decided to create an open-source media server based on my own experience and, once done, added ways to GeeXboX to play contents served by uShare. I have no idea how XboX 360 support works actually Wink I never had access to one (nor did I even see one in person, even remotely. I just did some hacks around the protocol based on various info I was able to retrieve and a few contributions and bug fixes I received. To be honnest I don't even have access to any [hardware] UPnP player to test uShare with. These days, I'm much more interested in PS3 support as I own one but also as it's the first devices with DLNA support and I wanted uShare to be compliant with it. BL: How much feedback do you get about uShare? Is it mostly positive? BZ: Since a few months I get a lot of feedback on uShare and it's mostly positive. I also receive a lot of feature requests (transcoding capabilities, better support ...) but I'm mostly lacking of time and manpower to have them all implemented. I was however in touch with CELF (Consummer Embedded Linux Forum) members and some companies that would like uShare to be extended. As you can see, the feeling is pretty good for a software a did so quickly (and that never meant to be that famous). BL: What were the challenges of designing a upnp server and working to make it DLNA-compliant? BZ: Doing a UPnP A/V compliant Media Server is not that difficult. One probably comes from the UPnP protocol itself. It's way too open and flexible. As a result, many device manufacturers implement their own services extensions (thank you again Microsoft for your useless registration service) and it's quickly become a mess to have a compliant product. DLNA can be seen as a professionnal, restricted, UPnP A/V design. It fully relies on the same protocols than UPnP A/V but avoids all this annoying flexibility, forcing devices to stick to some norm, which is a good idea. The DLNA consortium members however did make a certain amount of choices that I personally find ridiculous, such as restraining to some specific audio/video profiles for codecs and containers, but that's how the protocol is. The biggest problem is that DLNA specifications aren't free (5000$ or so iirc). Thanks to CELF however, I've been granted them and I'm now working on having a much better DLNA support in uShare than the dirty hack that comes with 1.0 version. BL: Now that uShare has reached the 1.0 milestone, what are future plans for the project? BZ: Complete DLNA support through libdlna, a side project of mine, with DLNA guidelines implementation, that uShare (and hopefully other media servers) will make use of. Once done, I'd like to have uShare officially DLNA certified. I'd also like to see transcoding capabilities, more runtime file discovery and stuff like that. BL: Will we ever see a GUI, or, more importantly, some form a media adapter with transcoding? We know this would probably require a fairly powerful server to transcode and serve up the stream at the same time, but it would still be a great feature. BZ: Transcoding will probably be implemented within libdlna. I'm not dropping the GUI idea either. Currently uShare features a WebUI (that can be extended) but I wouldn't object to having some GUI (but using a client/server approach). I unfortunately haven't time for that, but contributions are welcomed. BL: How much outside support do you get in terms of patches or even new features? BZ: That's one of the biggest problems. I receive a lot of mails and a lot of feature requests but really few patches. I've mostly implemented all major features by myself. I have however received many very valuable contributions from various people that help me fix a lot fo bugs, enhance memory footprint, make XboX360 support actually work or gave me first DLNA overview. BL: Are there any projects working to extend uShare that you're aware of? BZ: No directly, but libdna (http://libdlna.geexbox.org/) is what I'm working on right now. Once I'll have completed all DLNA A/V profiles, I'll make some 0.1 release and uShare 1.1 will come out, with a much better support for DLNA as a result. For the record, libdlna makes use of FFMpeg to determine input files profiles so I intend to use it to be able to transcode too. BL: Thanks for your time, and more importantly, thank you for uShare. Is there anything else you want readers to know about uShare? BZ: Yeah, send me patches =D Your opinion (being good or not) is always welcomed and if you're motivated in helping me extend uShare, just join the development.

Conclusion

uShare is turning out to be a great tool, especially for those of us with Playstations 3 or XBox 360. Of course, you can also benefit by using the Linux distribution it was meant for: GeeXboX. Provided your media is encoded in the proper formats, you should have no problem turning your XBox 360 into a Home Theater monster. You won't be able to watch live TV through it (the functionality is coming to the PS3, so why not the 360 as well?), but you can watch and listen to most of the media stored on your hard drives. After our brief interview with the lead developer, we learned that in future releases you should be able to play a full range of formats on the 360 and Playstation3. uShare is a terrific piece of software, and future updates look very promising. However, the developers always need more help! If you've got an XBox 360, Playstation 3, or other hardware UPnP device, join in the development through the homepage or GeeXboX. We'd love to releases with graphical clients, an improved web interface, and transcoding support out soon. The more people helping the project, the faster we'll see this stuff. Pros:
  • Streams media over the network to supported UPnP devices
  • Playstation 3 and XBox 360 Compatible
  • Easy configuration from the command line
  • Extendable via scripts
  • Written in C for Speed!
Cons:
  • No transcoding support yet
  • No graphical tools
  • Web interface is plain
  • Rating

    9/10