Monday, September 27, 2010

Encounter with subtitles

Being a movie freak, I have over 300GB movies. And obviously watching them is favorite pastime.

Its was all going well until today. Today I was having a nice movie and no subtitles. I ploughed the subtitle sites but found only subtitle. And here starts the game.


The subtitles were in two parts. "CD-1.srt" and "CD-2.srt". It meant that they were made according to format of 2 CD pack. Both the subtitles started from time zero. But I wanted second one to start from time right where first subs ended. What should I do? Then something hit my mind (not literally) and I thought of C programming.


(I wish I could start this paragraph with "I took out a pen and paper and....." )
I opened the text editor and began programming. Google, TC help and everything assisted me and after an hour I was ready with program that

  • Read the subtitles from subtitle file
  • Find and change the time(in curly brackets)
  • Copied them to another file

Here is the Pic that will make it very clear what needs to be done.
















As you see, The program reads the upper sub file, just changes appearing time(in curly brackets) and writes it to another file shown below.


Here is the C program file.
Here is input file. Place it in same folder in which program is complied and exe file is generated (C:\TC\bin).


Next time....    There will be no next time.

1 comment:

  1. Woof... things going technical here..!!
    Definitely not for me but hey, you're doing good work...!! A sheer genius..!!
    Keep the good work up!!

    Love,
    niyati

    ReplyDelete