Use .srt (subRipTile) or SSA (SubStation Alpha)

olihya's icon

Hello,
I want to use .srt (subRipTile) or SSA (SubStation Alpha) to add subtitles on video.
I know that Quicktime pro let see a movie with srt subtitle. The srt subtitle must have the same name with the movie in the same folder.
Jit.qt.movie uses Quicktime so we can use srt .
But i only have the free version of Quicktime which don't work with subtitles.
Is there an other solution to do it?
Best regards

olihya's icon

Hello,
I have try with quicktime pro but it don't work.
I suppose that i should use Perian but it only work on Mac and i'm on Windows.
Is there an other way to use .srt (subRipTile) or SSA (SubStation Alpha) to add subtitles on video.
Is my question right or not?
Because nobody answer to me.
Have a nice day.

Christopher Dobrian's icon

I'm pretty sure I'm correct in saying that jit.qt.movie doesn't provide any particular help to you in dealing with .srt files, but you can write a program that synchronizes a .mov with a .srt. The .srt format is just plain text and very simple to parse. I think you could build your own in roughly the following way.

Use the text object or the js object to read in the .srt file. The js object would be my choice because you could also use it to parse the file, translate the timecode into QT timescale units, etc. Load the .mov into jit.qt.movie and query its timescale units with the 'gettimescale' message. You'll need to use that value in order to convert the .srt timings into timescale units. As you play a .mov file in jit.qt.movie, you would need to continually poll its current time (in its native timescale units) by sending it the 'time' message. When the movie time equals or surpasses the start time of a subtitle, trigger the display of that subtitle, and when the time equals or surpasses the stop time of the subtitle trigger the end of the display of that subtitle and start looking to display the next one. By "trigger the display" I mean write the text of the subtitle into a jit.lcd object then composite that on top of the movie (using jit.op @op + or jit.alphablend), or another way would be to write the text into jit.gl.text2d and render that on top of a jit.gl.videoplane that is showing the movie.

I guess that's a verbose and complicated explanation. I don't have time to write an example program, so I hope it's clear. I don't think it's hard to do, but you do pretty much need to build it from scratch, I fear.

olihya's icon

Thank you Christopher, now i see a way to do it.
Best regards.

olihya's icon

Hello,
I have made a patcher but i'm lost to convert the srt file and to synchronise it with the video.
Am i on the right way?
Can someone help me?
Here is my patcher and my srt file:

Max Patch
Copy patch and select New From Clipboard in Max.

Have a nice day.

889.subtitle.srt
srt
olihya's icon

Hello,
Is my question poorly worded?
Have a nice day.

olihya's icon

Christopher,
A little help for the JS Object?
Best regards