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 18th June 2023, 22:55   #21  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
Well,

https://www.dropbox.com/s/hm560g7u1aw153p/Subs.rar?dl=0

here it is the .textst and .tes+.mui, with only 2 subtitules and the same configurations (Region Style, Text Style, 1080p 25fps, ... even I don´t know the resolution Subtitle Edit exports to!)

I also include the trimmed .srt file, the .xml from exporting it to BDN XML+PNG (even I dont't know why it says VideoFormat="2048x858"!?) and a screen capture with both Scenarist and Subtitle Edit Region Style configuration.
edumj is offline   Reply With Quote
Old 19th June 2023, 00:36   #22  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
Quote:
Originally Posted by cubicibo View Post
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.
Well, it still says that about first byte...:

Code:
Error : The interval from Start Time(previous Dialog Presentation) to Start Time is too close. minimum interval=00:00:01:10
Error : TextST Decode error. H:\Scenarist BD\Subtitulos\HT_B\test_tesmui\test.tes offset=0x230 (first byte of invalid segment).
Error : FilePath : H:\Scenarist BD\Subtitulos\HT_B\test_tesmui\test.tes, 
 Decode failed.
I still need to learn how to use Python in Windows... Dou you have an executable of your program?
edumj is offline   Reply With Quote
Old 19th June 2023, 18:07   #23  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 120
Let's not overcomplicate things!

Code:
Error : The interval from Start Time(previous Dialog Presentation) to Start Time is too close. minimum interval=00:00:01:10
Error : TextST Decode error. H:\Scenarist BD\Subtitulos\HT_B\test_tesmui\test.tes offset=0x230 (first byte of invalid segment).
Error : FilePath : H:\Scenarist BD\Subtitulos\HT_B\test_tesmui\test.tes,
Means that your file imports properly (error offset is no more 0x0 but in the middle of subs data!!) but the subtitle at 0x230 in TES file is too close to the previous subtitle in PTSin difference.
What you must do is take the SRT and ensure that all the ENTRY time of all subtitles are separatef by 00:00:01:10 or more. Then you can export to TextST and I will tell you how to modify the 0x81 data for Scenarist to be happy.

Here is a practical example:
Legal:
00:01:01:00 > 00:01:05:08: Subtitle 1
00:01:05:10 > 00:01:06:19: subtitle 2
Here, sub1 and sub2 PTSin are separated by >4 seconds. PTSin2-PTSend1 is very small but it does NOT matter.

Illegal:
00:01:01:05 > 00:01:01:08: Subtitle 1
00:01:01:16 > 00:01:06:19: subtitle 2

PTSin2-PTSin1 = 00:01:01:16-00:01:01:05 = 11 frames << 00:00:01:10, this is illegal for TextST!

Last edited by cubicibo; 19th June 2023 at 18:30.
cubicibo is offline   Reply With Quote
Old 19th June 2023, 18:54   #24  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
So, and easy way to find illegal subs should be the duration of every subtitle? If it's less than 1 second and 100 or 400 ms they are too close.
I think Subtitle Workshop can fix that.

So, in the last zip the subtitles were ok? Or dou you want the full srt with fixed durations? Even it's not the full .srt, I still have to join 2 more parts...
edumj is offline   Reply With Quote
Old 19th June 2023, 19:00   #25  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 120
The DELAY between subtitles appearance!
NOT the duration of the subtitle themselves or the delay between two (long duration) subtitles.

Subs1 and subs2 must not appear one after the other in short time.
In TextST, ~1s is needed to decode a subtitle. Decoding of next subtitle starts AFTER the last subtitle appears on screen.


I cannot check it now. I will tell you this evening or tomorrow.

Last edited by cubicibo; 19th June 2023 at 19:10.
cubicibo is offline   Reply With Quote
Old 19th June 2023, 21:40   #26  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 120
This photo explains what you must ensure: https://i.imgur.com/NnNEngV.jpg

Here are the subtitles that needs to be corrected: https://textup.fr/714103Oo
"delta" = PTSin(current)-PTSin(previous) = D(CA)
This is the value that you must ensure is larger than 00:00:01:10.
-------
Convert to TES+MUI:
- Install python3 from Windows Store
- Download ScenariStream
- Open cmd.exe, cd to ScenariStream directory:
Code:
python3 client.py -s subs.textst -o subs.tes --textst
=> This will create subs.tes and subs.mui from subs.textst input.

Replace 0x81 segment:
- Use HxD or Hex Fiend (hex editor)
- In TES file, copy good 0x81 segment from Scenarist BD TES to SubtitleEdit TES. Replace all data up to '048E82' (not included). The length can change. You must NOT overwrite '048E82', this is all that matters!
- In MUI file, copy everything up to first '82' byte (not included). The length must not change.

- This photo shows you how many bytes to select in Scenarist BD TES file: https://i.imgur.com/28tfzYi.png. It can be different from 0x46, read the value and count in hex. You can verify that your count is correct when 0x82 is +3 bytes on the right.
- The highlighted section show what to replace in subs.tes. The content may be longer or shorter. You must not overwrite 048E82, this is all that matters.
https://i.imgur.com/tHaJYrF.png
- The highlighted section in subs.mui file must has constant length before and after change. Only a single byte should change (segment length).

Last edited by cubicibo; 19th June 2023 at 21:56.
cubicibo is offline   Reply With Quote
Old 19th June 2023, 22:16   #27  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
Quote:
Originally Posted by cubicibo View Post
The DELAY between subtitles appearance!
NOT the duration of the subtitle themselves or the delay between two (long duration) subtitles.

Subs1 and subs2 must not appear one after the other in short time.
In TextST, ~1s is needed to decode a subtitle. Decoding of next subtitle starts AFTER the last subtitle appears on screen.


I cannot check it now. I will tell you this evening or tomorrow.
Yes, I know what you mean, one subtitle must appear more than 1 second after the other has appeared.

But the if the subtitles don´t overlap (as usual), the second subtitle should appear after the duration of first subtitle, plus the gap between them (PTSin2-PTSend1), so this is easier to find in Subtitle Workshop than looking at every subtitle start time and try to calculate the difference...

In Subtitle Workshop I can see the subs "Duration" in a glance or better find the shortest duration, for example.
edumj is offline   Reply With Quote
Old 20th June 2023, 01:04   #28  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
Quote:
Originally Posted by cubicibo View Post
This photo explains what you must ensure: https://i.imgur.com/NnNEngV.jpg

Here are the subtitles that needs to be corrected: https://textup.fr/714103Oo
"delta" = PTSin(current)-PTSin(previous) = D(CA)
This is the value that you must ensure is larger than 00:00:01:10.
-------
Convert to TES+MUI:
- Install python3 from Windows Store
- Download ScenariStream
- Open cmd.exe, cd to ScenariStream directory:
Code:
python3 client.py -s subs.textst -o subs.tes --textst
=> This will create subs.tes and subs.mui from subs.textst input.

Replace 0x81 segment:
- Use HxD or Hex Fiend (hex editor)
- In TES file, copy good 0x81 segment from Scenarist BD TES to SubtitleEdit TES. Replace all data up to '048E82' (not included). The length can change. You must NOT overwrite '048E82', this is all that matters!
- In MUI file, copy everything up to first '82' byte (not included). The length must not change.

- This photo shows you how many bytes to select in Scenarist BD TES file: https://i.imgur.com/28tfzYi.png. It can be different from 0x46, read the value and count in hex. You can verify that your count is correct when 0x82 is +3 bytes on the right.
- The highlighted section show what to replace in subs.tes. The content may be longer or shorter. You must not overwrite 048E82, this is all that matters.
https://i.imgur.com/tHaJYrF.png
- The highlighted section in subs.mui file must has constant length before and after change. Only a single byte should change (segment length).
I fixed the subs, and installed Pyhton 3.8 (the last for Windows 7) but I get this error:

Code:
Traceback (most recent call last):
  File "client.py", line 27, in <module>
    from scenaristream import EsMuiStream
  File "H:\Scenarist BD\Subtitulos\ScenariStream-main\scenaristream\__init__.py"
, line 61, in <module>
    class StreamFile:
  File "H:\Scenarist BD\Subtitulos\ScenariStream-main\scenaristream\__init__.py"
, line 131, in StreamFile
    def segments(self) -> list[bytes]:
TypeError: 'type' object is not subscriptable
Presione una tecla para continuar . . .
edumj is offline   Reply With Quote
Old 20th June 2023, 06:40   #29  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 120
It needs latest Python3.9 or more. You don't have any linux or more up to date Windows to do the conversion…? Send the file, then.
cubicibo is offline   Reply With Quote
Old 21st June 2023, 01:31   #30  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
Hi,

at last I think I have fixed everyting in both subtitles (I have 2 playlists), imported them in SubtitleEdit, change settings for 720p, and export to TextST, so they should be Ok in Scenarist BD.

By the way, I read something in your program about no more than 5 hours?? One of the PlayLists is almost 6 hours...

Right now I can't test it in another computer, if you can convert it, here it is:

https://www.dropbox.com/s/ebdw6edvfh6541s/Subs.zip?dl=0

edumj is offline   Reply With Quote
Old 21st June 2023, 20:38   #31  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 120
https://0x0.st/HT0f.7z

The 5 hour limit only applies to PES and IES streams (SUP-PGS, MNU-IGS).
If you want to be helpful in turn, I would welcome a PG stream (PES) with one subtitle every hour, up to 15 hour.
And one TextST stream that uses palette update functionality (if you can generate such thing in Scenarist).

Last edited by cubicibo; 21st June 2023 at 20:41.
cubicibo is offline   Reply With Quote
Old 21st June 2023, 22:09   #32  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
Still no luck...

If I import them as 720p 50 fps (the supposed format):

Code:
Error : Out of range, Region must exist within a Video area.
Error : TextST Decode error. H:\Scenarist BD\Subtitulos\SubtitleEdit-3.6.13\Moviestar.tes offset=0x0 (first byte of invalid segment).
Error : FilePath : H:\Scenarist BD\Subtitulos\SubtitleEdit-3.6.13\Moviestar.tes, 
 Decode failed.
May be the Region size it's still to big?? I copied the same parameters that work in Scenarist!



And, if I try 1080p at 25 fps, just to try:

Code:
Error : The interval from Start Time(previous Dialog Presentation) to Start Time is too close. minimum interval=00:00:02:00
Error : TextST Decode error. H:\Scenarist BD\Subtitulos\SubtitleEdit-3.6.13\Moviestar.tes offset=0x235 (first byte of invalid segment).
Error : FilePath : H:\Scenarist BD\Subtitulos\SubtitleEdit-3.6.13\Moviestar.tes, 
 Decode failed.
I think I read something about subtitle size and that interval... the bigger the subtitle more time has to pass between them!?


What is PES?
edumj is offline   Reply With Quote
Old 21st June 2023, 22:19   #33  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
Oh, at last I could try Lemony Pro and the supposed BDN XML for text subtitles is something like this:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<BDN Version="1.00" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BD-03-006-0092b BDN File Format.xsd">
	<Description>
		<Name Title="Title" />
		<Language Code="spa" />
		<Format VideoFormat="720p" FrameRate="50" DropFrame="false" />
		<Events NumberofEvents="1" Type="Text" CharacterCode="1" />
	</Description>
	<Palettes>
		<Palette PaletteID="0" ColorMode="RGB">
			<Entry Index="0" Y_R="0" Cb_G="0" Cr_B="255" T_A="0" />
			<Entry Index="1" Y_R="255" Cb_G="255" Cr_B="255" T_A="255" />
			<Entry Index="2" Y_R="0" Cb_G="0" Cr_B="0" T_A="255" />
			<Entry Index="3" Y_R="0" Cb_G="0" Cr_B="0" T_A="128" />
			<Entry Index="4" Y_R="255" Cb_G="255" Cr_B="255" T_A="255" />
			<Entry Index="5" Y_R="255" Cb_G="0" Cr_B="0" T_A="255" />
			<Entry Index="6" Y_R="255" Cb_G="255" Cr_B="0" T_A="255" />
			<Entry Index="7" Y_R="0" Cb_G="255" Cr_B="0" T_A="255" />
			<Entry Index="8" Y_R="0" Cb_G="255" Cr_B="255" T_A="255" />
			<Entry Index="9" Y_R="0" Cb_G="0" Cr_B="255" T_A="255" />
			<Entry Index="10" Y_R="255" Cb_G="0" Cr_B="255" T_A="255" />
			<Entry Index="11" Y_R="0" Cb_G="0" Cr_B="0" T_A="255" />
		</Palette>
	</Palettes>
	<Fonts>
		<Font FontID="0" FontFile="0000.otf" />
	</Fonts>
	<TextRegions>
		<Region RegionStyleID="0">
			<RegionStyle RegionHorizontalPosition="128" RegionVerticalPosition="72" RegionWidth="1024" RegionHeight="576" RegionPaletteID="0" BackgroundPaletteEntryID="0" />
			<TextBox TextBoxHorizontalPosition="10" TextBoxVerticalPosition="10" TextBoxWidth="1004" TextBoxHeight="556" TextFlow="1" TextHorizontalAlignment="2" TextVerticalAlignment="3" />
			<LineSpace LineSpace="64" />
			<FontInfo FontID="0" FontStyle="0x04" FontSize="48" FontPaletteEntryID="1" FontOutlinePaletteEntryID="2" FontOutlineThickness="0x02" />
		</Region>
	</TextRegions>
	<Events>
		<Event InTC="00:00:00:00" OutTC="00:00:03:00">
			<Text RegionStyleID="0" ReferenceText="Hola, qué tal? | Cómo te va?">00241B010F486F6C612C207175C3A92074616C3F1B0A001B010C43C3B36D6F2074652076613F</Text>
		</Event>
	</Events>
</BDN>
So, every subtitle must be encoded in some strange format!? And the "ReferenceText" is just informative...?

Anyway, it doesn't work either in Scernarist BD!:

Code:
Error : There is no Event element.
But it is!
edumj is offline   Reply With Quote
Old 21st June 2023, 22:42   #34  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 120
"lol". No one has used TextST for year so the feature could be totally broken in either Lemony Pro or Scenarist.

Anyway, I could re-use yet another header for 720p but if you have timing issue in 1080p file, it will also have timing issue in 720p file. TextST is shit, hence why it has been abandonned by all majors but also by the format (TextST is not available on 4K BD).

Here it is: https://0x0.st/HTGP.7z
It will likely not work, but that should give you enough data to do the work yourself from now on. Good luck, I did my best.

Quote:
Originally Posted by edumj View Post
Still no luck (...)
I literally took your files and used your header. So the subtitles lines are now probably too long and don't fit on the defined region.

Quote:
Originally Posted by edumj View Post
I think I read something about subtitle size and that interval... the bigger the subtitle more time has to pass between them!?
Yes, like PGS (=PES). But TextST is much more complex and slow because the player has to render subtitles from fonts, while PG it is just decoding and displaying images.
cubicibo is offline   Reply With Quote
Old 22nd June 2023, 16:18   #35  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 120
Try this with Scenarist:
https://forum.doom9.org/showthread.p...88#post1399988

If you have more Lemony Pro examples it could be helpful to write a new srt2bdn, by the way.

'00' <- unknown, maybe region ID.
'24' <- length of upcoming data (number of bytes, so total length - 2)
'1B 01 0F' <- Text data of length 0x0F
[UTF-8 text of this line]
'1B 0A 00' <- New line
'1B 01 0C' <- Text data of length 0x0C
[UTF-8 text of this line]

Easy to encode. But I cannot guarantee any timing because the decoding speed is not given in any patent. It is likely only available in the BD specs.

Last edited by cubicibo; 22nd June 2023 at 21:36.
cubicibo is offline   Reply With Quote
Old 2nd July 2023, 21:06   #36  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
Hi, at last I made it!

I loaded the srt in Aegisub, saved as .ass, opened it in Lemony Pro (with the import option), and Quick exported as "Sony BDN script Blu-ray v 1.00 Text" and you have the .xml correctly formatted and without PNGs, just text subtitles!

Although you have to make some changes to the xml (like change the extension of the font from .ttf to .oft) and adjust size and position of Region and Textbox.

But then there was another problem, the subtitles starts at the begining of the video (00:00:00:00) even if the first subtitle starts at min 30! So, they are out of sync! But I fixed it adding another "empty" subtitle at 00:00:00:02 (because it doesn't work at 00:00:00:00). It's not empty but with another style with transparent color.

I tested it in Scenarist QC and it crashed with some fonts (MS Sans Serif), but works Ok with others (like Arial) and the Outline doesn't show!, but when burned in disc and tested in PS3 and a LG Player it's seems to work ok!


Quote:
Originally Posted by cubicibo View Post
Here it is: https://0x0.st/HTGP.7z
It will likely not work, but that should give you enough data to do the work yourself from now on. Good luck, I did my best.

Thanks, I'll try it but now the link doesn't work. Oh, and I don´t know if the .textst by Subtitle Edit is correct (appart from the FPS and size) because when I open it in Lemony Pro it seems to detect the format (Scantitling 890) but there are some strange characters...
edumj is offline   Reply With Quote
Old 2nd July 2023, 21:24   #37  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
I can send you the final .xmls if you want them. I had to sepparate more subtitles, some 2 seconds or more. It seems that it has to do with CPS (characters per scecond?)

Quote:
Originally Posted by cubicibo View Post
Try this with Scenarist:
https://forum.doom9.org/showthread.p...88#post1399988

If you have more Lemony Pro examples it could be helpful to write a new srt2bdn, by the way.

'00' <- unknown, maybe region ID.
'24' <- length of upcoming data (number of bytes, so total length - 2)
'1B 01 0F' <- Text data of length 0x0F
[UTF-8 text of this line]
'1B 0A 00' <- New line
'1B 01 0C' <- Text data of length 0x0C
[UTF-8 text of this line]

Easy to encode. But I cannot guarantee any timing because the decoding speed is not given in any patent. It is likely only available in the BD specs.
edumj is offline   Reply With Quote
Old 3rd July 2023, 09:43   #38  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 120
Congrats. Sorry that I could not help more but working directly with raw TextST is too painful. It is why I worked a bit to create a new srt2bdn (text BDN), maybe I will finish it and release it. In the text BDN, you can then easily edit the text box position, size and so on to manage to import in Scenarist. Your sample would be helpful to me.

Also, seems like you need to complain to Scenarist LLC with your issues about timestamps. I bet they haven't tested their TextST stuff for years, as one uses it.

Scantitling 890 is different from TextST, so Lemony Pro will not parse the file correctly.
cubicibo is offline   Reply With Quote
Old 9th July 2023, 04:34   #39  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
Ok,

sorry for the delay, here it is!:
https://www.dropbox.com/s/ebdw6edvfh6541s/Subs.zip?dl=0

Hope this can help.
edumj 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 10:08.


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