Play MKV on the PS3 For Free
Monday, 2009-11-23 20:01, 1259006487 seconds since Unix epoch
Okay, I’m getting just about sick of all of these half-assed solutions out there. I’ve done some research and I’ve made a script that usually works. It converts a H.264/AC3 MKV file to H.264/AAC. I’ve also downsized the AC3 to 192Kbit/s AAC stereo, because almost nobody has proper 5.1.
The script does make some assumptions, but it’ll work for almost 99% of the content out there. You can download it here or copy-paste from this piece of code. Oh, you’ll need some tools as well. Those would be mkvtoolnix, gpac and ffmpeg on Debian. Can’t find the packages you need? Debian-Multimedia might help.
#!/bin/bash
if [ -z "$1" -o -z "$2" ]; then
echo "Usage: $0 movie.mkv movie.mp4"
exit
fi
FPS=`mkvinfo "$1" |grep -m 1 fps | awk ' { print $6 }' | sed 's/(//'`
echo "Detected $FPS fps first stream"
mkvextract tracks "$1" 1:/tmp/mkv2ps3.264 2:/tmp/mkv2ps3.ac3
ffmpeg -i /tmp/mkv2ps3.ac3 -ab 192k -ac 2 -acodec libfaac /tmp/mkv2ps3.aac
MP4Box -new "$2" -add /tmp/mkv2ps3.264 -add /tmp/mkv2ps3.aac -fps $FPS
rm /tmp/mkv2ps3.{264,ac3,aac}
Edit: If you’re having trouble with double free or memory corruption errors at the end of the script, you’re using a broken gpac. Here’s a little something to get yourself a functional MP4Box. Run as root:
cd /usr/src/ cvs -z3 -d:pserver:anonymous@gpac.cvs.sourceforge.net:/cvsroot/gpac co -P gpac cd gpac chmod +x configure ./configure --static-mp4box make cp bin/gcc/MP4Box /usr/local/bin
Bert Says:
U also ave to install zlib1g-dev ( apt-get install zlib1g-dev )