Category: Tools

If you are from Sweden or are watching swedish TV anyway chances are that you have come across subtitle files with the extension wsrt. I know I have, and with that, prepare for one of my unnecessary long rants where I try and explain things, if you are only interested in the converter tool you can find it here.

For those that don’t know SubRip or srt is a popular subtitle format for videos on the internet. wsrt on the other hand is not, in fact as far as I know the only sites that use it are SVTPlay and ÖppetArkiv, both of which are run by Sveriges Television. This leads me to believe that wsrt is probably an in-house format for subtitles that Sveriges Television use. Well, that’s great but what if you want to play them in an external player like say VLC or Emby? Then you are out of luck, it wont work because they don’t support the format.

Now here is the good part, wsrt just as the extension suggests is actually based on srt. In fact wsrt and srt files look almost identical but wsrt has a few extra features. Great, then I can just rename the file to have the srt extension and it will be fine you might be saying now, and well, you are partly right. For some players like for example VLC it will actually work but for some it won’t. The reason for this is a small but annoying change that was made to the time in the wsrt file format. Lets see if you can catch it.

00:00:42.640 –> 00:00:48.720
00:00:42,640 –> 00:00:48,720

Ok so the top one is in the wsrt format and the bottom one is in the srt format. The difference is very small but enough to make a lot of players out there say that no, I don’t know anything about this and if you are lucky just keep playing the video without subtitles or if you are unlucky, BAAM, the player will crash.

So what is the small difference, did you catch it? Ok, ok, I’ll tell you. In srt there is a comma, in wsrt this comma has been replaced by a dot. That’s it, well to be honest there are some other additions made to the wsrt format but they don’t seem to mess things up as long as you get those dots replaced. And replacing the dots, is an easy task, it’s just extremely time consuming. Considering the file I took the example from had about 5500 lines meaning there is probably about 1100 lines where you need to go in and replace the dot with a comma. There is no way that I am going to do that for every wsrt file I want to use, so how do we fix this?

Easy, we do a quick search and replace and all the dots will become commas. Ohh, wait maybe not, don’t most sentences usually end with a dot? Yeah, silly mistake you might think, there is no way that happened, unfortunately you would be wrong, I am that stupid from time to time. So now that we have established that how will we go about doing it then? It’s actually pretty easy, what we do is we search for all the dots that have a character after them and then we replace that dot with a comma. And we are done.

To make this process a little bit easier in the future I made a small web utility that does this for you, the tool is available for anyone to use on my tools page and the source has been released on GitHub. At the moment the tool won’t do anything about the other improvements to the format, I might go back and add that later but it isn’t really a problem as far as I can tell so probably not.

Update: The tool will now also remove other wsrt specific meta data. I think all of it will get removed but if you should find anything that gets left please leave a comment and let me know so I can fix it.

Update 2: Apparently some players can’t handle files encoded in UTF-8. Should you get some weird characters when using the text try to encode it with windows-1252 instead. I added an option for this to the tool, I also fixed a problem with the file name that occurred on Firefox.

Search for:

About

Patrik JohanssonProfessional System Administrator
Working with a wide flora of systems but with a focus on Configuration Manager (MEMCM/SCCM).

Passionate about Powershell and building tools that are easy to use for everyone.
In my spare time I work on other coding projects as well, mainly Booksonic