Monday, July 22, 2024
Username: Password:
Added by unreal
UPDATE! Now with preconfigured bundle for OS X! Read on...

In the same way we were able to play MKV content on a PS3, we are going to play 720p MKV content on an iPhone 4 or iPod Touch with Retina display without re-compressing the video.

The iPhone 4 specifications page shows that 720p H.264 Main@L3.1 content is supported, with AAC@160kbit/s sound, inside a mp4 container. That means we'll have a few tasks to complete before being able to play MKV files on the iPhone 4. To start with, we'll need to compress the original sound track (usually AC3 or DTS 5.1) into AAC, then we'll need to make sure the video is ML@3.1, and finally we'll remux the streams into a mp4 container.

As far as the video is concerned, the main problem is going to be that most HD TV series use L4.1 or High@L3.1 H264 content. For example, we can see my test file is using High@L3.1 using mediainfo:

$ mediainfo /usr/home/exports/file.mkv | grep Format
Format                         : Matroska
Format                         : AVC
Format/Info                     : Advanced Video Codec
Format profile                 : High@L3.1
Format settings, CABAC         : Yes
Format settings, ReFrames        : 3 frames
Format                         : AC-3
Format/Info                     : Audio Coding 3

The iPhone will not even try to play the H264 stream because it checks the header information for compatible profiles. That doesn't mean other profiles will not play, it justs means that Apple cannot guaranty they will. So, we will rewrite the header information to "fowl" the iPhone, which will work fine if the encoding options (mainly refs, bframes and b_pyramids) are not too high. I've done some testing and 720p videos with a 5 Mbit/s bitrate play just fine, and they look great on the high-def screen.

Practical work

We're going to use the MKV2MP4 conversion script, so download it here.

You can also download a special Mac OS X version containing all the necessary binaries by clicking here. Since this version is preconfigured, jump straight to the howto section.

Start by editing the script to force the header to MP@L3.1:


Before running the script, you'll need to install a few tools:

- mkvtoolnix
- FFMpeg with AAC encoding
- MP4box or MP4Creator

The script is really simple to use:

./ /path/to/file.mkv

The .mp4 files produced by the script will be saved to the same folder as the original mkv source file.

It is possible to specify a destination folder, which will be created if it doesn't exist:

./ /path/to/file.mkv /home/media

Now using iTunes, transfer the mp4 files to your iPhone 4 or iPod Touch (with Retina display).


- Oct 16 2010: first version
- August 14 2011: update with Mac OS X version

Posted on 18/10/10 at 14:37 - 0 Comments...

Added by unreal
The PS3: quite a capable machine

The PS3 is a very nice games console, but what really sets it aside are its media center capabilities. This article aims to explain how to make the most use of its HD playback option and is organized around the following tasks: installing a UPNP server and converting mkv files into a "PS3-friendly" format.

Installing a UPNP server

The PS3 can play audio and video files from its internal hard-drive, from a USB drive or even from a Website, however its UPNP client offers the most complete experience: network playback, nice user interface, copying of files to the internal disk...

To make use of this feature, one needs to install a UPNP server on the computer that has files to share. In this tutorial we'll be using uShare for simplified configuration and reduced number of required packages.

Start the UPNP MediaServer and the PS3 should display an icon in the "Video" section to access the shared content:


The PS3 should play seamlessly any avi/divx or mpeg content you own. However, should you attempt to play mkv content, the following error message will be displayed:


It is indeed impossible to play unmodified Matroska files on the console. However, since mkv is nothing more than an audio/video container, with H.264 video inside most of the time, we can change the container format without re-encoding the video stream. Without loss of video quality.

Mkv to PS3 conversion script

I have far too much spare time. So I developed a BASH script to automate the conversion process and generate 100% PS3-compatible (or so I hope) .mp4 files.

Go and grab the script, I'll wait while you download.

In order to use the script, you'll need a few tools:

- mkvtoolnix
- FFMpeg with AAC encoding
- MP4box or MP4Creator

The script is really simple to use:

./ /path/to/file.mkv

The .mp4 files produced by the script will be saved in the same folder as the original mkv source file.

It is possible to specify a destination folder, which will be created if it doesn't exist:

./ /path/to/file.mkv /home/media

So why use this script?

Even if the conversion principle is fairly easy to understand, real-world use is not quite so simple since the source media files are all different, the conversion programs can be complicated and there are various quirks and bugs here and there. The job of the script is to handle the various different cases to simplify and automate the conversion process.

It handles the following tasks:

- The PS3 cannot play files larger than 4GB so the script will split large media files as necessary
- Extracting of multiple AC3 or DTS audio sources and H264 video
- Re-compressing of audio to AAC
- The script will fix the H264 header to pretend the file is L4.1, should that be necessary
- ReMUXing to mp4
- Error handling

A few lines to finish

- The PS3 will play most 720p or 1080p H264 content, and the video quality is really impressive.
- Some versions of mp4box suffer from a bug which prevents files larger than 2GB being created. If you notice this bug, try to update mp4box or edit the "MAXSIZE=" line at the start of the script to allow splitting at 2GB.
- If you're having and problems, don't hesitate to leave a comment!


- 2009/05/01 - v1.03 MP4Creator support added

Posted on 18/10/10 at 12:11 - 0 Comments...