Streaming Vorbis files from Ubuntu to a PS3

One of the nice features of the PlayStation 3 is the UPNP/DLNA media renderer.  Unfortunately, the set of codecs is pretty limited, which is a problem since most of my music is encoded as Vorbis.  MediaTomb was suggested to me as a server that could transcode the files to a format the PS3 could understand.

Unfortunately, I didn’t have much luck with the version included with Ubuntu 8.10 (Intrepid), and after a bit of investigation it seems that there isn’t a released version of MediaTomb that can send PCM audio to the PS3.  So I put together a package of a subversion snapshot in my PPA which should work on Intrepid.

With the newer package, it was pretty easy to get things working:

  1. Install the mediatomb-daemon package
  2. Edit the /etc/mediatomb/config.xml file and make the following changes:
    • Change the <protocolInfo/> line to set extend="yes".
    • In the <extension-mimetype> section, uncomment the line to map “avi” to “video/divx”.  This will get a lot of videos to play without problem.
    • In the <mimetype-upnpclass> section, add a line to map “application/ogg” to “object.item.audioItem.musicTrack”.  This is needed for the vorbis files to be recognised as music.
    • In the <mimetype-contenttype> section add a line to map “audio/L16″ to “pcm”.
    • On the <transcoding> element, change the enabled attribute to “yes”.
    • Add the settings from here to the <transcoding> section.
  3. Edit the /etc/default/mediatomb script and set INTERFACE to the network interface you want to advertise on.
  4. Restart the mediatomb daemon.
  5. Go to the web UI (try opening /var/lib/mediatomb/mediatomb.html in a web browser), and add the directories you want to export.
  6. Test things on the PS3.

Things aren’t perfect though.  As MediaTomb is simply piping the transcoded audio to the PS3, it doesn’t implement seeking on such files, and it seems that the PS3 won’t even let you pause a stream that doesn’t allow seeking.  With a less generalised transcoding backend, it seems like it should be trivial to support seeking in an uncompressed PCM stream though, since the byte offsets can be trivially mapped to sample numbers.

The other problem I found was that none of the recent music I’d ripped showed up.  It seems that they’d been ripped with the .oga file extension rather than .ogg.  This change appears to have been made in bug 543306, but the reasoning seems suspect: the guidelines from Xiph indicate that the files generated by this encoding profile should continue to use the .ogg file extension.

I tried adding some extra mappings to the MediaTomb configuration file to recognise the files without success, but eventually decided to just rename them and fix the encoding profile locally.

A Perfect Media Server

While MediaTomb mostly works for me, it doesn’t do everything I’d like.  A few of the things I’d like out of a media server include:

  1. No need to configure things via a web UI.  In fact, I could do without a web UI all together – something nicely integrated into the desktop would be nice.
  2. No need to set model specific settings in the configuration file.  Ideally it would know how to talk to common players by default.
  3. Supports transcoding and seeking within transcoded files.  Preferably knows what needs transcoding for common players.
  4. Picks up new files in real time.  So something inotify based rather than periodic reindexing.
  5. A virtual folder tree for music based on artist/album metadata. A plain folder tree for other media would be fine.
  6. Cached video thumbnails would be nice too.  The build of MediaTomb in my PPA includes support for thumbnails (needs to be enabled in the config file), but they aren’t cached so are slow to appear.

Perhaps Zeeshan‘s media server will be worth trying out at some point.

11 Comments

  1. zombiepig
    Posted 30 October, 2008 at 12:38 pm | Permalink

    Something that’s always frustrated me with my ps3 playing back music from my mediatomb share is the massive gap it puts between songs. I’m really interested to know if this is a problem with the ps3 software, or something in mediatomb that’s causing it.

  2. ethana2
    Posted 30 October, 2008 at 1:18 pm | Permalink

    Dude, Ubuntu 8.10 runs /on/ the PS3. Why not just play the .ogg files from there?

  3. Steve H
    Posted 30 October, 2008 at 2:34 pm | Permalink

    Thanks for the howto. I’ve been having trouble getting my ogg and flac files streaming to my PS3 and this helped.

    You can use inotify to automatically add and remove files in real time by editing your config file. Search for “autoscan” in the following link.

    http://mediatomb.cc/pages/documentation#id2537759

  4. Posted 30 October, 2008 at 3:32 pm | Permalink

    ethana2: I haven’t installed Linux on my PS3 at this point, and don’t really have the disk space. Perhaps if I replace the hard disk at some point I’ll consider it (it isn’t clear that this would be any easier, all things considered).

    Steve H: I am using an inotify scanned folder at the moment. I realise that some of the features I mentioned already exist in MediaTomb, but thought I’d mention the ones that I find useful.

  5. Zeeshan Ali
    Posted 30 October, 2008 at 5:20 pm | Permalink

    Perhaps Zeeshan’s media server will be worth trying out at some point.

    For sure, most if not all of the features you mentioned are part of my plan. Lets check:

    1. No need to configure things via a web UI. In fact, I could do without a web UI all together – something nicely integrated into the desktop would be nice.

    Check. Infact I’ve only thought of a nice preference dialog that will appear in your “Preferences” menu in the panel, if you’ve Rygel installed.

    2. No need to set model specific settings in the configuration file. Ideally it would know how to talk to common players by default.

    Almost Check. With control points like PS3 that don’t deviate completely from standards, you shouldn’t need to configure anything. However, CPs like Xbox would definitely need some tweaking (i am hoping more like a checkbox that enables/disables the support) in the config UI.

    3. Supports transcoding and seeking within transcoded files. Preferably knows what needs transcoding for common players.

    Check. On the fly transcoding is a definite feature.

    4. Picks up new files in real time. So something inotify based rather than periodic reindexing.

    Check. Although currently I’ve only Tracker backend but a backend like the one you wish is definitely in the plan.

    5. A virtual folder tree for music based on artist/album metadata. A plain folder tree for other media would be fine.

    If you are implying that it be directly under root folder, it’s not on my TODO list but I could give it a thought. :)

    6. Cached video thumbnails would be nice too. The build of MediaTomb in my PPA includes support for thumbnails (needs to be enabled in the config file), but they aren’t cached so are slow to appear.

    Wasn’t on my TODO list but now it is. :)

  6. Posted 30 October, 2008 at 5:37 pm | Permalink

    When I was setting up mine, I was really surprised how much work had to be done to get the basics working. Mediatomb does a lot, but not having template config files for major consoles like ps3 and xbox makes it the typical ‘Linux experience’. :/

  7. Posted 30 October, 2008 at 5:43 pm | Permalink

    Sounds like Zeeshan’s server is the way to go, I look forward to it :) In the meantime though, I find Fuppes to be a pretty capable server that supports audio and video transcoding. I use it with the Xbox 360 and it works very well (although no seeking in transcoded media, though it can pause) – I’ve not tried with the PS3 yet though.

  8. Wouter
    Posted 30 October, 2008 at 6:34 pm | Permalink

    Would it be possible too to stream and transcode video files to the iphone?

  9. Zeeshan Ali
    Posted 30 October, 2008 at 10:46 pm | Permalink

    Would it be possible too to stream and transcode video files to the iphone?

    Unfortunately, no. :( Apple doesn’t do UPnP. However, it should be possible to port GUPnP (and a control point) to iPhone?

  10. Posted 31 October, 2008 at 2:23 am | Permalink

    despite

    3. Supports transcoding and seeking within transcoded files.

    and

    6. Cached video thumbnails would be nice too.

    the Coherence MediaServers – http://coherence.beebits.net/wiki/MediaServer – do already provide everything you want.

    Transcoding is on the todo list – if it is only for ogg,
    had that in a prototype once, and the video thumbnails
    would be an easy addition.

  11. smuv
    Posted 12 November, 2008 at 10:00 am | Permalink

    Thanks for the setup tips.. works like a charm!