Log in

View Full Version : readSUP - CLI to downscale/resize SUP to 720p/576i/480i and extract timings to SRT


deank
27th September 2009, 19:38
Here is a small tool to create 'srt' timings from .sup file and to downscale (only) higher to lower resolution: readSUP (http://multiavchd.deanbg.com/readSUP.exe) (only 40kb (or 90kb with the icon) - requires calclib.dll (http://rapidshare.com/files/285763697/calclib.dll) (1.4MB) from multiAVCHD/CalcIt or just full download (http://multiavchd.deanbg.com/textst/) (600kb)).

I don't know if there is any use of it... I decided today to play around with this .sup format and see if it is possible to create a CLI for resizing .sup subtitles.

The idea was to make it small and not dependent on NET framework or java or anything... just a standalone exe+dll.

Also here is a link to another tool textST (http://forum.doom9.org/showthread.php?p=1329089#post1329089) which extracts textST subtitle streams from m2ts / pes files.


C:\>readSUP.exe
readSUP 0.2 - SUP/PGS analyzer & resizer (deank@doom9)

Usage: readSUP input_file [out_file] /720|576|480 /verbose /srt /analyse /left
* input_file must be in SUP/PGS format


C:\>readSUP.exe 00000.track_4608.sup

readSUP - SUP/PGS analyzer (deank@doom9)

Detected 2928 segments and 366 objects (732 PG compositions).
...

00:02:14,857 - 00:02:14,926 # 113: $13 bytes, Presentation: 1920x1080@23.976
00:02:14,857 - 00:02:14,922 # 114: $A bytes, Window: 466,870 981x156
00:00:00,000 - 00:02:14,857 # 115: $4E4 bytes, Palette Definition
00:02:14,857 - 00:02:14,866 # 116: $D30F bytes, Object: 54024 bytes, 981x156 [C]
00:00:00,000 - 00:02:14,866 # 117: $0 bytes, End of Display Set

00:02:14,926 - 00:02:18,180 # IN_OUT TIME

00:02:18,175 - 00:02:18,180 # 118: $B bytes, Presentation: 1920x1080@23.976
00:02:18,175 - 00:02:18,175 # 119: $A bytes, Window: 466,870 981x156
00:00:00,000 - 00:02:18,175 # 120: $0 bytes, End of Display Set

00:02:18,319 - 00:02:18,388 # 121: $13 bytes, Presentation: 1920x1080@23.976
00:02:18,319 - 00:02:18,383 # 122: $A bytes, Window: 450,870 1013x156
00:00:00,000 - 00:02:18,319 # 123: $4E9 bytes, Palette Definition
00:02:18,319 - 00:02:18,328 # 124: $FFEF bytes, Object: 65577 bytes, 1013x156 [F]
00:02:18,319 - 00:02:18,328 # 125: $45 bytes, Object: (cont) 58 bytes [L]
00:00:00,000 - 00:02:18,328 # 126: $0 bytes, End of Display Set

00:02:18,388 - 00:02:23,727 # IN_OUT TIME

00:02:23,722 - 00:02:23,727 # 127: $B bytes, Presentation: 1920x1080@23.976
00:02:23,722 - 00:02:23,722 # 128: $A bytes, Window: 450,870 1013x156
00:00:00,000 - 00:02:23,722 # 129: $0 bytes, End of Display Set


15
00:02:14,926 --> 00:02:18,180
Text line #15

16
00:02:18,388 --> 00:02:23,727
Text line #16

17
00:02:24,019 --> 00:02:28,482
Text line #17


Dean

0xdeadbeef
29th September 2009, 11:36
I decided today to play around with this .sup format and see if it is possible to create a small CLI for resizing .sup subtitles.

Just a small warning: when the subtitles are resized, the dts/pts timestamps of the different packets have to be recalculated. For a complex PGS with e.g. multiple objects in multiple windows this will need a very detailed understanding of the PGS format and the timing limitations defined by the BD specs. And since unfortunately the current free authoring (let's better call them muxing) solutions don't check or recalculate these timestamps, the playability of resized streams is questionable if these additional time stamps are missing or wrong.

It took me quite some time to determine all of the timestamps for my simplified packet format in BD-SUP streams exported by BDSup2Sub, so I guess it will be a major effort to get this all right in a complex stream.

deank
29th September 2009, 19:57
:) I'll see what will happen.

I had some time earlier today so I'm ready with the vertical resize. I loaded the 'resized' .sup file in BDsup2sub and it is just fine.

Now I'll finish the horizontal resize and will post back with a test version.

Except resizing I'll add simple parsing with changing the justification of the subtitles, so one can move them up or down and align them left/centered/right.

Small steps at a time - after all it is just 200 lines of code without the help of any libraries or anything.

edit: Ok, now resize works just fine :) Wasn't that hard.

It is kind of slow (~9mins for 1400 subpictures 1920x1080->1280x720 conversion in 2hr movie), but I'll check the RLE decode/encode, as it seems it is slowing the whole process.

deank
30th September 2009, 14:16
Task completed! :) Link in 1st post is updated to a fully working readSUP downscaller.

I'll appreciate any feedback (without complaints about speed).

Dean

p.s. Few small bugs were fixed, too.

Rudde
11th October 2015, 00:08
Wow, this post is really old, but I'm desperate. I need to extract TextST subs from a BD, using the textst.exe tool I only get the error.

textST stream extractor (deank@doom9)

(RT) Error oppening file (WIN32 Error: 8) - Line 24

I have now tried both Windows 8.1 x64 and Windows 7 x64 and get the exact same error both places.