Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Subtitles

Reply
 
Thread Tools Search this Thread Display Modes
Old 3rd April 2022, 03:29   #1  |  Link
wswartzendruber
hlg-tools Maintainer
 
wswartzendruber's Avatar
 
Join Date: Feb 2008
Posts: 413
PGS Bitstream Question: Cropping + Abrupt Packet End

What on God's green earth does it mean when a composition object declares cropping flag 0x40 and then abruptly ends?

And while we're at it, who the hell came up with this god-forsaken format, anyway?! I haven't been hit in the head with a metal pipe anywhere near enough times to think this is a rational way of going about things!
wswartzendruber is offline   Reply With Quote
Old 3rd April 2022, 15:37   #2  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,346
cropping flag is a single bit, it can't be 0x40?

In some software, the entire flag field is called "composition flags" (2 valid bits, 6 reserved ones, as far as I know), with 0x80 being cropping, and 0x40 being "forced on", eg. used for forced/alien subtitles.
Only in the first case, composition flag being 0x80 (or rather, including 0x80, its a bitmask), would the crop rectangle be present.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders
nevcairiel is offline   Reply With Quote
Old 3rd April 2022, 17:09   #3  |  Link
wswartzendruber
hlg-tools Maintainer
 
wswartzendruber's Avatar
 
Join Date: Feb 2008
Posts: 413
All right, going by The Phantom Menace (2011 U.S. Blu-ray) subtitles, that indeed makes sense. I've also checked the original Ghost in the Shell anime (4K U.S. release) and it makes sense there as well.

I can't find any mention of this in the patent that defines PGS.
wswartzendruber is offline   Reply With Quote
Old 3rd April 2022, 17:42   #4  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,346
Patents are often out of date with any future development of the format - they are not meant to implement against, afterall. The Blu-ray specs include proper documentation for the format.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders
nevcairiel is offline   Reply With Quote
Old 3rd April 2022, 17:45   #5  |  Link
wswartzendruber
hlg-tools Maintainer
 
wswartzendruber's Avatar
 
Join Date: Feb 2008
Posts: 413
Are the Blu-ray specs available anywhere?
wswartzendruber is offline   Reply With Quote
Old 3rd April 2022, 23:26   #6  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 108
Of course not. You have to pay or request them for an evaluation period.

VLC specifically masks the composition flag with 0x80 for cropping. If the flag is set, then it fetches 4xint16 additional values from the stream (which I find surprising, I would assume those 8 bytes being present whatsoever, with garbage or zero value – "stream consistency"). The function header also claims the cropping is a "TODO" so who knows if that's correct at all.
The patent also claims that there can be numerous cropping_rectangle_information for a single window, but it doesn't make sense whatsoever (see sheet 8).

Quote:
Originally Posted by nevcairiel View Post
[...] and 0x40 being "forced on", eg. used for forced/alien subtitles.
Can you elaborate on that? How can a specific subtitle be forced if that can be defined at the stream level? Also, if a given subtitle track is selected, it will be displayed anyway. I don't see the purpose at all so I must me missunderstanding the point.

Last edited by cubicibo; 3rd April 2022 at 23:29.
cubicibo is offline   Reply With Quote
Old 4th April 2022, 00:13   #7  |  Link
wswartzendruber
hlg-tools Maintainer
 
wswartzendruber's Avatar
 
Join Date: Feb 2008
Posts: 413
Quote:
Of course not. You have to pay or request them for an evaluation period.
I'm thinking the community could benefit from a reverse-engineered open specification. This "format" has been in widespread use since 2006.

Quote:
The function header also claims the cropping is a "TODO" so who knows if that's correct at all.
I have yet to encounter any subtitles that set 0x80.

Quote:
The patent also claims that there can be numerous cropping_rectangle_information for a single window, but it doesn't make sense whatsoever (see sheet 8).
This can be done by defining multiple composition objects against the same object/window combination.

Quote:
Can you elaborate on that? How can a specific subtitle be forced if that can be defined at the stream level? Also, if a given subtitle track is selected, it will be displayed anyway. I don't see the purpose at all so I must me missunderstanding the point.
It's a fundamentally irrational proposition given how subtitles are packaged in practice. Meaning, every disc I have puts "forced" subtitles and "all" subtitles in distinct tracks.

I do have some titles that use forced captions, however. For a track dedicated to foreign translation, all captions are forced. For tracks that contain all dialogue, only the captions that appear in the translated captions are forced. Ergo, the captions marked as "force" are the same between the two.

EDIT: Here's a link to my work:

https://github.com/wswartzendruber/pgs-tools

Maybe someday I'll publish this as a Rust crate. I was worried about someone grabbing the "pgs" name, but now that I think about it, I'm probably going to call it "brain-damage" or some-such.

Last edited by wswartzendruber; 4th April 2022 at 00:20.
wswartzendruber is offline   Reply With Quote
Old 4th April 2022, 07:11   #8  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,346
Quote:
Originally Posted by cubicibo View Post
VLC specifically masks the composition flag with 0x80 for cropping. If the flag is set, then it fetches 4xint16 additional values from the stream (which I find surprising, I would assume those 8 bytes being present whatsoever, with garbage or zero value – "stream consistency").
Optional elements are very much standard once you go beyond the very basics of compressed bitstreams.


Quote:
Originally Posted by cubicibo View Post
Can you elaborate on that? How can a specific subtitle be forced if that can be defined at the stream level?
This is just a feature of PGS subtitles, there is no "how" - and its actually used on a variety of discs, but not all of them (many don't even have an forced subs to begin with, anyway). A bunch of events are marked forced, and a player can decide if it wants to display all or only the forced events. On a Blu-ray disc the Menu logic would control this.
If you rip from a Blu-ray disc, you can also choose to filter the subtitles and put the forced ones into a separate track if that makes it more convenient for your target container - eg. MakeMKV offers that as an option.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders

Last edited by nevcairiel; 4th April 2022 at 07:16.
nevcairiel is offline   Reply With Quote
Old 4th April 2022, 07:43   #9  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 108
Quote:
Originally Posted by wswartzendruber View Post
I'm thinking the community could benefit from a reverse-engineered open specification. This "format" has been in widespread use since 2006.
You can always try your luck, but they specifically state you have no right to reproduce it or share any element so it would only be for you.

Quote:
This is just a feature of PGS subtitles, there is no "how" - and its actually used on a variety of discs, but not all of them (many don't even have an forced subs to begin with, anyway). A bunch of events are marked forced, and a player can decide if it wants to display all or only the forced events. On a Blu-ray disc the Menu logic would control this.
If you rip from a Blu-ray disc, you can also choose to filter the subtitles and put the forced ones into a separate track if that makes it more convenient for your target container - eg. MakeMKV offers that as an option.
Thanks, I had never encountered a Blu-Ray disc with this flag and only had seen forced caption tracks as a whole.

EDIT: May I ask for a sample containing solely the Epoch DSs where the said flag is set?

Last edited by cubicibo; 4th April 2022 at 13:11.
cubicibo is offline   Reply With Quote
Old 4th April 2022, 14:31   #10  |  Link
wswartzendruber
hlg-tools Maintainer
 
wswartzendruber's Avatar
 
Join Date: Feb 2008
Posts: 413
Quote:
Originally Posted by cubicibo View Post
You can always try your luck, but they specifically state you have no right to reproduce it or share any element so it would only be for you.
I'll pass on ever laying eyes on any of their licensed documentation.

Quote:
Originally Posted by cubicibo View Post
May I ask for a sample containing solely the Epoch DSs where the said flag is set?
Here is the entirety of the last subtitle track for Ghost in the Shell (1995, anime). This is from the Blu-ray disc that accompanies the 4K disc. The sum total of time it involves is 15 seconds. There are four epochs.

http://wswartzendruber.net/uploads/g...eng-forced.sup

EDIT: Here's the documentation for the Rust library:

http://wswartzendruber.net/doc/pgs-tools/pgs/

Last edited by wswartzendruber; 4th April 2022 at 14:50.
wswartzendruber is offline   Reply With Quote
Old 4th April 2022, 18:23   #11  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 108
Many thanks ! Good to have another implementation to cross-check.
cubicibo is offline   Reply With Quote
Old 4th April 2022, 18:36   #12  |  Link
wswartzendruber
hlg-tools Maintainer
 
wswartzendruber's Avatar
 
Join Date: Feb 2008
Posts: 413
Quote:
Originally Posted by cubicibo View Post
Many thanks ! Good to have another implementation to cross-check.
Don't assume my work here is correct.

Assume the opposite.
wswartzendruber is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:18.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.