Tuesday, October 18 2011, 09:57 pm
Crossing the Streams to the Playstation 3 (part 1)
I wish I didn't have to write this article, but when there's a dozen audio formats, a dozen video formats, and a dozen media containers there's only one result: headaches. If you own a Playstation 3, a Linux computer, and have Mediatomb installed, you can take advantage of the UPnP feature on the PS3 to play your audio or video over the network. This part 1 of 2 posting will start with audio.
FLAC to PCM
The Playstation 3 is a funny thing when it comes to audio. If you only have Optical (TosLink) or Coax audio output you're stuck with 48kHz sample rate. If you have HDMI you can go higher. The example below will get you FLAC transcoding into 48kHz PCM that the Playstation 3 will play.
<profile name="audio-flac" enabled="yes" type="external"> <mimetype>audio/L16</mimetype> <accept-url>no</accept-url> <first-resource>yes</first-resource> <hide-original-resource>yes</hide-original-resource> <accept-ogg-theora>no</accept-ogg-theora> <sample-frequency>48000</sample-frequency> <audio-channels>2</audio-channels> <agent command="ffmpeg-flac" arguments="%in %out" /> <buffer size="4194304" chunk-size="262144" fill-size="0"/> </profile>
#!/bin/bash exec /usr/bin/ffmpeg -threads 2 -i "$1" -ar 48000 -acodec pcm_s16be -f alaw - > "$2"
Why 48kHz? I have some 96kHz media so I'd rather it go to the PS3 at the best possible rate. The PS3 will resample to 48kHz if you choose to go with 44.1kHz anyway so you might as well go with 48kHz. You can up this to 96kHz on an HDMI connection, but I don't have one to test with.
Mediatomb development does not seem very active, but some folks have made patches to add features that make streaming more enjoyable. One annoying part of streaming on the PS3 is the default grey music icon for your tracks. This can be replaced by the album art with patch number one. You can't seek in tracks either, but that is also negated with patch number two.
Coming up: Transcoding matroska containers into the best possible format.