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 16th June 2023, 19:04   #1  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
BDN XML without PNGs

Hi,

I'm authoring my first Blu-ray with Scenarist BD and I don't know how to make a BDN XML file to import .srt subtitles.

I need Text Subtitles (TextST) because my PlayList is made of 95 Clips and with PGS subtitles I would need to also split the subtitles file in 95 parts!

I've tried easySup but it always output BDN format in XML+PNGs (and also I would need to find a tool to convert 24 bits pngs to 8 bits and keep transparency).

I've tried Subtitle Edit but with the output format "Blu-ray TextST" it has to "write a PES packets" which doesn't import to Scenarist (it says ".textst it's not Supported").

Scenarist BD only imports .xml files (Import > BDN file) and now I'm trying to make a custom format with Subtitle Edit but I don't know the Sony BDN XML spec. It should be similiar to XML+PNGs but instead of <Graphic> tags with pngs info and location, it should be with text tags and subtitles, but I don't know the exact thing...

I've tried something like this (changing "Graphic" tag to "Text") but doesn't parse in Scenarist BD!:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<BDN Version="0.93" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="BD-03-006-0093b BDN File Format.xsd">
<Description>
<Name Title="easySUP" Content=""/>
<Language Code="eng"/>
<Format VideoFormat="720p" FrameRate="50" DropFrame="false"/>
<Events LastEventOutTC="01:56:03:20" FirstEventInTC="00:30:02:33"
ContentInTC="00:00:00:00" ContentOutTC="01:56:04:00" NumberofEvents="1166" Type="Text"/>
</Description>
<Events>
<Event Forced="False" InTC="00:30:02.16" OutTC="00:30:06.06">
<Text>- Announcer: IT'S TIME AGAIN
FOR EVERYONE EVERYWHERE ALL AT</Text>
</Event>
</Events>
</BDN>
Any idea?

edumj is offline   Reply With Quote
Old 16th June 2023, 19:35   #2  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,327
Are you sure you can import Text subtitles in Scenarist with BDN/XML ? And not just PNG with it ? I've never seen that in the few Scenarist doc i have, and the few i've understood about text subtitles on Blu-Ray it's that they are a pain in the ass !!!
Unfortunately my advice would be to use PGS. Also, try to ask in the "Advanced Authoring" part of the forum.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 16th June 2023, 20:08   #3  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 115
There used to be an open source program named srt2bdn that did exactly what you wanted but it has long vanished from the Internet.

If you can give me the TextST file output by SubtitleEdit, I could maybe modify ScenariStream to convert .textst file to TES+MUI which Scenarist supports.
Since TextST does not use DTS+PTS, but PTSin+PTSout, I would need a sample TES+MUI file. You could generate one with Scenarist BD subtitle editor with one single caption and the in & out timecodes of the subtitle. It would help me to figure it out.

Last edited by cubicibo; 16th June 2023 at 20:33.
cubicibo is offline   Reply With Quote
Old 16th June 2023, 21:08   #4  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
Yes, I just found that srt2bdn mentioned in a web, but the forum doesn't exist anymore!

Quote:
Originally Posted by cubicibo View Post
There used to be an open source program named srt2bdn that did exactly what you wanted but it has long vanished from the Internet.

If you can give me the TextST file output by SubtitleEdit, I could maybe modify ScenariStream to convert .textst file to TES+MUI which Scenarist supports.
Since TextST does not use DTS+PTS, but PTSin+PTSout, I would need a sample TES+MUI file. You could generate one with Scenarist BD subtitle editor with one single caption and the in & out timecodes of the subtitle. It would help me to figure it out.
Here you are the .textst from Subtitle Editor and .tes+.mui from enconding a single subtitle from Scenarist BD.

Thanks!
Attached Files
File Type: zip Subtitle Edit (.TextST)+Scenarist BD (.tes+.mui).zip (41.0 KB, 112 views)
edumj is offline   Reply With Quote
Old 16th June 2023, 21:14   #5  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 115
Attachment needs weeks for approval, share it with dropbox or something.
Also I would need the timecode values you set for the TES+MUI sample (and chosen fps for project) so I can verify my decoding.
cubicibo is offline   Reply With Quote
Old 16th June 2023, 21:19   #6  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
It should be possible, because if I have to do one subtitle at a time adding DialogPresentation's one by one... There are many thing missing in the manuals, like how to create a Palette... but it says:

"For TextSTs, Scenarist BD automatically parses the (.xml) file, imports the fonts referenced in the BDN file, creates the TextST data structure, and encodes the TextST"

So, do I need to put the font name in the .xml!?

By the way, I coudn't find a .otf font compatible with Scenarist! In the end I just renamed a .ttf to .otf and seems to work! Although I still get no outlines...

Quote:
Originally Posted by jpsdr View Post
Are you sure you can import Text subtitles in Scenarist with BDN/XML ? And not just PNG with it ? I've never seen that in the few Scenarist doc i have, and the few i've understood about text subtitles on Blu-Ray it's that they are a pain in the ass !!!
Unfortunately my advice would be to use PGS. Also, try to ask in the "Advanced Authoring" part of the forum.
edumj is offline   Reply With Quote
Old 16th June 2023, 21:25   #7  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
Quote:
Originally Posted by cubicibo View Post
Attachment needs weeks for approval, share it with dropbox or something.
Also I would need the timecode values you set for the TES+MUI sample (and chosen fps for project) so I can verify my decoding.
Ok, here it is.

https://www.dropbox.com/s/je4nt3c3ij...ui%29.zip?dl=0

Timecode Start is 00:00:00:00 and End is 00:00:20:00
at 50 fps
edumj is offline   Reply With Quote
Old 16th June 2023, 21:42   #8  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 115
Null timecode is the worst, because it does not let one distinguish padding from actual zero value useful in stream.
Anyway, I will spend some time and see if I can figure it out. If not, sorry in advance.
cubicibo is offline   Reply With Quote
Old 16th June 2023, 21:51   #9  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
Quote:
Originally Posted by cubicibo View Post
Null timecode is the worst, because it does not let one distinguish padding from actual zero value useful in stream.
Anyway, I will spend some time and see if I can figure it out. If not, sorry in advance.
Ok, thanks! Tell me if I have to change the start time or something.
edumj is offline   Reply With Quote
Old 17th June 2023, 08:17   #10  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 115
Some notes while I keep investigating:
- SubtileEdit does not insert "expected" TextST segments headers but uses M2TS'. Probably because no one has ever seen a real .TextST file. Not a blocking problem but it makes file processing more annoying.
- MUI object type is 0x04, unlike PGS or IGS that are both under type 0x03.
- MUI file does not appear to contain any timestamps (everything is zero). But I suspect this is because the start time of the subtitle is set to zero.
- TextStyle segment has a length offset of 5 between MUI and TES, while all other segments (PGS, IGS, 0x82 TextDialog) have a difference of 3. Not sure why but it does not seem to matter.
- Timestamps of TextDialog are 5 bytes long and have a 54000000 ticks offset. So PTSin is 54000000 ticks (600s) (00:00:00:00) and PTSout is 55800000 (620s) (00:00:20:00). As such, SubtitleEdit timestamps must have + 54000000 ticks added in the conversion process (note for myself, really.)

Can you generate new TES+MUI assets?
- The first subtitle has a first text style and it should appear at something like 00:00:10:22-00:00:12:19
- The second subtitle has a DIFFERENT text style and it should appear at like 00:02:40:01-00:02:43:04
I need this because I suspect Scenarist inserts timestamps in MUI for TextStyle segments only (but I can't know if first TextStyle segment is at PTS 0 in MUI format).

Last edited by cubicibo; 17th June 2023 at 10:54.
cubicibo is offline   Reply With Quote
Old 17th June 2023, 15:25   #11  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
Ok, I changed the style of the second subtitle to Italic.

https://www.dropbox.com/s/07a4ng6r1g...ncode.zip?dl=0

I hope it helps.
edumj is offline   Reply With Quote
Old 17th June 2023, 15:44   #12  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
Hi, after hours of testing, trial and error, trying to fix errors showed in Scenarist BD and figuring out the location of needed Elements and Attributes, I ended with this .xml, although I donīt know the meaning of CharacterCode (must be 1 to 7) or the right Palette colors...:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<BDN Version="0.93" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="BD-03-006-0093b BDN File Format.xsd">
<Description>
<Name Title="easySUP" Content=""/>
<Language Code="eng"/>
<Format VideoFormat="720p" FrameRate="50" DropFrame="false"/>
<Events LastEventOutTC="00:00:06:00" FirstEventInTC="00:00:02:00"
ContentInTC="00:00:00:00" ContentOutTC="01:56:04:00" NumberofEvents="2" Type="Text" CharacterCode="1"/>
</Description>
<Palettes>
	<Palette PaletteID="1" ColorMode="RGB">
		<Palette Entry="1" Index="1" Y_R="0" Cb_G="0" Cr_B="0" T_A="0"/>
		<Palette Entry="2" Index="2" Y_R="255" Cb_G="255" Cr_B="255" T_A="0"/>
	</Palette>
</Palettes>
<Fonts>
	<Font FontID="0" FontFile="0000.otf">
	</Font>
</Fonts>
<TextRegions>
	<RegionCount RegionStyleID="0"> 
		<RegionStyle RegionHorizontalPosition="0" RegionVerticalPosition="0" RegionWidth="1000" RegionHeight="150" RegionPaletteID="1" BackgroundPaletteEntryID="1"/>
		<TextBox TextBoxHorizontalPosition="0" TextBoxVerticalPosition="0" TextBoxWidth="500" TextBoxHeight="150" TextFlow="1" TextHorizontalAlignment="2" TextVerticalAlignment="1"/>
		<LineSpace LineSpace="24"/>
		<FontInfo FontID="0" FontSize="24" FontStyle="1" FontPaletteEntryID="1" FontOutlinePaletteEntryID="2" FontOutlineThickness="3"/>
	</RegionCount> 
</TextRegions>
<Events>
<Event Forced="False" InTC="00:00:02:00" OutTC="00:00:06:00">
<Text RegionStyleID="0">TEXTO</Text>
</Event>
</Events>
</BDN>
But now I get this error:
Code:
Error : Length of Text element value is an odd number.
And if I add one character of text it just shows this error:
Code:
Error : Parse Error
 <Events> <Event>#1 <Text>
I donīt know what more to try!

edumj is offline   Reply With Quote
Old 17th June 2023, 20:05   #13  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 115
Does this work? https://0x0.st/HTMX.7z

This should be the proper conversion of the original file. If there's encoding errors then SubtitleEdit may not encode TextST streams properly (I already spotted one error, SubtitleEdit includes the dialog count in TextStyle header length, which Scenarist does not, hence why the MUI file has +5 bytes offset rather than the common +3).

Last edited by cubicibo; 17th June 2023 at 20:10.
cubicibo is offline   Reply With Quote
Old 18th June 2023, 01:42   #14  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
Hi, it gives this errors:

Code:
Error : Out of range, Region must exist within a Video area.
Error : TextST Decode error. H:\OSCARS 2023 Blu-ray\Scenarist BD\Oscars\OSCARS 95 by Edumj\00.00.0002\Encode\test.tes offset=0x0 (first byte of invalid segment).
Error : FilePath : H:\OSCARS 2023 Blu-ray\Scenarist BD\Oscars\OSCARS 95 by Edumj\00.00.0002\Encode\test.tes, 
 Decode failed.
Maybe someone who has Lemony Pro could try to export any subtitles to BDN without pngs, just to see the right .xml format?
I saw in the documentation it can export to "blu-ray images and blu-ray text", but I can't make the program work.
edumj is offline   Reply With Quote
Old 18th June 2023, 09:45   #15  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 115
If your video format is 720p (going by the BDN example), then the Oscars.textst file will not work because the file is encoded for 1080p.

If it is really 1080p, then I see three possible issue with how SubtitleEdit generates the 0x81 segment. Try each of these examples. If none work, I give up.
https://0x0.st/HTQI.7z (the MUI file is identical for all TES).

- override: literally re-use 0x81 position data from another commercial textst.
- zerotbv: set relative textbox vertical position to zero.
- shift_one: subtract one to vertical position to avoid height+v_pos == video_height

Last edited by cubicibo; 18th June 2023 at 10:44.
cubicibo is offline   Reply With Quote
Old 18th June 2023, 16:39   #16  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
It keeps saying:

Code:
Error : Out of range, TextBox must exist within a Region area.
Error : TextST Decode error. H:\OSCARS 2023 Blu-ray\Scenarist BD\Oscars\OSCARS 95 by Edumj\00.00.0002\Encode\test_override.tes offset=0x0 (first byte of invalid segment).
Error : FilePath : H:\OSCARS 2023 Blu-ray\Scenarist BD\Oscars\OSCARS 95 by Edumj\00.00.0002\Encode\test_override.tes, 
 Decode failed.
Error : Out of range, TextBox must exist within a Region area.
Error : TextST Decode error. H:\OSCARS 2023 Blu-ray\Scenarist BD\Oscars\OSCARS 95 by Edumj\00.00.0002\Encode\test_shift_one.tes offset=0x0 (first byte of invalid segment).
Error : FilePath : H:\OSCARS 2023 Blu-ray\Scenarist BD\Oscars\OSCARS 95 by Edumj\00.00.0002\Encode\test_shift_one.tes, 
 Decode failed.
Error : Out of range, TextBox must exist within a Region area.
Error : TextST Decode error. H:\OSCARS 2023 Blu-ray\Scenarist BD\Oscars\OSCARS 95 by Edumj\00.00.0002\Encode\test_zerotbv.tes offset=0x0 (first byte of invalid segment).
Error : FilePath : H:\OSCARS 2023 Blu-ray\Scenarist BD\Oscars\OSCARS 95 by Edumj\00.00.0002\Encode\test_zerotbv.tes, 
 Decode failed.
Even changing importing options in Scenarist to 1080p 25fps, so it may be what you say: Subtitle Edit exports at 1080p, because in exporting options it says Width=1720, Height=200, Textbox width=1719, Textbox height=130, ...

So, if I make a pair of subtitles in Scenarist BD, but with the same exact parameters of "Region styles" (region and texbox size and position, font style, ...) and "Palettes"? that Subtitle Edit exports by default, it should be easier to compare the .textst with the .tes??

Also, are you sure the .mui is the same for all 3 files? I think the name of the .tes is inside the .mui (I opened "TextST#1.tes.mui" and "TextST#1+.tes.mui" in Notepad++ and the only think I understood is that I saw the "+" sign inside).
edumj is offline   Reply With Quote
Old 18th June 2023, 16:43   #17  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 115
Yes, MUI file is just a segment index/reference. If the count of text object does not change, MUI remain the same.

Ok one last idea:
Create TES+MUI in Scenarist with the longest double line subtitle you have, so we are ensured all subtitles fit on screen. Export to TES+MUI. Then, replace 0x81 packet in desired TES file (I can guide you how to do that).

Here's with the 720p samples you provided: https://0x0.st/HT_B.7z (albeit text box parameter may not be wide enough for long captions.)

Last edited by cubicibo; 18th June 2023 at 21:24.
cubicibo is offline   Reply With Quote
Old 18th June 2023, 22:02   #18  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
Ok,

for now I'm trying to copy the "Region style" configuration from Subtitle Edit and there is someting wrong with default "Text box vertical pos" of "880" because Scenarist says this:

Code:
Error : Property value is not valid.. [Out of range, some values of TextBoxStruct are out of range.]
So, maybe that's the error "Out of range, TextBox must exist within a Region area." because the textbox must be at 0,0 inside the Region
edumj is offline   Reply With Quote
Old 18th June 2023, 22:38   #19  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
Quote:
Originally Posted by cubicibo View Post
Here's with the 720p samples you provided: https://0x0.st/HT_B.7z (albeit text box parameter may not be wide enough for long captions.)
It says, importing like 720p 50fps:

Code:
Error : The interval from Start Time(previous Dialog Presentation) to Start Time is too close. minimum interval=00:00:01:05
or, with 1080p 25 fps:

Code:
Error : The interval from Start Time(previous Dialog Presentation) to Start Time is too close. minimum interval=00:00:01:10
edumj is offline   Reply With Quote
Old 18th June 2023, 22:47   #20  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 115
TextST has bad timing requirements. There are mentions that srt2bdn was also generating bdn that did not pass Scenarist TextST conversion due to delay between subs.

Your only solution is to space out each subtitle and guarantee a minimum delay of 00:00:01:10 between each event in 1080p.
But hey, we are very close to a solution! I will let you regenerate textst file. You can then convert it to TES+MUI using latest v0.0.3 ScenariStream python utility. Then you (or I) just need to copy 0x81 segment like done before.
cubicibo is offline   Reply With Quote
Reply

Tags
bdn, blu-ray, subtitle conversion, subtitles blu-ray, textst

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 02:51.


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