Saturday, August 23, 2008

Playstation 3, Streaming, Formats ... Ick.

I've been working away at a media streaming project for the last week or two -- mainly because running between the machine that holds most of my web-content and the TV becomes tiresome, especially when you've got most of the content in .mkv or .mp4 formats that don't fit more than an episode or two on a DVD-R.

I've tried TwonkyVision, which was widely recommended as the best solution for streaming with transcoding from external sources -- but is purchase-ware, as well as both FUPPES and MediaTomb from the world of OSS.

Quite frankly, I came away quite unimpressed.

Not because any of the software is bad, or particularly difficult to setup (albeit that you need a newer version of FFMPEG to get any reasonable quality from the HDTV transcodes, and that creates debian pain.) ...

More because the Playstation doesn't do half the things you'd expect of it.

Granted, it's behind the XBox360 juggernaut in terms of market time -- but if you're going to do format compatibility, please -- SONY, make a decent job of it.

First, I tried connecting the three media servers using the default instructions for each, enabled uPnP and a default multicast route for the boxes that held the data -- of course, while that meant my laptops could see the share -- the PS3 didn't.

Further investigation concluded it's nigh on impossible to get the PS3 (40GB, running firmware 2.42) to talk to a media server via the wireless interface.

15M of CAT5 later and a re-configuration of the PS3 to use a wired interface -- we had liftoff, well -- nearly, the PS3 had dropouts whenever it tried to look up directories on the share, it'd start searching, get through the first 20 or 30 entries and stop.

More poking ensued -- turns out the PS3 needed an explicit route to the box hosting the media, easily fixed -- but in no manual, it only triggered in my brain because the box doing the serving (running Red Hat Enterprise Linux 4.x) was triggering source route notifications in my logfiles.

Now the PS3 saw the media, as a variety of MPEG-2's, and Unknown Data.

Back to the interschnitzel, to find MediaTomb and FUPPES both have 'a workaround' to make the PS3 see DivX files, except they both don't actually work on PS3's with 2.4x firmware 'out of the box' (a phrase becoming my new favourite annoyance)

For MediaTomb this means adding:

<map from="avi" to="video/x-divx"/>
<map from="divx" to="video/x-divx"/>

For FUPPES this means:

<file ext="avi">

... to your configurations.

A 'Re-boot and Re-Import' later the PS3 saw a bunch of MPEG-2 and DivX files, Good.

Except half of them wouldn't play, Bad.

Infact, the PS3 seems more picky about which DivX/XviD files it'll play than the documentation suggests -- the exact same file with the exact same settings encoded in XviD 1.10 and 1.12 play differently on the PS3, the 1.10 file is called 'Corrupted Data' but the 1.12 copy plays normally, albeit with audio skew caused by lag.

Then there's MPEG-2's that won't play if they are in a TS container, but will if the stream is copied to a PS container first.

Matroska (MKV) based H.264 files won't play at all either, having a platform that says it supports 'new media' and not having a Matroska muxer/parser is ... er, strange.

My personal favourite though, is that transcoding anything high-definition fails using 'chunked' encoding because the 'buffer' size (I set for 512k) is too large.

Luckily, that's an easy fix for FUPPES. For MediaTomb it's not straightforward, you need to change the 'fill' size to workaround it ... but again, that's not documented anywhere either.

The working settings I came up with (which need to be added to each transcoding section where you're converting H.264 (.mkv or .mp4 mostly, unless you watch High-Def Pornography, in which case i'll leave it as an exercise to the reader) were:


<buffer size="20971520" chunk-size="524288" fill-size="10485760"/>



In the end, after recompiling both platforms -- I settled on MediaTomb, although I now have both RHEL 4 and Ubuntu 8.04 packages for both platforms from their respective RCSes from 20080818, so I can switch easily if I want to change.

There'll be a forthcoming post on how to configure the transcoder scripts and FFMPEG, sometime when i've got hours up my sleeve to document it with sane reasoning and screenshots, i've got it going now -- but if I wrote it up, it'd look ranty and like I was SONY-bashing.

I agree with this guy. The XMB is nice, the changing colour for the seasons is a nice touch too, but if the PS3 doesn't increase the titles available via the Playstation Network (In Australia, we don't have a Madden '09 demo yet, for example -- nor do we have Castlevania, but we do have a bunch of music videos and some streaming from various trade events .. for all the use they are.) then it'll be behind the X360 for a while to come.

However, if they don't fix the format capabilities -- probably by this holiday season, then they'll be behind the X360 for a long, long, long time to come.

Really, an Matroska muxer -- support for all three main H.264/AAC profiles, MPEG2-TS and -PS support and a differentiation between DivX (DX50/DX60) and XviD (XVID) would be nice, at least so I don't have to transcode the latter to view something you're natively capable of viewing in the first place.

If we got that, plus maybe an Dirac and Vorbis implementation (I mean, does anyone use ATRAC) -- the Playstation 3, to quote a great movie reference ... "would become more powerful than you could possibly imagine."

... but at the moment, it's a games platform, with a swanky front-end.

If SONY think it's anything more than that, they owe me my weekend back.


mat said...

I'm leaving this comment here 'cos comments on your post about converting video for PS3 are disabled, but I thought you'd like to know about this.

I did the same thing as you with AviDemux, but I still find it fails from time to time, and it's far from ideal when you have a nice MKV full of quality video and the PS3 only won't play it 'cos of the container, so you have to transcode to a crappier codec and lose quality.

So I wrote a remuxing script, just to handle MKV containers with PS3-friendly video in. It doesn't always work, and it's got some nasty hacks in there (check the ghetto bit of python towards the end, for example), but it's a hell of a lot quicker than transcoding when it does work. The mp4s stream fine from my mediatomb, even at 1080.

There's a copy of the script up here:

Shouldn't be a problem on debian, it's all standard stuff. Hope it's helpful to you.

Walter van Waard said...

Hi, I use a system base on FreeNas. It's actualy a Lacie EthernetDisk one of the first gen. It normaly comes with Windows CE. Anyhow. Freenas has a very good implementation for the Playstation3 and comes with a very good Web interface. Also if you encode your video's in Divx6 you have no problem streaming anything. Even with HD content the streaming is perfect. I hope this comment helps ;-)

Karim said...

i was wondering if you could help me with setting up transcoding of the failed avi files in fuppes to the playstation.

Particularly the XVID's and Divx50 that don't play natively.

Paul said...

I never actually got transcoding to work properly with FUPPES, it could have been to do with my copy of FFMPEG though.

This was tested with 2.31 firmware and retested with 2.60.

The closest I got for DivX 5.0 was:

<transcode enabled="true">
<video_codec vcodec="msmpeg4">mpeg2video</video_codec>
<audio_codec acodec="wmav2">mp2</audio_codec>

It works, but it gets choppy around scene transitions (going from colour to black to colour again)