Jump to: navigation, search

Xbox 360 Streaming Media from FreeBSD


As of December 2007, Microsoft added Xvid codec support to the Xbox 360, making it a fairly capable media streaming device. The 360 already supported Universal Plug and Play (UPnP) for streaming, but it wasn't until this update that I wanted to get it working on FreeBSD. There are many UPnP servers, but only a few that like FreeBSD:

So, this narrowed it down to uShare and FUPPES. I would recommend trying both, but starting with uShare since it's MUCH easier to get running initially. FUPPES has more features, so you may wish to try that out as well.


uShare

uShare is in ports, but there is a bug either with the 360 or uShare that won't permit .avi files to be viewed unless its mime-type is modified. I created a patch, but have not submitted it to the port maintainer because this is just a hack to make it work on the 360, I don't know how it affects other UPnP clients.

Fetch this patch and place it in /usr/ports/net/ushare/files/, then install that port as you normally would. The only thing this patch does is change the avi mime type.

cd /usr/ports/net/ushare/files
fetch http://falz.net/static/ushare/patch-src_mime.c 
cd ..
make
make install

Edit /usr/local/etc/ushare.conf. A complete file can be:

USHARE_NAME=ushare
USHARE_IFACE=fxp0
USHARE_PORT=
USHARE_DIR=/some/path/to/music,/some/path/to/videos
USHARE_OVERRIDE_ICONV_ERR=

Edit /etc/rc.conf and add:

ushare_enable="YES"
ushare_flags="-x -v"

The -x is to force Xbox 360 support. The -v is optional and will give you verbose logging. Then just start it like you would any port:

/usr/local/etc/rc.d/ushare start
Starting ushare.

Your 360 should immediately see it.


FUPPES

Fuppes has transcoding and virtual folder support. If you need either of these things, you may want to use it instead of uShare. Be sure that you have taglib installed in advance so FUPPES can read id3 tags. I compiled from SVN, as the SVN version apparently has better 360 support. In a directory of your choice, do:

svn co http://fuppes-svn.ulrich-voelkel.de/trunk fuppes
cd fuppes
autoreconf -vfi
./configure
make

You could also run make install if you're happy to have binaries in your system installed from non-ports. Otherwise, it will run just fine from the src/fuppes binary.

Fuppes will create its config file automatically when you start it, and it will place it in ~/.fuppes/fuppes.cfg. Start fuppes, then stop it with q. Starting it should give something like:

            FUPPES - SVN-r571
    the Free UPnP Entertainment Service
      http://fuppes.ulrich-voelkel.de

webinterface: http://192.168.10.3:8080

r = rebuild database
i = print system info
h = print help

press "ctrl-c" or "q" to quit

Quit, and edit ~/.fuppes/fuppes.cfg. It will have an Xbox 360 section already, but the parts in bold must be changed/added:

<device name="Xbox 360" virtual="Xbox 360" enabled="true">
	<user_agent>Xbox/2.0.\d+.\d+ UPnP/1.0 Xbox/2.0.\d+.\d+</user_agent>
	<user_agent>Xenon</user_agent>
	<xbox360>true</xbox360>
	<description_values>
		<friendly_name>%s %v : 1 : Windows Media Connect</friendly_name>
		<model_name>Windows Media Connect compatible (%s)</model_name>
		<model_number>2.0</model_number>
	</description_values>
	<file_settings>
		<file ext="mp3">
			<type>AUDIO_ITEM_MUSIC_TRACK</type>
		</file>
		<file ext="jpg">
			<type>IMAGE_ITEM_PHOTO</type>
		</file>
		<file ext="avi">
			<type>VIDEO_ITEM</type>
			<mime_type>video/x-ms-wmv</mime_type>
		</file>
	</file_settings>
</device>

Also, near the top of the config, be sure to specify what to share, and possibly force its http interface to a port:

<shared_objects>
	<dir>/some/path/to/videos</dir>
	<dir>/some/path/to/music</dir>
</shared_objects>
<network>
	(snipped)
	<http_port>8080</http_port>
	(snipped)
</network>

Fuppes also mentions that a change should be made in vfolder.cfg, but the SVN version appears to already have it. Copy your vfolder.cfg from your fuppes source dir to ~/.fuppes/.

Start fuppes again. Your Xbox will not yet see it! You have to manually force a database build, and a virtual folder rebuild. Do this by pressing r to build database, then v to build virtual folder structure. Press l to up the logging level to find out what it's doing. This process can take quite some time! Log into the http server of FUPPES to check its status. The direct links to the interesting pages are:

  • http://your_server:8080/presentation/status.html - See how many items it's found. Refresh page to ensure it's working.
  • http://your_server:8080/presentation/options.html - Will list 3 links if complete. If not, it will say that there is an update in progress. The 360 will not see content until this is complete!