As someone pointed out in PM it seems another guy has already solved the problem so you can just use the
solution provided by him. i will try to provide a faster version when i got some free time. but in the mean time above method is sufficient to convert the subtitles.