I’ve used mkv2vob sometimes to convert my .mkv files to either a .vob or .m2ts file that my Playstation 3 console can play. Why? I’ve hooked it up to our big screen (well actually a projector) and surround system in my loft and so I thought it would be easier if I could watch all my media on the PS3 instead of switching between that and a PC. That may sound lazy but I really do enjoy the XMB interface and using the controller to navigate through folders etc. It just feels right.
The only problem with mkv2vob is that I have to manually add the files/folders I want to convert and I’m a guy that enjoys when things can run automatically. Mkv2vob does not have a command-line interface which makes running it from within a script or another application really difficult. So I began searching through the forums only to discover that it’s a feature request and intended for later; also the source code for the application isn’t available at this time.
I’m a software developer, self-taught in C# and other programming/scripting languages so I thought I might give it a try to write a command-line application that can do what mkv2vob can — so I can implement it in future projects for automating the process of converting media files. I attempted to write something similar maybe a year before but I never got anywhere because I didn’t know how I would fix the .h264 streams to work with the PS3. Back then you could and you still can use a tool called h264info that you could input the .h264 file and specify fps etc and it would add the necessary parts to the h264 file so the PS3 can read it. It would allow you to change the H.264 profile (PS3 won’t handle H.264 level 5.1 properly). I encountered the same problem, there was no command-line interface for h264info and I was unaware of any other methods at the time so I gave up after trying to rewrite h264info in C#.
This time around things are different. Thanks to a great tool made by SmartLabs called tsmuxer I can now do all of the necessary things to make a .mkv work on PS3. tsmuxer can demux .mkv and provide the same functionality as h264info in regards of fixing the .h264 parts and mux it back together as a .m2ts file which can be read and played back by the PS3. This made my work much easier.
I made a tool I call ps3m2ts (orginally ps3video but it might have been confusing with PS3 Video 9 etc). The tools used are actually the same tools found in mk2vob except that I don’t use mencoder or the dts applications provided with mkv2vob (yet). That’s the only minor setback with my tool as of now. If the media file contains a DTS stream it converts it to AC3 so you’ll know it will work. I haven’t figured out the DTS thing that mkv2vob does yet, but then again I started developing this tool three days or go.
I use this tool to extract information from the .mkv file, what video streams and audio streams are available and what codecs they use, FPS and etc. This is most useful.
As mentioned, this is the holy grail, the main tool used. If your .mkv contains a .h264 and AC3 audio this is the only tool used in the process of converting because it demuxes, fixes and mux the files back together all by itself.
This tool is used for converting the .dts audio stream to .ac3 so it can easily be played back on the PS3.
A part of a set of tools, mkvtoolnix; this tool is used to extract the different tracks (files) contained in your .mkv file. This is only used when there’s a .dts audio stream because we need it to convert it to .ac3
If you want to create your own little tool for doing the same thing I did tsmuxer needs a META file to be created containing the information required so it can do it magic. The .meta file tells tsmuxer what options and what input files to be used. Here’s an example .meta for the movie Eurotrip:
MUXOPT –no-pcr-on-video-pid –new-audio-pes –vbr –split-size=4GB –vbv-len=500
V_MPEG4/ISO/AVC, “EuroTrip.2004.AC3D.720p.HDTV.x264.mkv”, fps=23.976, level=4.1, insertSEI, contSPS, ar=As source, track=1
A_AC3, “EuroTrip.2004.AC3D.720p.HDTV.x264.mkv”, track=2
The first line contains muxing options (I got these from the tsmuxer-GUI) except for the –split-size=4GB where you can specify if you want tsmuxer to split the file if you plan on copying it to a FAT32 drive where the max filesize is 4GB. So very useful. I don’t use the split options as I use a media server to stream it from my computer.
The next two lines specify the input files and the options. The format is as following:
<code name>, <file name>, <parameters>
The code name is the Codec ID we get from Mediainfo, in this case it’s AVC (H264), the file name and the parameters. A full listing of the different parameters and mux options you can go to this site and read up. The important ones to use when creating a .m2ts for playback on the PS3 is
level=4.1 — If the level is higher than 4.1 use this so tsmuxer can change the profile level to 4.1 which is playable on the PS3
The other parameters you see like fps should be straight forward. We get this from Mediainfo and pass it a long so we hopefully won’t get wrong framerate and mess up the result. You also see track=ID parameter which is used if you don’t use external file but just want to use a track in the original .mkv. Save your file as something.meta and launch the tsmuxer
tsmuxer.exe something.meta output.m2ts
tsmuxer can output to m2ts, ts, Blu-Ray Disc or AVCHD folder.
This is a very long post, and I’m sorry you had to read until the end to get your hands on my tool but hopefully you have learned something (or not). Either way I give you the Binary and source versions. It’s written in C#, .NET version 3.0
To use the application
ps3m2ts.exe “file” [split]
Hopefully this application works for you, if it doesn’t give me a comment or send me an e-mail to me at henningms at gmail.com. If you’re a software developer hopefully you can improve upon the code and give me tips and ideas, it’s still a work in progress but all help is welcome. Join me!
Thanks for your time