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.

Split, cut, or sample a video file on the command line

There are many reasons to cut or split a video file. For example, one may want to cut a long video into multiple parts to upload to YouTube. I first ran into this and this, which suggests:

 <pre class="src src-sh">ffmpeg -ss 00:00:00 -t 00:01:00 -vcodec copy -acodec copy -i in.avi out.avi

## -ss: start position ## -t: end position ## can re-encode with other codecs

However, for some reason my out file is almost as large as my in file, even though I’m only sampling 1 minute out of the 2 hour segment. This lead me to the mencoder solution:

 <pre class="src src-sh">mencoder -ss 00:00:00 -endpos 00:00:01 -ovc copy -oac copy in.avi -o out.avi

The file size of my out file is more reasonable, and the speed is incredibly fast since I am not re-encoding.

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.


  1. Make sure the latest FFMPEG is installed per these instructions.
  2. Copy the script from this page into /usr/local/bin/ 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:










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 ( to do so:

#! /bin/bash

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

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 ./

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.