View Full Version : Join multiple subtitle streams (.idx+.sub)
ai4spam
16th September 2005, 08:00
I have multiple subtitle streams as <movie>.<language>.idx and <movie>.<language>.sub. Is there any program that would "join" them into a single <movie>.idx and <movie>.sub>?
Matthew
16th September 2005, 08:07
Errr, vobsub joiner, included in the vobsub package will do it.
Personally I like the cli:
rundll32.exe vobsub.dll,Joiner %DIR%\CD1\%CD1NAME% %DIR%\CD2\%CD2NAME% %DIR%\%NAME% %CD1LEN%
where CD1LEN is, say, 01:07:55.045
ai4spam
16th September 2005, 08:08
It's not for multiple CDs, it's for multiple languages of the same CD. Will it work?
Matthew
16th September 2005, 08:12
Oops, I suck. Sorry ;o
I don't know of any program that will do that - doesn't mean there isn't one though.
Only thing I can think of is sub/idx->sup->MuxMan->sub/idx. That will work, but it is a long way round.
ai4spam
16th September 2005, 08:18
Thanks for the reply. What do you use for sub/idx->sup and back?
Matthew
16th September 2005, 08:24
The only app I know of that will do sub/idx to sup is dest's vsconv.exe
see the attachment here: http://forum.doom9.org/showthread.php?t=100098
Then you can use muxman to put the sups into VOBs (I use a bmp still with long duration). And then finally use vsrip.exe on the VOBs to get back to sub/idx. This is all scriptable (albeit a bit messy), if you wanted to do it regularly.
I just realised there are potential pallete/colour issues though, you can tell that from the idx I suppose.
ai4spam
16th September 2005, 08:35
Well, the simple thing (based on the .idx file format) would be to just join the sub files and change the file offsets in the idx files. It would only take me half an hour to do, but that's half an hour I don't have. I was hoping someone did this already.
richardlfyang
23rd September 2005, 04:14
I tried so many times to joint the two sub (each one contains one language) together, then modify the index file by hand, but it seems not work properly! One language can be fairly displayed, but when I select the other one, it's not working!!
Appreciate someone can give me some instructions! TKS in advance!
ai4spam
23rd September 2005, 18:26
That's because you have to update the file offsets for the secoond language stream. Again, doable in an hour or two, but I have no time for it.
richardlfyang
24th September 2005, 01:16
I have manually update the file offsets for the second language, and I'm sure this was done properly! But it's still not work!
Have you ever done this sucessfully? Theoretically speaking, it should be OK.
BTW, there is a simply way to modify the offsets within 5 minutes. ;)
ai4spam
24th September 2005, 01:49
No, I haven't. And 1-2 hours was for writing an application to do it.
lordyu
24th September 2005, 13:15
You also need to make changes to the sub ID in every single subtitle block in each .sub file. For example, if the first language in .idx has ID=2 then it must have ID=0x22 in .sub. If the second language in .idx has ID=5 then it must have ID=0x25 in .sub. There is a small program which can do this. It's called VobSub ID Adjuster. Not listed on here so ask Google. However, this VobSub ID Adjuster doesn't adjust the sub offsets in .idx for you. It only adjusts the sub ID in .sub (and .idx). Once that's done you have to concatenate the two (or more) .sub files together and merge the sub offset entries together before adjust each of the offsets in final .idx manually (as I guess you have already done). The resulting .idx+.sub will work with DirectVobSub on Windows but I don't know if it will work with standalone players. Anyone with Pioneer or other players like DV-575A that can play .idx+.sub can try. That's because normally multiple sub languages are muxed together in this way (VobSub and VSRip's way of creating multi-language .sub):
language 1 subtitle 1, language 2 subtitle 1, language 3 subtitle 1, ...,
language 1 subtitle 2, language 2 subtitle 2, language 3 subtitle 2, ...,
...
and not in this way (your way of merging two or more .sub files):
language 1 subtitle 1, language 1 subtitle 2, language 1 subtitle 3, ...,
language 2 subtitle 1, language 2 subtitle 2, language 2 subtitle 2, ...,
...
If it doesn't work with standalone players, then you will have to re-arrange the subtitle blocks in .sub in the correct way and also the sub offsets in .idx.
We have many applications that can do almost everything to .idx+.sub except this merging thing. We have a program called VobSubStrip that can demux multiple-language .sub into several .idx+.sub files. It does adjust the sub offsets but doesn't change the sub IDs. Only thing missing is something that can do the reverse. That is to merge .idx+.sub files and adjust both sub IDs and sub offsets. I've been waiting for this for ages and I am sure others must as well have. Unfortunately, I am not good at programming. It would take weeks or months for me. Someone with good programming knowledge should create one. It should take no more than 2 hours. :D
ai4spam
24th September 2005, 17:33
@lordyu: thanks for the info.
1) Well, depends what program was used for ripping. I've seen subs that keep their IDs, even in separate idx/sub files, so changing the language index would not be a necessity. It would be a nice feature, though, for people wanting to set some other language as the default.
2) Actually, I've seen subs done both ways. Just look in SubRip, when ripping: some subs go from 0 to 100% when doing OCR, others only do OCR in some interval, like 0 - 50% if there are 2 subs, then just skip through the other 50%, so "my way" should be ok.
Can anybody with a hardware player check if it works with both types of subtitles? Again, to know which type you are dealing with, use SubRip and look at how it does the OCR, or look at the idx file and see if the file offsets for 2 separate sub streams are interleaved or not (basically, see if the last file offset of the first sub is less than the first file offset of the second sub).
lordyu
24th September 2005, 18:50
Hi, ai4spam.
1) When we do ripping, I think most programs do keep the original IDs in .idx+.sub. I guess it's easier to do it that way than to change the ID. Just like when we split one set of multi-language .idx+.sub into several sets of single-language .idx+.sub, the resulting sets of .idx+.sub will have original IDs. As for setting other language as the default, this can be easily done by modifying one line in the .idx. I think it is the line langidx: 0 (if we are talking about the same thing here).
But allow me to say this, .idx+.sub isn't just about ripping. The problem we are having today is when we want to create a new .idx+.sub. For example, you might want to translate subtitles into your language (which isn't included in the original subs). Some might say go download .srt from subtitle websites or just create .srt yourself. But there are problems with .srt and other text-based subs. Especially on standalone players. Problems like fonts too small, fonts too big, subs not properly positioned on screen, etc. Languages using none-latin script are also a major problem. For example, I haven't seen any standalone players having all thousands of Chinese characters stored in the firmware in order to be able to display text-based Chinese subtitles. Same goes for Korean, Japanese, Thai, Arabic. Perhaps these problems are the same problems that forced DVD subtitles to be graphic-based instead of text-based when DVD-Video was introduced.
Some might say text-based is better, more flexible. But some might say graphic-based is better, also same reason, more flexible. I guess there are arguments for both.
At the moment, standalone players that can play .idx+.sub can only have one set of .idx+.sub if I am not mistaken. Within that .idx+.sub there can be more than one languages. Text-based subtitle files can be there more than one file though. I guess when this limitation is overcome in a firmware upgrade there will be no need for merging several sets of .idx+.sub into one. Unless there are other reasons for merging which I can't think of. But then again some might want to have it all in one set. Some even want to have all video stream(s), audio streams, subtitle streams in one single file like those MKV lovers. I personally don't think subtitle streams needs to be multiplexed with the video and audio streams because subtitle streams are very small compared to video and audio streams.
So I guess it's up to you or anyone else with the knowledge and programming skills reading this to decide whether merging is necessary or not. Maybe this is why no one has created such thing during all these years. But I'd say it would be a great contribution to the community if one is created. :D
2) I'm not sure what you mean. But I think because of the DVD subtitles are multiplexed in the first way so VobSub chooses to stay the same.
multicone
24th September 2005, 19:10
You can append them like this :
1. Mux the subs into a MKV. I dont know if a video stream has to be in a MKV file, but i dont think so. If so, you can also do it by using any video stream you like, but of exactly the same duration as the vobsubs
2. Append the two MKVs (using amg or mmg), irrespective if they contain video + subs or only subs
3. extract the vobsub track from the final MKV with mkvextract. result is a single vobsub file
lordyu
25th September 2005, 12:29
Hi, multicone. I am not that familiar with MKV or its tools but I've tried what you recommended.
1. Using MKVMergeGUI, I first added .idx (1st language) and then muxed it to create a new MKV file with only 1 track -- subtitle track. Then I did the same with 2nd language .idx and got another MKV file with 1 track.
2. Using MKVMergeGUI again, I added the 1st MKV file and then added the 2nd MKV file and then muxed them to creat a new MKV file.
3. Using MKVExtractGUI, I opened the MKV file from (2). I saw two subtitle tracks. I then extracted them and got two sets of .idx+.sub.
That's not what we want here. But then I noticed you said append in step 2. So I tried step 2 and 3 again.
2. Using MKVMergeGUI, I added the 1st MKV file and then appended the 2nd MKV file and then muxed them to creat a new MKV file.
3. Using MKVExtractGUI, I opened the MKV file from (2). I saw one subtitle track. I then extracted them and got one set of .idx+.sub.
But this .idx+.sub is in one language. As if you concatenated two sets of .idx+.sub. Which is again not what we want here.
So I think append in MKVmergeGUI doesn't mean merge but it means concatenate. But as I said I'm not familiar with these tools, so please clarify.
Cheers!
multicone
26th September 2005, 21:21
Sorry i misunderstood the purpose
richardlfyang
27th September 2005, 00:37
Hi, Lordyu,
I have searched "VobSub ID Adjuster" in internet, but there is no single website contains this software! :(
Abond
27th September 2005, 09:03
For me the easiest way would be to convert idx/sub to sup using sub2sup, then to author (fake)DVD with all languages and at the end to rip all subtitles with vobsub as one idx/sub file. It will take time ofcourse.
lordyu
27th September 2005, 10:31
@multicone: I thought you might. ;)
@richardlfyang: Search for VobSubIDAdjust that's the name of the file the other is the name of the program. ;)
@Abond: Yeah, that's how I do it. The time-consuming part is when you have to convert the whole video from MPEG-4 to MPEG-2 first. Then the muxing.
Abond
27th September 2005, 11:53
Well, I thought about not relevant video (if you have one), even black frames produced with avisynth (should not take too long to encode to mpeg2) with suitable resolution (352x288/240 should be fine) and duration that is why I wrote fakeDVD - the goal is to take the subtitles back only.
lordyu
27th September 2005, 12:28
Yeah, I know what you mean. I used to try DVD Shrink with still image only as video but IfoEdit had some problems muxing. I'll try your trick next time. :)
Matthew
27th September 2005, 23:35
If you use muxman you can specify a bmp only - no encoding necessary. And the whole process is scriptable. I know because I've used it for srt->sup->vobs->sub/idx->bmp/sst (all automatic - and fast).
In this case it would be sub/idxs->sup->vobs->sub/idx.
ai4spam
28th September 2005, 05:43
well, when do we see a script?
Matthew
28th September 2005, 07:24
How can I post something that doesn't exist? My point merely is that it's the best (IMHO) way of doing this without requiring programming skills or an understanding of the VobSub format (this does not apply to you, obviously). Even as a one off, MuxMan's GUI can be used for sup->vobs easier than other apps (set a bmp to duration of 5 hours and the vob is only ~75 MB).
What I have is what I need, a sup2sst batch file for a single sup, and it would need to be modified to account for multiple sups and the palette issue (the latter could be a real irritation, unless one went down to sst/bmp instead of just sup, thereby ensuring a consistent palette).
richardlfyang
28th September 2005, 08:50
Hi, Lordyu,
Many thanks for your help! I have merged two sub successfully according to your instruction! It's really do a pretty job! :) :)
lordyu
28th September 2005, 13:19
@richardlfyang: You are welcome. :)
@Matthew: Nice. I didn't know MuxMan could do still image. Works great! By the way, what did you do with srt->sup->vobs->sub/idx->bmp/sst ? Can't MaestroSBT help reducing the ->sup->vobs->sub/idx-> so that you only need srt->ssa->bmp/sst ?
lordyu
28th September 2005, 13:24
That's because normally multiple sub languages are muxed together in this way (VobSub and VSRip's way of creating multi-language .sub):
language 1 subtitle 1, language 2 subtitle 1, language 3 subtitle 1, ...,
language 1 subtitle 2, language 2 subtitle 2, language 3 subtitle 2, ...,
...
and not in this way (your way of merging two or more .sub files):
language 1 subtitle 1, language 1 subtitle 2, language 1 subtitle 3, ...,
language 2 subtitle 1, language 2 subtitle 2, language 2 subtitle 2, ...,
...I was wrong there. VSRip uses the second way while VobSub uses the first way. I guess both can play fine on standalone players.
Matthew
29th September 2005, 00:36
Can't MaestroSBT help reducing the ->sup->vobs->sub/idx-> so that you only need srt->ssa->bmp/sst ?
MaestroSBT does not support cli. Plus there is an issue with flow anyway, I want to be able to take a supplied sup and convert it to sub/idx using the same procedure :)
zion302
20th March 2006, 08:28
I have multiple subtitle streams as <movie>.<language>.idx and <movie>.<language>.sub. Is there any program that would "join" them into a single <movie>.idx and <movie>.sub>?
This is exactly the tool I have been looking for ages.
http://forum.doom9.org/showthread.php?t=78718
thanks Lordyu and others provided some useful information regarding the .idx/.sub format. I finally made a small tool using VBA, it works great... to merge all subtitle streams contained in two different VobSub files into a single VobSub file (.idx/.sub). I used VBA just simply for the reason I used it quite often for the work.
The only issue is the subtiltle colors. normally two source subtitle files contain different pallete, however, we have to live with one of these two for the output resulted from merge.
Tested okay on Subresync and MPC. Will test the merged subtiltle in stand-alone player.
I am thinking about a tool to do one-step merge from .srt into a VobSub file to avoid going through all these different tool. Or even able to do batch mode.
Matthew
21st March 2006, 23:19
The only issue is the subtiltle colors. normally two source subtitle files contain different pallete, however, we have to live with one of these two for the output resulted from merge.
Each subpicture can only use four colours. Usually each subtitle stream will not vary as far as these are concerned.
But a DVD palette contains sixteen colours, so it may be technically possible to include up to 4 subtitle streams, each with their own palette. It would require editing the .sub files.
Whether this is feasible or not is another matter.
zion302
22nd March 2006, 08:56
...but, as far as I know, the actual 4 colors for subtitle stream will be choosed randomly from the 16 colors in palette. Within .idx file, there is a custom colors line, normally it is OFF, if turn it on, will that force the 4 colors used? They must be from the 16 colors specified in the palette line?
Matthew
23rd March 2006, 06:39
Randomly? I'm not sure where you got that idea.
sub/idx is a dump off the dvd so I assume it functions the same.
For DVD each subpicture includes 4 colours, and each colour in that subpicture is mapped to a specific item in the palette (0->15). Now it's possible that some subpictures in a subtitle stream use different palette mapping from others, but not usually (and it can be checked programmatically anyway).
I'm not sure what the deal is with custom colours, but lets say they correspond to bg pa e1 e2. What if these do not line up on 2 different subtitle streams, or even within different subpictures in a subtitle stream? I mean, what if in one subpicture the main text is represented as e1, but it is e2 in another?
zion302
24th March 2006, 02:52
http://forum.doom9.org/showthread.php?t=16498
Each dvd subpicture can have 4 colors chosen from the 16 color palette stored in the ifo file. There is no way tell which one of them addresses the outline, background or the filling color, it can be totally random.
For idx/sub, seems it always uses first 4 colors in the palette if it contains only one subtitle stream.
From my testing, Custom colors will effect for "soft" player on PC, hardware/stand-alone player will just ignor it even it is turned ON, same case with Origin setting (sometime just want to lower the subtitle as it shows right on the movie scene).
Have tested merged idx/sub file on my standalone MPEG-4 player, it works fine.
Cheers...
Matthew
24th March 2006, 03:36
For idx/sub, seems it always uses first 4 colors in the palette if it contains only one subtitle stream.
No that is not correct, the colours used can be any within 0->15.
All gabest is saying is that on one subpicture the main text may be represented by e1, but on another it could be represented by e2 (or pa or bg). [Scenarist/MuxMan label the four colours as bg, pa, e1, e2]. Which is what I said in my previous post. There is no way of knowing short of manual inspection. For this reason using custom colours is unreliable (without manual fiddling), and even within an untouched sub/idx could (in theory) lead to some subtitles being displayed incorrectly.
This may seem a bit confusing - because it is - but the golden rule is that each subpicture can differ in terms of mapping, colours, etc. That means the moment you use custom colours, or mix sub/idx from different sources, you run the risk of dodgy colours.
What you'll find is that in many (perhaps even most) cases you'll have no problems, but then one can come along that gives you grief, and the only way to solve it will be editing the mapping in the .sub. [Or extract to ssts that uses the Scenarist/MuxMan default palette and then author a dummy dvd].
With any luck you won't come across such problems. But process enough cases and it will likely happen. I've been there :)
zion302
24th March 2006, 04:21
Yes, each SPU has two bytes to define its 4 colors used. theoritically each subpicture can be mapped to any 4-color mix in the palette.
But I have never seen such subtitles in real life - one sub stream contains subpictures having different colors. What we normaly see is even different substreams in one idx/sub have used the same colors.
Cheers...
Matthew
24th March 2006, 05:03
But I have never seen such subtitles in real life - one sub stream contains subpictures having different colors.
I've seen that...although granted it is very rare.
What we normaly see is even different substreams in one idx/sub have used the same colors.
yes...if they are from the same dvd. But it's not so rare for subtitles from different dvds to use different colours. Often they may look okay though, e.g. because the colour is changed merely from yellow to white.
However, I'd never make publicly available an app that does not properly account for changing colours and differences in mapping.
ai4spam
26th March 2006, 07:26
SubRip uses statistics and heuristics to determine which color is which. If you can read Delphi code, you may want to take a look. It's not completely foolproof (it fails in some rare cases), but it does a decent job.
zion302
3rd April 2006, 11:13
have made a small program which is able to:
1/ merge two idx/sub files into one which contains all subtitle steams.
2/ detect palette mapped by each subtitle steam before merging, so that original palette is reserved in merged subtitle file, which means all subtitle streams will be displayed exactly the same colors.
will try to convert the code to Delphi. currently just used VBA for trial. Now it works fine for me.
cheers...
ai4spam
4th April 2006, 03:15
Google for a VB2Delphi application, I think there's some software that does everything for you.
kitsaros2000
5th March 2007, 23:15
i just made an tool for that .
You can find it here VobsubMuxer (http://www.trustfm.net/phpBB2/viewtopic.php?t=1442)
Tell me if you have problems ...
I do not tested on hardware players ... if someone make an test i am here !
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.