View Full Version : PunkGraphicStream (ASS to Blu-ray subtitle converter)
slartibardfast
27th June 2012, 22:05
Hi SassBot,
PGS isn't entirely dead yet. I've been finishing up in postgrad land and too busy to work on it.
I'd be happy to see a C++ port though, if there is enough interest from others. I am currently planing an emscripten/LLVM built web app based on PGS.
Any C++ work you did might get reused for this!
However, now that I think about it, perhaps it would be more beneficial to add the ability to open advanced substation alpha files to BdSup2Sup++?
The heavy lifting is done by libass. Though the split/merge code in PGS which translates from multiple events and animations would be helpful in doing this. I'd be happy to release a relicense as Apache2, originally libass was GPL3, hence PGS's license choice.
-dc
Rectal Prolapse
30th June 2012, 00:55
I've written a simple PGS decoder (to PNG) in C++ - you might want to look at it for ideas. I use the Flavor language for reliable translation of the PGS format. I started a thread for it, with source code, a few months ago. Code is totally free.
qknet
30th June 2012, 05:01
I tried PGS to make bluray sup. It ran quite fast. But the output looks weird on hd tank player, while its looks rather ok in TotalMedia Theater (some are cropped unexpectedly).
I wonder if the output is 24bit, or just 8 bit? And how do I make fullscreen size sup? I had to go back to easysub for these features, though speed is not its advantage.
Sent from my GT-P7300 using Tapatalk 2
slartibardfast
30th June 2012, 18:22
I tried PGS to make bluray sup. It ran quite fast. But the output looks weird on hd tank player, while its looks rather ok in TotalMedia Theater (some are cropped unexpectedly).
I wonder if the output is 24bit, or just 8 bit? And how do I make fullscreen size sup? I had to go back to easysub for these features, though speed is not its advantage.
Is there any chance you could PM me a sample of a subtitle that does this? In general, the cropping is controlled in the subtitle file's video resolution and zoom settings. PGS really just passes this through without checking for sanity. I use Aegisub to preprocess subtitle files.
The blu-ray bitmap format is 8-bit, but PGS renders subtitles from a 32bit source (libass) then reduces it down. This job of converting to 8-bit often reduces quality! In addition, the way that PGS does this reduction, places a bit too much emphasis on preserving a precise transparency level.
I've written a simple PGS decoder (to PNG) in C++ - you might want to look at it for ideas. I use the Flavor language for reliable translation of the PGS format. I started a thread for it, with source code, a few months ago. Code is totally free.
Cool thanks. I will check it out sometime, as I'm sure there are places where my use of the format that could be tightened up!
Rectal Prolapse
1st July 2012, 00:50
The major thing about my implementation is that it correctly handles multiple regions of subtitles that are rendered at once or overlap at different times. It *should* also handle palette changes while reusing a PGS bitmap in the subtitle cache. So in theory it should handle elementary karaoke effects. Unfortunately, I have not found a disc using those features to test.
However, I *have* tested it on anime discs that make use of multiregions and it seems to work.
AFAIK this is the only PGS renderer on the PC that can do this outside of a commercial Blu-ray player or a standalone blu-ray player/streamer.
slartibardfast
1st July 2012, 13:03
The major thing about my implementation is that it correctly handles multiple regions of subtitles that are rendered at once or overlap at different times. It *should* also handle palette changes while reusing a PGS bitmap in the subtitle cache. So in theory it should handle elementary karaoke effects. Unfortunately, I have not found a disc using those features to test.
However, I *have* tested it on anime discs that make use of multiregions and it seems to work.
AFAIK this is the only PGS renderer on the PC that can do this outside of a commercial Blu-ray player or a standalone blu-ray player/streamer.
Both these features would be amazingly useful. Way back I had tried to brute force some multiregion support, but it is such an inefficient process as I could never find a sample of them in use.
PGStoBDN is exciting stuff, thanks!
SassBot
2nd July 2012, 13:08
Yes, thanks for mentioning this. I'll see what I can do to integrate your code to make BDSup2Sub's output better. :)
Tappen
3rd July 2012, 21:37
Yes, thanks for mentioning this. I'll see what I can do to integrate your code to make BDSup2Sub's output better. :)
The SUP parsing code in my program SubExtractor began as a port from BDSub2Sub which I then fixed for multi-region support when I found a few movies were converted badly.
If you download the source from CodePlex and look at the files BluRaySupData.cs, BluRaySupPalette.cs, and BluRaySupParser.cs you can see the fixed code.
SassBot
3rd July 2012, 21:41
Okay, I'll check that out. Thanks. Do you still have any files that use multi-regions that you can post that I can use to test with?
SassBot
9th July 2012, 18:02
Tappen, is there anyway you can point out in which parts of the code you changed or if possible a diff of what you changed to add the multi-region support? Your code is different enough that it makes it rather difficult to follow it against the original code.
Tappen
9th July 2012, 23:26
In the function "static PcsData ParsePicture(byte[] buffer, SupSegment segment)" in BluRaySupParser.cs you can see where I loop through compositionObjectCount x PcsObjects. The original code assumed there was only 1 PcsObject per subtitle frame a.k.a. a single region.
Once you have multiple PcsObjects per PcsData describing the regions, you need multiple BitmapObjects in the Pcs as well with the actual data (attached when the Pcs is being completed). So PcsData goes from being a simple class to containing several collections which must be dealt with separately.
SassBot
9th July 2012, 23:56
Okay, that's a good starting point. Thanks.
qknet
22nd August 2012, 04:22
Dear slartibardfast,
I don't know what happens but I can never use the output of PunkGraphicStream directly. Now, I see there is no more "cropping" issues, but instead the timing is seriously messed up. Several subtitles are displayed too long while the next subtitle doesn't show up. It happens to ALL the outputs.
BUT, if I feed those outputs into bdsup2sub and save them, everything is now fine. One more step, but I still appreciate the speed PunkGraphicStream and use it instead of avs2bdnxml (EasySub).
I uploaded the ass and the two generated sups for your review:
https://dl.dropbox.com/u/19135597/testPGS.rar
==========
PS: I used tsMuxer to create sample bluray, and TotalMedia Theater 5 to play it.
But the good thing is XBMC plays it without problem, while it has problem (flashing subtitle) with the outputs of bdSup2SuB. :D.
I will run a test on my Media Tank Player and report the compatibility issue, if any.
==============
Edit: HD Player can't display properly PunkGraphicStream, but, again supports well output of bdSup2SuB
https://www.dropbox.com/s/bu93kdvi8hgqwrn/IMG_20120822_202637.jpg
So, the situation is like this
PunkGraphicStrem bdSup2SuB
HD Player x ok
TotalMedia Theater (5) x ok
XBMC (12) ok x
BBA163
3rd February 2014, 18:01
Waht about change the Filter to Xy-vsfilter?
Some ASS-fx was big
DoctorM
8th December 2014, 21:54
I can't find an explanation anywhere. What are 'misses' and is there a way to minimize them? It sounds bad.
Flanker-B
5th January 2016, 00:16
Hi all,
No updates on a linux build. I have a serious lack of free time at present!
On all Windows x64, it is required to use a 32bit java virtual machine. This is because the native components (.dll files) are compiled only for 32bit on windows.
(A 64bit jvm can't use a 32bit native library, hence the java.lang.UnsatisfiedLinkError).
When I have some free time to do a linux build, I will also do a x64 windows build. Just can't give an ETA.
Best of luck,
Why virtual machine? You can normally instal 32bit java on 64bit windows, actually 32bit java (jre) is required for 32bit browsers even if you use 64bit windows. Could it be that the program was "poorly" coded that it can't find c:\Program Files (x86) and only checks for c:\Program Files\ as location for java?
foodadd
21st August 2016, 06:16
Good work! This will be very useful.
LordTrace
9th August 2018, 16:01
Cool tool!!
Is there any way to avoid the delay this adds to subs? Every .ass i have converted is ever so slightly later than the original file. :/
LordTrace
10th August 2018, 16:06
Hmm.. the 23.97 setting gives every ass i try a delay. And the 59.94 setting does not but they all flicker. :/
LowDead
11th August 2018, 21:33
Also.. is the framerate buttons for film swapped?
using:
Film (NTSC) (Tooltip says 24p) - shows up in tsmuxer as 23.976
Film (Tooltip says 23.976) - shows up in tsmuxer as 24
:rolleyes:
//LD
There's a cosmetic bug..
//LD
Beo
7th December 2018, 17:39
I love this application! Exactly what I needed.
However I had this bug with the fps as well.
@LowDead
Which version did you use? In my case both (23.976 and 24) options will give me a .sup with 24 fps.
At least that's what Blu-Disc Sudio says (Decoding PGS stream (track 5): Resolution: 1920:1080 Frame rate: 24
Change FPS from 24 to 23.976 for PGS stream #5), when I'm exporting something (via tsMuxeR) with the converted subtitles. And in the finished product, the subtitles are a little bit to slow.
Any idea what I'm doing wrong?
Or what I could do alternatively to compensate this? I'm no sure, how the "24fps"-information is contained in the .sup, but maybe it's possible to change it? Or to somehow compensate it by changing the .ass before converting? I'm still not entirely sure, how all the subtitles stuff works, I thought it's about absolute timestamps anyway.
I'd appreciate, if someone could help me there. :)
Also, I just realized that suddenly I'm getting the mentioned error. (Encode failed - java.lang.UnsatisfiedLinkError etc.)
I have installed 32-bit java and didn't change anything since the last time. It runs without problems on my notebook. Any idea, whta this could be about?
LowDead
7th December 2018, 19:57
please try easySUP that's included in the multiavchd package instead. It will give you less headache ;-)
//LD
Beo
7th December 2018, 21:10
Is it able to do the same thing? Because I have some effects like blur, fade, positions etc as well as different styles and if i remember correct, easySup was only generating the images in it's own style from the text.
Correct me if I'm wrong, if this would work I'd be happy to use it.
LowDead
8th December 2018, 02:23
easySUP can generate styles and effects. just load an .ASS and test :)
//LD
Beo
8th December 2018, 17:29
I did, and it almost worked perfectly after trying a few things. I guess I will pn you about the one last thing, I don't want to spam this thread with my specific kinda offtopic questions. I hope that's ok.
Anyway, thanks for the help! :)
LowDead
9th December 2018, 00:13
sure, np :)
slartibardfast
21st March 2026, 14:21
hi, folks I've picked up the thread with this software and ported it to ffmpeg.
i've gone all in and co-written with claude code,
so i've no idea if it'll ever be worth upstreams time,
but i'd be very interested in feedback, especially in the OCR bitmap-to-text features :
https://connollydavid.github.io/pgs-release/
i'm planning to close out the remaining PGS features soon, and switch to hardware verification.
thanks.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.