TMplayer to MicroDVD converter

One of my Christmas presents (that I bought myself) was WD TV Live Plus media streamer. I left my projector back in Warsaw (sniff) and I was tired of watching stuff on my 15” laptop. WD TV is a pretty neat little machine, it effortlessly plays every video I throw at it. The only problem I had was that it seemed to struggle with TMPlayer subtitle format which is very popular in Poland for some reason. It must be quite exotic everywhere else, because even excellent Subtitle Edit fails to recognize it (I wanted to convert it to something more sane). I didn’t really want to download yet another program just to convert subtitles, so I decided it’s a good excuse to hone my Perl skills. TMPlayer format is pretty trivial, basically single entry looks like: hh:mm:ss:Subtitle text as you can see, there’s no duration, so different players deal with it in a different fashion. Some just display subtitle until the next one kicks in, some show them for predetermined duration. Former ‘solution’ is quite annoying, so I went with the latter one. My target format was MicroDVD, mostly because it seemed the easiest. MicroDVD format operates on frames, not time and looks like: {start-frame}{stop-frame}Subtitle text We need to provide two arguments for converter - frames per seconds & milliseconds per subtitle character (so that it can calculate stop-frame). I also make sure that subtitle text ‘n’ doesn’t overlap with subtitle ‘n+1’. Not sure if it’s required, most probably player should handle it, but oh well, it’s 5 lines more. Whole script was maybe 15 minutes of work, but seems to do the trick just fine. If you’re one of those millions with Perl interpreter installed and urgently needing to convert TM->SUB (I’d like to see a Venn diagram for that), script can be found here.

In Europe it’s probably almost midnight now, so I’d like to close with best wishes to everyone! SzczÄ???liwego Nowego Roku, Happy New Year, Buon Anno, Gott Nytt ??r!

Old comments

mario 2012-12-30 23:46:04

I just went into the same problem.
I used Your script and modified it to recognize 00:00:01 format (no “:” at the end) nad finally could launch this particular subtitles with XBMC. Thanks again!
SzczÄ???liwego nowego Roku 2013!!!

admin 2012-12-31 01:18:57

Hah, that’s nice blast from the past. Good to know it was of some use. Happy New Year!