Convert Matroska mkv video to PS3 m2ts container file format

Converting Matroska file format to m2ts for use on PS3 has number of advantages. PS3 is able to play mt2s directly from the USB or m2ts file can be copied directly to PS3 it self. There is also way to transcode matroska mkv format with some media server such as “PS3 Media Server”. However the disadvantages are that you need to have yet another PC on every time you want to watch and fast rewind forward does not work properly if you do not have fast network and CPU.

If we want to convert mkv to m2ts and yet avoiding propriety software and use Linux, the easiest way is to use mkv2m2ts.sh shell script created by Brian Kulyk. Using mkv2m2ts.sh script is simple, however installation of all pre-requisites to get the script running may be little bit tricky especially if your current Linux distribution does not include tsMuxeR and media mediainfo tools. In this article I’m using chroot debian-sid environment to get available prerequisites from Debian sid and multimedia repository and compile mediainfo from source code. If you do not have chroot debian-sid installation follow this simple chroot tutorial.

Add debian-sid multimedia repository

First we need to download Debian multimedia keyring and install it with dpkg:

# dpkg -i debian-multimedia-keyring_2008.10.16_all.deb 

Use your favorite text editor and add following line into /etc/apt/source.list file:

deb http://www.debian-multimedia.org sid main non-free

Install prerequisites available from debian repository

# apt-get update
# apt-get install tsmuxer bzip2 aften mkvtoolnix libdca-utils faad vorbis-tools

Compile mediainfo tool

before we can start compilation of mediainfo package we need to download a source code.

Extract, compile and install mediainfo software:

# tar xvjf MediaInfo_CLI_0.7.33_GNU_FromSource.tar.bz2
# cd MediaInfo_CLI_GNU_FromSource
# ./CLI_Compile.sh
# cd MediaInfo/Project/GNU/CLI && make install

Get mkv2m2ts.sh script

# wget http://mediatomb.equateuk.com/scripts/mkv2m2ts/mkv2m2ts.sh
# chmod +x mkv2m2ts.sh

Convert matroska mkv to m2ts format

./mkv2m2ts.sh mkv_matroska_format.mkv