PDA

View Full Version : sup2vobsub


emmel
26th May 2006, 18:43
Hi,

I just wrote a small proggy which transcodes IFO-edit subpicture files (.sup/.IFO) into VobSub-format (.sub/.idx). I guess the tool might be useful at least for people who use ProjectX to demux DVB-subtitles from ts-files.

Usage:

1) Demux your recording "clip.ts" with ProjectX to obtain
- video file "clip.m2v"
- audio file "clip.mp2" or "clip.ac3"
- subtitle files "clip.sup" and "clip.sup.IFO"

2) Transcode the subtitles into VobSub-format:

c:\wrk\> sup2vobsub -create clip

You should now have the VobSub-binary files "clip.sub" and "clip.idx". They should play ok as such with all soft-players with VobSub-support (MPC, VLC, mplayer,...).

There are some additional options available:

-delay int : delays the subs by int milliseconds
-decode : decodes subpictures into pgm-files
-palette int int int int : enforces palette
-alpha int int int int : enforces alpha channel

Sample:

c:\wrk> sup2vobsub -create clip -delay 1800 -decode -palette 3 2 1 0 -alpha 15 15 15 0

The additional switches will in this case enforce an 1.8sec delay, palette 3 2 1 0, and alpha challens (opacity) 15 15 15 0. The subpictures will be decoded and saved into pgm-files.

In the attachment you can find the source code of "sup2vobsub" and gcc-compiled executable for Win.

emmel

Kurtnoise
26th May 2006, 19:53
Funny...I was looking for a such tool. :) Could you host it also at http://www.mytempdir.com/ ?

:thanks:

emmel
26th May 2006, 20:22
Ok. done: http://www.mytempdir.com/693519

SeeMoreDigital
1st August 2006, 20:13
Given that MP4Box and YAMB now supports the muxing of VOBsub (.sub/.idx) subtitles is their any likelihood that somebody could make a GUI for this tool?

manusse
10th August 2006, 23:42
Hi emmel,

I have been playing a bit with sup2vobsub and with its source code.
I wanted to try something.
I think I may have found a bug (but I am not 100% sure). I would like you to check it if possible.

It's in this part of the code:
headers[23] |= ( ts[3] & 0xe0 )>>4 | 0x21;
headers[24] = ( ts[3] & 0x1f )<<3 | ( ts[2] & 0xe0 )>>5;
headers[25] = ( ts[2] & 0x1f )<<3 | ( ts[1] & 0xc0 )>>5 | 0x01;
headers[26] = ( ts[1] & 0x3f )<<2 | ( ts[0] & 0xc0 )>>6;
headers[27] = ( ts[0] & 0x3f )<<2 | 0x01;
http://dvd.sourceforge.net/dvdinfo/pes-hdr.html

According to this specification, the LSB of the PTS (33 bits), should be stored in bit 1 of headers[27] whereas it seems it is stored in bit 2 (<<2) in this code. Does this means that twice the value of the PTS is stored in the .sub file.

I've tried converting ripped subtitles (with Vsrip) to .sup applying the reverse formula and SubtitleCreator was seeing a wrong timing (half of the normal timing values). I then modified the formula (PTS LSB in headers[27].b1 instead of b2) and it worked.

However, now the timings are wrong for sub files generated with sup2vobsub. (I mean, when I convert sub to sup with sup2vobsub, then convert back to sub using the fixed reverse formula).

Do you think there is a bug in sup2vobsub or is there another explanation?

Thanks in advance for your help.

Manusse
:thanks:

emmel
11th August 2006, 00:03
Hello Manusse,
You are correct, there is a bug in the pts. I did not even notice that before, as the players I used for debugging showed the subs according to the .idx and not according to the .sub. But >>1 should be fine. Sorry for the inconvenience.
emmel

manusse
11th August 2006, 10:28
Hi emmel,

If I am not wrong, this means that those lines must be corrected like below.

headers[23] |= ( ts[3] & 0xc0 )>>5 | 0x21;
headers[24] = ( ts[3] & 0x3f )<<2 | ( ts[2] & 0xc0 )>>6;
headers[25] = ( ts[2] & 0x3f )<<2 | ( ts[1] & 0x80 )>>6 | 0x01;
headers[26] = ( ts[1] & 0x7f )<<1 | ( ts[0] & 0x80 )>>7;
headers[27] = ( ts[0] & 0x7f )<<1 | 0x01;


Do you agree?

Manusse

emmel
11th August 2006, 12:19
That seems correct.
Then, on line 333 it might be better to check if (to_write + header_size) <= 0x800 instead of < 0x800.
Thanks!

Jalavera
17th September 2006, 22:48
That seems correct.
Then, on line 333 it might be better to check if (to_write + header_size) <= 0x800 instead of < 0x800.
Thanks!

Please can you attach a Win32 binary from these new changes??
I'm not a programmer/Compiler.
Thanks.

emmel
21st September 2006, 19:02
http://www.mytempdir.com/943258

Jalavera
21st September 2006, 21:51
Thanks a lot.
I see two new options:
1. Language code... I understand :)
2. enforce colour model (available: cd, sc) :confused: What's this???

emmel
21st September 2006, 22:05
Oh, those are just presettings for some dvb-providers operating where I live... equivalent to enforcing the palette and alpha channels to some prescibed value. You can just ignore it :)

Mtz
21st September 2006, 22:40
Also I'm waiting for a GUI.
Thanks.

Jalavera
22nd September 2006, 09:22
Ok. Thanks. I'll ignore it.
Of course a GUI should be also very interesting... ;)

Kurtnoise
13th October 2006, 16:54
@emmel : could you rehost your last build ? Thank you...:)

emmel
13th October 2006, 18:00
There you go: http://www.mytempdir.com/989415

Then, about the gui... I think it is not a trivial task in general to program a decent gui. At least for me it is not, as I'm not an experienced gui programmer (I'm only familiar with some basic wxWidgets). So, sorry to dissapoint you guys... Imho the best soluition would be, if one of the "real programs" could provide the feature.

Finally, I would like to mention that the latest ProjectX (from cvs) is capable of exporting subtitles in VobSub form.

Cheers.

CoNS
14th October 2006, 15:05
Then, about the gui... I think it is not a trivial task in general to program a decent gui. At least for me it is not, as I'm not an experienced gui programmer (I'm only familiar with some basic wxWidgets). So, sorry to dissapoint you guys... Imho the best soluition would be, if one of the "real programs" could provide the feature.Manusse is currently working on implementing it in SubtitleCreator: http://forum.doom9.org/showthread.php?t=116394

manusse
14th October 2006, 15:29
That's correct.

I've quite completed the part that allows the Manipulate SUP tool of SC to import SUB/IDX files. This means that it will be easy to convert SUB/IDX files to SUP files.
I am currently testing it.

Then I will add the generate SUB/IDX from SRT/SUB(text) or SUP.

The SUP to SUB/IDX algorithm is greatly inspired from emmel's tool. I must thank emmel for opening its source code.

I hope the whole function will be able within 1 month.

Cheers
Manusse

manusse
15th November 2006, 23:50
Then I will add the generate SUB/IDX from SRT/SUB(text) or SUP.


Just to keep those interested informed that I've finished it. So the next version of SubtitleCreator will have the sub/idx support (SRT/SUB/SUP/Sub-Idx --> SUP/Sub-Idx). Plus some bugs of SC will be corrected and some new features to come...

Be patient...

kumi
16th November 2006, 00:22
That's awesome, I look forward to the new release.

SeeMoreDigital
16th November 2006, 10:47
Indeed.... that sounds like great news :D

derebo
17th November 2006, 15:09
yeah, awesome!!! big thanks!!!

manusse
2nd December 2006, 14:07
Everything is working fine. We are still on some bugs working at low pace.

Let me give you some news about the sub/idx functions in SubtitleCreator. SubtitleCreator will also be able to open multilanguage sub/idx streams. It will only open one at a time. When you try to open such a file, it will ask you which stream you want to open. This will also work with sub files without any idx file.

Also following a request by redia, SubtitleCreator will be able to add a new subtitle stream at the end of an existing sub/idx.

Cheers
Manusse

PS: Those functions may not be ready for V2.1 depending on how long it takes to add them.

chongy5
2nd December 2006, 16:41
Thanks for creating sup2vobsub - now using sup2vobsub and then SubRip I can create subtitles from DVB captures.
:thanks:

alfixdvd
2nd December 2006, 19:45
Hi emmel

Where can I get your last program version ?

The link http://www.mytempdir.com/989415 doesn't works

SeeMoreDigital
2nd December 2006, 20:25
Hi emmel

Where can I get your last program version ?

The link http://www.mytempdir.com/989415 doesn't worksThat link has expired now!

emmel
2nd December 2006, 20:39
Good evening alfixdvd,

You can find the latest executable from here:
http://www.mytempdir.com/1095700

In what comes to future, I'm counting on Manusse, Paddinton, and others, and patiently wait for the next release of SubtitleCreator. I'd also like to point out that ProjectX has offered since last august the possibility of exporting DVB-subtitles in VobSub format.

Cheers,
emmel

alfixdvd
2nd December 2006, 21:19
Thanks emmel.

Is it possible to get the source code also ?

emmel
2nd December 2006, 21:26
Ok. Updated the link above.

alfixdvd
2nd December 2006, 21:31
Hi emmel

Thanking you again

manusse
10th December 2006, 00:43
In what comes to future, I'm counting on Manusse, Paddinton, and others, and patiently wait for the next release of SubtitleCreator
It's going well. The code is almost finished. We are fixing some remaining bugs and improving the GUI. redia is helping us testing the VobSub support and compatibility especially with SAPs. Everything will be ready for V2.1. I must again thank emmel for publishing its source code.

Be patient.

Cheers
Manusse

manusse
22nd December 2006, 20:11
The new version is available here (http://sourceforge.net/project/showfiles.php?group_id=120228).

Cheers
Manusse

PS: At present it can only open VobSub files extracted using VSRip (not VobSub Configure)

BigCondor
23rd December 2006, 02:16
PS: At present it can only open VobSub files extracted using VSRip (not VobSub Configure)

I am interested to know what is the difference between files extracted from VSRip and VobSub Configure?

manusse
23rd December 2006, 12:21
Subtitles extracted using VSRip are extracted language by language i.e. first language #1, then language #2, ...
Whereas subtitles extracted using VobSub configure are extracted in what seems to be the timing order. So they are kind of interlaced. Sub1 Lang1, Sub1 Lang2, ... Sub2 Lang1, Sub2 Lang 2, ...
Plus an extra difference that I didn't understand yet (or a bug in my code?). As soon as I find it, I will be able to fix the way SubtitleCreator opens VobSub files so that subtitles extracted using VobSub configure will also work.

Cheers
Manusse

BigCondor
23rd December 2006, 12:41
Thanks for the explanation, I do hope you can figure a solution soon!

manusse
23rd December 2006, 13:03
However if you want to convert sup to vobsub (or add a language to an existing vobsub file), it is working.

Cheers
Manusse

emmel
24th December 2006, 13:21
Very nice. Thanks!

manusse
24th December 2006, 14:33
I must also thank you again, emmel, for publishing your code. If this function is available in SubtitleCreator it is thanks to all the people publishing their code like you, Gabest, subrip's authors, ...

Open-Source is great because it opens great possibilities that would never have existed otherwise.

Cheers
Manusse

manusse
31st December 2006, 18:59
@BigCondor,

Those last days I had some extra time to look at the VobSub configure compatibility.

I can announce that I've fixed it. I've already uploaded the fixed code to SubtitleCreator's SVN repository. So this means that the future version of SubtitleCreator will be 100% compatible with all VobSub files.

It was a bug in my code ;-)

Cheers
Manusse

BigCondor
1st January 2007, 04:45
Nice to hear that, thanks for all the hard work, happy New Year!

manusse
1st January 2007, 10:42
Thanks to Paddington you can already download it in the 2.1beta4 version.

:D

Malow
7th October 2007, 09:52
is the last "cli version" avaliable anywere? i cant find it...

manusse
7th October 2007, 19:46
The last cli version of what?

Cheers
Manusse

Malow
8th October 2007, 00:56
of sup2vobsub

mbt925
3rd May 2011, 19:34
Please give me a new working link. thanks.

Gew
10th February 2012, 17:04
Great utility emmel; sup2vobsub.exe works a charm.
Big thanks, it's been six years since you wrote it, and it's still flippin' script.
No further development needed, right?