Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Alex Navarro on August 14, 2009, 03:16:06 pm
-
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.
-
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...
-
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.
-
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
-
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:
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?
-
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.
-
Thank you guys for your answers! :yes:
-
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.
-
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).