MKV on PS3 using Showtime

I’ve described how one could play MKV files on the PS3 before. Another method is to play them using Showtime, a media player that can be installed on a jailbroken PS3; it supports MKV natively. This method is better than my previous solution because on-the-fly transcoding is not necessary and hence, the fast forward and rewind capabilities of the video are not lost.

To convert my previous solution to this method, I had to install Showtime on the ps3 of course and edit my /etc/mediatomb/config.xml file (change the transcode line for mkv files back to x-matroska). In addition, I did a forced rescan of my files (removed directory and re-added it to database using the web interface) so that the new rules can be applied.

UPDATE – Using my Playstation 3 (PS3) as a media player (play mkv files and more)

I’ve been using mediatomb as a media server for UPnP devices such as the PS3. I definitely prefer XBMC to be on any device I use as a media player since I can play practically ANY media format (if the hardware can handle them, e.g., xbox can’t handle HD content) and I can stream from local computers via a Samba mount. However, it is not currently available on the PS3 and it might NEVER be available; see this post. With recent advances in the PS3 Hacking scene, I’m sure the Linux OS can be installed on my PS3, and some advance media player will come into fruition (XBMC? GeeXbox?). In the mean time, I’m stuck with Sony’s media player capabilities.

The Mediatomb + UPnP route for the PS3 is fine except for two major pitfalls:

  1. MKV files are not supported on the PS3, and
  2. New files in my “watched” folder might not immediately available since metadata are stored in a database.

Playing MKV files

Let’s attack the first issue first. After some searches and playing around, I found this post that outlines how one can remux MKV files into m2ts or mp4 files that can be played on the PS3. NOTE: On my Ubuntu 10.04 NAS, only the MP4 method worked for me (I don’t like this method though since AC3 to AAC conversion takes a few minutes; I also ran into a libfaac issue, and installing the extra libraries fixed it per this post). However, after updating FFMPEG following these instructions, the remuxed m2ts files can be played on the PS3. The m2kv2m2ts script makes this process as easy as mkv2m2ts video.mkv.

Before I figured out the previous method (fixed by using the latest version of FFMPEG), I hopped over to #mediatomb on the freenode to get help. “Alver” pointed me to this post, which is an update of this post. Basically, Alver wrote a script to transcode any media file on the fly so that they can be playable on the PS3. The drawback is that the video just plays (no fast forward, scene select, etc.) and that it can be CPU-intensive. Luckily, for MKV files, there is no real transcoding (only remuxing). The streaming of MKV files wasn’t an issue even on my 1.6G atom-based NAS. This will be my current method of streaming MKV files on the PS3 for now.

Setup:

  1. Make sure the latest FFMPEG is installed per these instructions.
  2. Copy the script from this page into /usr/local/bin/mediatomb-multifunctional.sh and make it executable.
  3. Clear out the entire database using the configuration website http://mediatomb:49152/ (replace mediatomb with the hostname or ip address).
  4. Backup /etc/mediatomb/config.xml (I use the daemon) and update it per this page. My config.xml is modified from this since Mediatomb 0.12.0 does not support version 2 of the config and I only want transcoding done on MKV files (my NAS is weak so I don’t want it to transcode everything, especially AVI files).
  5. Restart mediatomb (sudo /etc/init.d/mediatomb restart) and my directory to the database on http://mediatomb:49152/.

Here is my config.xml file:









MediaTomb
uuid:e099cf89-ce17-4558-8847-fea3393cf517
/var/lib/mediatomb
/usr/share/mediatomb/web


mediatomb.db


localhost
mediatomb
mediatomb





128
5
yes
no


*




UTF-8
ISO-8859-15

/usr/share/mediatomb/js/common.js
/usr/share/mediatomb/js/playlists.js

/usr/share/mediatomb/js/import.js
/usr/share/mediatomb/js/import-dvd.js



























































video/mpeg
yes






Add new files to database automatically

When adding a folder to be “watched” in mediatomb, use the “inotify” so that new files get added automatically. The files need to be world readable. I wrote a short script (MakeWorldReadable.sh) to do so:

#! /bin/bash

## Usage: MakeWorldReadable.sh /path/to/directory
for directory in "$@"
do
find "$directory" -type d -exec chmod 755 {} ;
find "$directory" -type f -exec chmod 644 {} ;
done

Added the following entry to crontab to have it updated every 30 minutes (20 and 50 minutes after the hour):

20,50 * * * * find /path/to/folder -type d -exec chmod 755 {} ;
21,51 * * * * find /path/to/folder -type f -exec chmod 644 {} ;

PS3 Media Server

I have not mentioned ps3mediaserver. It’s probably the most popular media server application to stream to the PS3 (or maybe even all UPnP devices). It’s based upon mencoder and FFMPEG (good), but written using JAVA to be cross-platform. It supposedly can stream and transcode any kind of media files. I don’t think it’s too appropriate since my NAS is atom-based; may be good for a more powerful server. I ran into issues trying to install it; didn’t give it more than 20 minutes though. I might try it some day.

UPDATE 12/31/2010

Just installed ps3mediaserver based on this and this. Assuming I pulled the latest sources from here and is in the the ps3mediaserver directory, I did:

sudo apt-get install mencoder ffmpeg mplayer vlc sun-java6-jre
JAVA_HOME=/usr/lib/jvm/java-6-sun ant
bash ./PMS.sh

The crappy thing about ps3mediaserver (to me) is that it is GUI-based. For server applications, I prefer daemons. See this post for how to make it a daemon.

UPnP Media Server for PS3 and others: MediaTomb

I wanted to get XBMC on my brother’s PS3, but since he has a PS3 slim, the “otherOS” feature was not available. However, Sony’s got to allow streaming to it right? Yep, via the UPnP (Universal Plug and Play) protocol.

I used this guide to set up MediaTomb. On Ubuntu, basically,

 <pre class="src src-sh">sudo apt-get install mediatomb mediatomb-daemon

## don’t do sudo mediatomb since I will be utilizing daemon sudo emacs -q -nw /etc/mediatomb/config.xml ## change to yes ## uncomment or add this line ## Next, go to http://server.ip:49155/ and add the location of the media

My PS3 didn’t see mediatomb. After debugging with the help of the author over at #mediatomb over on freenode, I found out that the wireless bridge the PS3 was plugged to did not pass over all udp unicasts. There were communications between the two but the connection was not established because there were missing pieces.

In the process of debug, I used cidero and wireshark and tshark (via apt-get) per the faq. Basically, using cidero with my laptop plugged into the wireless bridge, I could see mediatomb. Using the web browser on the PS3 I could get to the mediatomb web ui. Plugging the PS3 onto the primary router, I see mediatomb. Then I used tshark to capture the connection information when the ps3 is searching for a media server and sent the capture to the author and he couldn’t help me any further since it was the setup’s fault. Haven’t found a way around this wireless bridge yet, although I posted in the DD-WRT forum.