I want to stream mod, med, s3m, xm, it modules, flac music files, watch YouTube videos, and see thumbnails on my Playstation 3 (PS3).
- MediaTomb is running on my NetBSD machine
- pkgsrc doesn't have an updated pkgsrc entry
- The current pkgsrc entry for ffmpegthumbnailer doesn't have a buildlink3.mk
- The pkgsrc entry is 0.11.0 which is basically about 40% broken
- 0.11.0 is the current stable version available to most, if not all, distros including pkgsrc and FreeBSD ports
- 0.12.0 must be built from the code currently in SVN, which must be checked-out manually
- CentOS 5 doesn't have a recent-enough autoconf/automake to build mediatomb from source
I have a Playstation 3, and with recent software updates, it now has the ability to browse and play media including H.264, MP4 (via what appears to be a commercial DivX implementation,) all kinds of MPEG1/2 streams, and even some Microsoft WMV type formats from a uPnP media server.
Since the only major piece of software capable of doing this with any alacrity is Mediatomb, I dove right in. Mediatomb, after all, sits pretty in NetBSD's pkgsrc tree, which means I wouldn't have to go through huge gyrations to get it installed, and wouldn't be stuck fiddling around deleting obscurely-installed junk if I wanted to be rid of it or upgrade.Installing 0.11.0 on NetBSD
Getting 0.11.0 (the version currently in pkgsrc as of this writing) was easy:
pchroot (pop into a waiting pkg_comp chroot'd build environment)
(In real environment:)
Getting it going on my PS3 was NOT easy. I eventually ended up using config.xml.old (attached) to get it playing basic media mounted by NFS on shog, my NetBSD dual-core EM64T Pentium-D 930 all-purpose machine, from my big multi-terabyte bad-ass server, khan.
This works for the most part, except for the fact that my PS3 is connected via wireless to the rest of my network. If it is ever starved of video data, it throws up error messages and the movie has to be stopped and started again. Bandwidth must be carefully, carefully monitored and manually conserved either from the transcoding process itself (which can be set for a maximum bandwidth utilisation) or by judicious use of pause, or, in worst case, stopping and restarting the movie.
Luckily the PS3 knows where it left off, so stopping and restarting is a pretty painless way to fix movie hiccoughs.
The helper script mencoder-tr (attached) was what I was using to generically transcode media from PS3-unknown formats on-the-fly to my PS3 in a clean streaming
format it was natively capable of playing--specifically MPEG-2. Originally I'd been using the commented-out mencoder section, but abandoned that because for some reason video and audio were desync'ing unpredictably. So, I sacrificed external subtitles (usually the .srt files) for the stability of ffmpeg. Oh well. (And yes, I checked the source. ffmpeg currently has no concept of .srt files. Just mpeg-style icon overlay subtitles.)Changing the uPnP MediaTomb icons
As an aside, I got irritated with the MT playbutton Mediatomb uPnP icon displayed on the browser screens of the PS3 and ended up changing it to something else after grovelling through the source for its actual location, because this turned out not to be documented anywhere. But it was easy enough to find: all that needs replacing are the three icons in the web/icons directory:
The icons must be 120x120 square, but can otherwise be anything.
So far so good: 0.11.0 works acceptably, but after fiddling for a few hours trying to stream my old Amiga mod collection using the attached "mikmod-tr" translator, and failing over and over with that obnoxiously unhelpful "Data type not supported." error message from the PS3 no matter what I did, I thought.. ah screw it. I'll try compiling mediatomb from SVN and see if I can get YouTube videos going at least. Plus I saw this URL here which suggested there was an issue with streaming PCM from Mediatomb-0.11.0 and the PS3:ChangeLog, SVN revision 1979, prior to 0.12.0 release
Note the ChangeLog entry:
16 added fixes to allow PCM playback on the PS3 and other devices,
17 thanks to mru for his findings. This allows streaming transcoded
18 OGG and FLAC media to the PS3."
So it turned out that 0.11.0 was broken with the PS3 w.r.t. streaming PCM streams.. regardless of all the references to PCM and OGG and FLAC in the sample config.xml file. Doh! Major psyche-out!
Building a new Mediatomb pkgsrc entry for SVN-derived sources
First I thought it would be easier to build and run MediaTomb on my Linux machine because that's where it was developed. Unfortunately, CentOS 5 (running on khan) doesn't have the most up-to-date autoconf and automakes, which MediaTomb absolutely requires to build. CentOS installs autoconf 2.59, but MediaTomb's configure.ac bitches and whines about a minimum autoconf 2.61 or later. Oh well. I can see Linux would be an uphill battle.. this particular problem is easy to solve, but endless fiddling around in Linux, and then tweaking a spec file to get rpmbuild to package it up properly.. my god.. what a pain.
Instead, this turned out to be way easier to do on my NetBSD machine than I thought it was going to be. All the NetBSD-specific patches were helpfully added to the code by the MediaTomb people, so grabbing the latest SVN copy with:svn co https://svn.mediatomb.cc/svnroot/mediatomb/trunk/mediatomb mediatomb
... obviated the need to use the pkgsrc patches in the 0.11.0 MediaTomb pkgsrc directory. What I decided to do was simulate a 0.12.0 release.
mv mediatomb mediatomb-0.12.0
(The above is necessary because pkgsrc expects the tarball to extract into a directory named after the pkgsrc entry and version. It's not strictly necessary, but it does allow me to use the default pkgsrc behaviour without modifying the pkgsrc Makefile too much.)
tar -czvf mediatomb-0.12.0.tar.gz
(The above creates a distfile which we can use to trick pkgsrc into starting the build process.)
mv mediatomb-0.12.0.tar.gz /usr/pkgsrc/distfiles/
Using the attached patch, I built a fresh pkgsrc entry which can be used to build from directly. Additionally, to get the ffmpegthumbnailer correctly building into MediaTomb and being recognised during the build process I had to add the attached buildlink3.mk file to ffmpegthumbnailer, and then include it via the mediatomb-svn Makefile (note the references in the patch.)
Once all this was done, it could be forcefully built with:
(Back in built chroot bowl..)
make NO_CHECKSUM=yes package
It turns out that the best way to get a sample config.xml is to let MediaTomb build one from scratch after it tries and fails to locate one. After that, it was a simple matter to merge the two of them together to maintain all the transcoding work I'd done. And guess what?I can now stream ALL my Amiga mods.
But sudog, you might be thinking: what's this uade123 thing in your mikmod-tr?
Well, uade123 is a stripped-down Amiga simulator which is capable of playing obscure Amiga music module formats--hundreds of them--by emulating an Amiga CPU and music chips, running some native Amiga software on them, and virtually capturing the output in sample form. Neat huh?
Except uade is NOT really natively available in too many places. Luckily downloading it and building it are easy. You can get it from here:UADE Downloads Page
... and make sure you get the latest version. Building it is a snap:
tar -xzvf uade-2.12.tar.bz2
(On NetBSD, you don't have to use 'j' to decompress .bz2. That's a stupid, stupid lame Linux-ism.)
It does require libao, but that's in pkgsrc so.. meh.
Building it is a pseudo-snap:
(Dumps it unceremoniously into /usr/local/. Ah well. Can't be perfect all the time.)
(Again.. same place.)
And now we have uade123.NOTE:
This is really important. In total, this software and my scripts absolutely require
all kinds of additional software to function, from bash for the scripts (sh should work though) to uade, to sox, to mikmod, to mediatomb and all the libraries it depends on. I haven't done an exhaustive step-by-step here because all the other little bits are lame and boring. But you might run into them if you try to duplicate my efforts.
Still, nothing quite beats watching YouTube in a virtual directory, seeing thumbnails for all kinds of video and avi, listening to Amiga MOD music through my PS3, finally being able to play my substantial FLAC collection, and so on.
As a bonus, and because I forgot to do it earlier, here are the *-tr scripts I use for the whole kit.In the near future..
Coming soon! MOD and other music formats, in compressed form, handled automatically. Auto-on-the-fly extraction from .LZH, .LhA, and .LZX forms, and .ZIP too, for all those great Modarchive and UnExotica modules I have.. (all 45GB of them.)
- Wireless Bandwidth Lameness (electrician wiring needed)
- Correct WAV file playing
- OGG file testing
- YouTube videos quitting in the middle of playing with [flv @ 0x520000]skipping flv packet: type 67, size 7302772, flags 0