PDA

View Full Version : srt timings [from idx]


iNFO-DVD
27th June 2005, 22:59
I was thinking of incorporating a idx/sub to srt convertor in my program for external subtitles. The initial procedure seems quite simple except for one thing, timings......

srt subtitle files have a start and end time for display, idx/sub files just have a start time.

How can I find/obtain the required display timings from an idx file?

Anyone?

MeteorRain
28th June 2005, 08:24
well, i have no idx/sub files on hand now, but i think there *should* have the end time in the idx file.
while, if there's not, and you are hurried with this function, i give you a hint(not so good, but is not bad) that is, use the nearest next start time as this end time, and limit a sentence in 20 seconds. maybe it's not a bad idea.

good luck
MeteorRain

unmei
8th July 2005, 16:39
i think there isn't becaue the idx is probably only meant to faciliate seeking into the *.sub file. At least, the SPUs (sub-picture-units) in the *.sub file do contain durations. If you add this to the start time of the specific subtitle you get its stop time.

[edit]
either you use some component to read the sub which provides you the durations, or you will have to access the mpeg-2 stream stored in the sub file.

At the offset given in the idx file you should find the first PS packet with data of the SPU (unfortunately you need a primitive mpeg demux to assemble the entire SPU as it is packed into a PES packet which again is chopped up into several PS packets of 2048 bytes each). For the mpeg stuff, see a mpeg stream tutorial or the official specs. Once you have the SPU itself it gets IMO simpler since that is quite an "easy" structure (compared to mpeg *grr*).

D3s7
15th July 2005, 03:16
PTS time is stored in the IDX.... actual duration is calculated by grabbing each individual duration from the sp packet information (in the case of vsconv, if there is no stop, the stop time = next start -1 or 00:00:03:00 for the last sub packet). the PTS generated from vsrip is calculated in different ways, either a consistant addition from the start of the current vobid or from the start of the current vobid+pgc (in a pgc demux)

If you point me to specs for the srt file format, i'd be happy to add it to vsconv (already have added a few other format conversions)