Search This Blog


Streaming to PS3 Using MediaTomb + Transcoding

When configuring MediaTomb to stream to the PS3 using UPnP there were/are a few problems you may run into that may end up being extremely frustrating. I will go through the install/configuration process and give an idea how to troubleshoot some problems.

Basic Installation (Ubuntu 10.04 Server)

Step 1: Installation
Installing the packages required for mediatomb.
sudo apt-get update
sudo apt-get install mediatomb

Step 2: Configuration
The next step is to configure mediatomb for PS3 playback. There are just a few lines that need to be uncommented or changed to allow for playback on PS3 and divx support.

sudo nano /etc/mediatomb/config.xml

<!-- Uncomment the line below for PS3 divx support -->
<map from="avi" to="video/divx"/>

Step 3: Binding interfaces
I found when installing mediatomb that it assumed I was using the default interface eth0.
I was not but decided I should change my eth1 back to eth0 anyways as somehow it got changed. Changing an Ethernet name is simple by using the following steps:

1. In the below file change eth1 to eth0 or whichever you would like to name it.
sudo nano /etc/udev/rules.d/70-persistent-net.rules

2.Change the ethX to whichever you would like (Or add it if it doesn't exist)
sudo nano /etc/network/interfaces
auto eth0
iface eth0 inet dhcp

Once this is done it's probably a good idea to specify the interface to bind to under: /etc/mediatomb/config.xml

Also, Make sure to look in the /var/log/mediatomb and check which IP and which interface mediatomb is actually using

Step 4: Removing Duplicate Entries in Windows Media Player
On the PS3 you will not see more than 1 entry for files hosted on mediatomb. But on Windows Media Player you will see 2-3 entries. I have found out how to get rid of one using the following command but am unsure how to remove the other.

<pc-directory upnp-hide="yes"/>

Step 5: Restarting MediaTomb Service
This is easily done by:
sudo /etc/init.d/mediatomb restart

Step 6: Making Sure You Have the Right File Permissions
It seems simple enough but do a ls -l to make sure your files have the correct file permissions 666 or higher to be safe.

This is because you are accessing the files from a different user from what the mediatomb server is using. You can add users in the config file if you want but making everything work without open file permissions can be difficult/annoying.

Changing default Samba Permissions for Proper Playback.
You're likely dumping files on your mediatomb server using smb so go ahead and change the /etc/samba/smb.conf file so that you share has the following default permissions for when you copy files to it.

comment = Shared Data Storage
path = /share
writeable = yes
create mode = 0777
directory mode = 0777
locking = yes

Transcoding Files on the Fly:
Transcoding media is a very CPU intensive process but to play unsupported files on the ps3 it is necessary to convert one filetype to another to allow for playback.

This is done by creating a script that can be referenced in the config.xml for mediatomb.

To allow for mkv transcoding I used the following script under /usr/local/bin/mkv2mpeg

exec "${FFMPEG_PATH}" -i "${INPUT}" -vcodec ${VIDEO_CODEC} -b ${VIDEO_BITRATE} \
-r ${VIDEO_FRAMERATE} -acodec ${AUDIO_CODEC} -f ${FORMAT} - > "${OUTPUT}"

The above was taken from:

The next step is to add a reference for this script into the config.xml file I will just include my entire transcoding section tag for reference.

<transcoding enabled="yes">
<transcode mimetype="video/x-matroska" using="ffmpeg"/>
<transcode mimetype="video/x-flv" using="vlcmpeg"/>
<transcode mimetype="application/ogg" using="vlcmpeg"/>
<transcode mimetype="application/ogg" using="oggflac2raw"/>
<transcode mimetype="audio/x-flac" using="oggflac2raw"/>
<profile name="oggflac2raw" enabled="no" type="external">
<agent command="ogg123" arguments="-d raw -o byteorder:big -f %out %in"/>
<buffer size="1048576" chunk-size="131072" fill-size="262144"/>
<profile name="vlcmpeg" enabled="no" type="external">
<agent command="vlc" arguments="-I dummy %in --sout #transcode{venc=ffmpeg,vcodec=mp2v,vb=4$
<buffer size="14400000" chunk-size="512000" fill-size="120000"/>
<profile name="ffmpeg" enabled="yes" type="external">
<agent command="/usr/local/bin/mkv2mpeg" arguments="%in %out"/>
<buffer size="14400000" chunk-size="512000" fill-size="120000"/>

There are further resources for transcoding scripts for PS3 at:

Transcoding can also be done with VLC according to others:

I thought I would just include some locations of files in order to help troubleshoot some issues

Logging: /var/log/mediatomb.log

Startup Behavior: /etc/init.d/mediatomb


No comments:

Post a Comment