Author Topic: Read .ass or .srt subtitle files in /data/movies?  (Read 2401 times)

0 Members and 1 Guest are viewing this topic.

Read .ass or .srt subtitle files in /data/movies?
A friend of mine needs help with this:

We are translating FreeSpace 2 and we are now with the cutscenes:

Is there any way to make FSO 3.6.10 read .ASS or .SRT subtitle files inside /data/movies, assuming that the OGG cutscenes are present in that directory?

He is putting subtitles to the FS2 ogg cutscenes, coverting them to AVI, add subtitles, then back to OGG, or something like that. But it seems it's hardly difficult to do that. He asks if you could make the FSO launcher use an external player, or make it use external codecs like Vobsub so there is no need to build up a new OGG file with the subtitles inside. In esence, so we can just put subtitles files inside the directory with the OGGs.

Excuse my english, but it is i don't know even what i'm saying... i dont know about codecs and OGGs and all that  :p. I'll translate to him your answers.
Working on the Freespace 2 spanish translation. In case you want to play the game in castillian, click here. You'll need some spanish there, though, sorry :p

If you want your mod/campaign translated to spanish, please PM me or send me an e-mail message.

I could translate from spanish to english too, if you want, but it wouldn't be perfect, not at all. For spanish->english translations comes better an english native with spanish knowledge.

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Read .ass or .srt subtitle files in /data/movies?
FSOpen used to support avi files, but that was removed. The reason for that, ironically, was to remove the necessity for external decoders.
As for direct subtitle support, I'll let the coders handle that one...
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Mongoose

  • Rikki-Tikki-Tavi
  • Global Moderator
  • 212
  • This brain for rent.
    • Minecraft
    • Steam
    • Something
Re: Read .ass or .srt subtitle files in /data/movies?
I don't know this for a fact, but I highly doubt that the .ogg player code currently in the engine supports playing external softsubs.  As you said, at least for the moment, your best option would probably be to re-encode the cutscenes and add in hardsubs.  If you do go that route, I'd recommend trying to encode from the original .mves if you can, to avoid as much quality loss as possible.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Read .ass or .srt subtitle files in /data/movies?
could code not be added to display text from a file at various timestamps in the video playback?
like:
$time: 123
$duration: 2
$text: some translated text
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Tomo

  • 28
Re: Read .ass or .srt subtitle files in /data/movies?
Nuke, the ASS and SRT files are both text file formats that look very much like that.
Unfortunately, neither of them are proper, fully documented standards, although both are supported by VLC to some extent.
ASS appears more flexible, but SRT is much easier to parse so SRT is probably the better option to support initially:

Example SRT file:
Code: [Select]
1
00:02:17,440 --> 00:02:20,375
Senator, we're making
our final approach into Coruscant.

2
00:02:20,476 --> 00:02:22,501
Very good, Lieutenant.

So, I have a question.
Can this already be done in a script?
- This is the most logical place, as it allows different formats to be easily supported.
- However, it will require a hook when a Video is started allowing access to info about the video (filename, codec, playback size etc), plus hooks per frame of Video playback, and obviously the ability for LUA to read and write to the framebuffer used during playback.
- Do such hooks already exist?

If they don't already exist:
- Are there any other uses for hooks here?
- If there aren't any, then is it better to add the hooks and presume that somebody will come up with other usage, or is it better to add support for SRT directlky into the code?

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Read .ass or .srt subtitle files in /data/movies?
the format would be different but the idea is the same. then the timestamp ($time:) is passed during playback a subtitle ($text:) is displayed for ($duration:) seconds. of course youd probibly count time by miliseconds instead of seconds because it would look better and would be easy to read. the engine would just have to parse the file when the movie is loaded, and render text during playback. somone just needs to code it.

as for lua capabilities i dont think it has any interface to the cut scene system. you would need a hook that is run during movie (every frame or every few frames) playback, and a lua function to get the current playback time. if a time stamp from the file is passed then its corresponding text will be displayed. you would also need some way to determine what language subtitles should be displayed.

as for a parser a lua table parser already exists so thats trivial. regaurdless the engine needs to have more stuff added to lua.cpp before that can be done. you also have the issue of multiplayer compatability. you might add h script to the media vps, but it would have to work flawlessly and with other scripts. it might turn out that it would be better to jus do this all in c, using a tbl like format.
« Last Edit: August 15, 2009, 09:53:22 pm by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 
Re: Read .ass or .srt subtitle files in /data/movies?
Thank you guys for your answers!  :yes:
Working on the Freespace 2 spanish translation. In case you want to play the game in castillian, click here. You'll need some spanish there, though, sorry :p

If you want your mod/campaign translated to spanish, please PM me or send me an e-mail message.

I could translate from spanish to english too, if you want, but it wouldn't be perfect, not at all. For spanish->english translations comes better an english native with spanish knowledge.

 

Offline Tomo

  • 28
Re: Read .ass or .srt subtitle files in /data/movies?
the format would be different but the idea is the same.
Bad idea. We should pick an existing format and use that instead of inventing our own, because then there are already many tools to both create subtitle files and test them.
(If we did invent our own, then it should use video-industry standard hours:minutes:seconds:frames, but then we have the argument about whether its PAL or NTSC, and in the latter case drop-frame (30FPS except 1 second of video is longer than one second of reality) or non-drop-frame (30FPS and miss out certain frames). Life in TV is irritating...)

The best would be a properly-specified existing format, but failing that SRT will do.

as for lua capabilities i dont think it has any interface to the cut scene system.
Shame. Thought so though.
« Last Edit: August 16, 2009, 02:03:27 pm by Tomo »

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Read .ass or .srt subtitle files in /data/movies?
you dont need no tools, just a video player that dispays time. first you come up with a transcript of everything in the video, then you match it up with the time stamps. its a lot like tagging mp3 files for karaoke (which ive done successfully with notepad).
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN