Log in

View Full Version : file format of the MPLS extensions for 3D playlists


r0lZ
4th September 2014, 18:21
When helping to debug BD3D2MK3D, Thalyn (http://forum.doom9.org/member.php?u=203429) has noticed that there is a big bug in the output of tsMuxeR 3D when it analyses the MPLS files. (I can't give a link because that was a conversation by PMs.) tsMuxeR shows the subtitles sorted in the order of their PIDs instead of in the order of the playlist, used by all player programs. And it assigns the 3D-plane numbers (found in the 3D extensions of the playlist) in the order of the PIDs instead of in the order of the playlist. That's the bug. Therefore, the 3D-plane assigned to a specific subtitle stream is sometimes wrong (although not often because usually the order of the streams in the playlist is identical to the order of the PIDs).

After some investigation, I have the certainty that Thalyn is right. Since tsMuxeR 3D is not developed any more, I will have to parse the MPLS file myself to find the correct order of the streams and the 3D-planes.

I can easily parse the "2D part" of the MPLS and retrieve the streams, because it's relatively well documented. But I don't know at all the format of the extensions, and specifically of the extension used to store the 3D-planes (called "STN table SS" in bdedit). Currently, I know only how to find the start of the extension section in the file (from the pointer at address 18 in the file), but I don't know how to find the "STN table SS" in the extension section, and the exact format of the data contained in the table (although it seems that it's a simple list of integer values).

I'm also interested in the SubPath entries extension, that lists the file names of the M2TS file(s) containing the MVC stream(s), but it's less important for me, and anyway, I suppose that the logic to find the tables within the extension section is identical for all tables.

Someone can help? Any pointer will be much appreciated.

bigotti5
8th September 2014, 04:29
pics from patent US 7836109 B2
http://members.aon.at/video.digital/ExtensionData_Index.png

here are my conclusions poking patents
never seen mpls with aligned subs so cant verify....

id1_id2 values:

0001 0001 -> PIP metadata
0002 0001 -> STN_table_SS
0002 0002 -> SubPath_entries_extension

STN_table_SS:

length 16b
Fixed_offset_during_PopUp_flag 8b (0x0=false or 0x80=true)
reserved 8b

Loop_primary_video_stream_entries (MVC)
stream entry
length 8b (0x9)
type 8b (0x2)
SubPath_id 8b (e.g 0x1)
SubClip_entry_id 8b (0x0)
stream_PID_of_subClip 16b (e.g 0x1012)
reserved 32b
stream_attributes_SS
length 8b (0x5)
stream coding type 8b (MVC=0x20)
video_format 4b (e.g 0x6 = 1080p)
framerate 4b (e.g 0x1 = 23.976)
reserved 24b
reserved 8b
number_of_offset_sequences 8b (up to 32 e.g 0x20)

Loop_PG_textST_stream_entries
PG_textST_offset_sequence_id 8b (e.g 0x2 for plane#2)
8b (if 0x0 -> next pg stream entry)
is_SS_PG (if 0x04 = 2P stereo mode)
is_top_AS_PG_TextST (if 0x02 = pg is top aligned)
is_bottom_AS_PG_TextST (if 0x01 = pg is bottom aligned)

if 2P stereo mode
stream_entry_for_Left_eye_PG
length 8b (0x9)
type 8b (0x2)
SubPath_id 8b (0x0)
SubClip_entry_id 8b (0x0)
stream_PID_of_subClip 16b (e.g 0x1201)
reserved 32b
stream_entry_for_Right_eye_PG
length 8b (0x9)
type 8b (0x2)
SubPath_id 8b (0x0)
SubClip_entry_id 8b (0x0)
stream_PID_of_subClip 16b (e.g 0x1200)
reserved 32b

if pg is top aligned
never seen ??? ...
if pg is bottom aligned
never seen ??? ...

Loop_IG_stream_entries
.....................
.....................

r0lZ
8th September 2014, 10:04
Huge thanks! I did know that you are the right person to reply. :-)

There are still things unclear to me (notably where are the 3D-plane numbers), but I guess that after having analysed some examples with the help of your description, I'll be able to understand everything.

Thanks again.

bigotti5
8th September 2014, 10:51
PG_textST_offset_sequence_id == plane number

r0lZ
8th September 2014, 11:55
OK, that's simple. The official terminology is sometimes so convoluted!

r0lZ
19th September 2014, 13:42
I have a question. Apparently, the number_of_offset_sequences in the STN_table_SS extension is always 0x20, regardless of the 3D-planes really defined in the MPLS file.

In this example, there are only 7 sequences (highlighted in green), but the number of sequences is the maximum (32, in red):

http://s30.postimg.org/uqqjbrcs1/2014_09_19_141923.png (http://postimage.org/)

I can't find a suitable way to detect the real number of sequences in the extension itself. However, I can use the number of subtitle streams present in the M2TS of the AVC. That works fine with the tests I did so far, but I'm sure it's not the correct method.

Do you know if the number of offset sequence is supposed to reflect the number of sequences in the MPLS, or the number of 3D-planes in the MVC video stream? I guess it's the second case, but that's strange. And if I'm right, how can I determine for sure the number of sequences present in the MPLS file?

bigotti5
19th September 2014, 16:17
the number_of_offset_sequences in the STN_table_SS extension is always 0x20, regardless of the 3D-planes really defined in the MPLS file.

It is not always 0x20.
It is the number of planes defined in SEI message of dependent view stream and independent from number of PG streams.
MPLS does not define any plane - it only points to defined planes in MVC SEI stream (or disable 3D sub using FF).

r0lZ
19th September 2014, 19:16
OK, that's what I suspected. And indeed, I've found examples with a smaller number_of_offset_sequences, and they correspond to the planes physically present in the MVC stream.
But my question remains. How can I know how many bytes I must read in the MPLS file to have the whole set of defined 3D-plane numbers? Is it supposed to be equal to the number of subtitle streams, or should I use the ext_data_length parameter to get the bytes up to the end of the table?

bigotti5
19th September 2014, 19:32
Is it supposed to be equal to the number of subtitle streams

Yes..

r0lZ
20th September 2014, 08:39
OK, thanks. BTW, using the ext_data_lenght value to stop the parsing works well too, and gives also the correct number of offsets.

Do you have some info about the format of the SubPath_entries_extension ?

Also, afaik, there is at least one flag related to the 3D in the "2D part" of the MPLS: The flag that tells that the base view (AVC) contains the right-eye view is bit 4 of the byte at offset 56 in the MPLS file. Are you aware of other 3D-specific flags or values contained in the MPLS file but not in the extensions? In particular, I would like to know if there is a flags that simply tells "this playlist is in 3D". (I know that it is possible to verify if a playlist is in 3D by examining the extensions, but I would prefer a simpler and quicker method.)

bigotti5
20th September 2014, 17:38
a flags that simply tells "this playlist is in 3D"
Not that I know of..

length 32 b
number_of_SubPath_extensions 16 b
length 32 b
reserved 8 b
SubPath_type 8 b
reserved 16 b
is_repeat_SubPath 8 b (0x0 or 0x1)
number_of_SubPlayItems 8 b
Loop_SubPlayItem
length 16 b
Clip_Information_file_name 40 b (e.g. 00075)
Clip_codec_identifier 32 b (M2TS)
reserved 28 b
sp_connection_condition 3 b (1=not seaml, 5=seaml, 6=seaml conc)
is_multi_Clip_entries 1 b
ref_to_STC_id 8 b
SubPlayItem_IN_time 32 b (45kHz ticks)
SubPlayItem_OUT_time 32 b
sync_PlayItem_id 16 b
sync_start_PTS_of_PlayItem 32 b

r0lZ
20th September 2014, 18:42
Thanks! :-)

r0lZ
20th September 2014, 19:47
Something is missing in the description of the SubPath_entries_extension. That doesn't work for multi-angle playlists. The additional clips are not present in the description, and of course everything that comes after is shifted. I think I can decipher the format myself, but I haven't tried yet...

bigotti5
20th September 2014, 20:00
I know but I have no 3D multiangle BDs - so cant help.

bigotti5
21st September 2014, 17:46
Here with multiangle

length 32 b
number_of_SubPath_extensions 16 b
length 32 b
reserved 8 b
SubPath_type 8 b
reserved 16 b
is_repeat_SubPath 8 b (0x0 or 0x1)
number_of_SubPlayItems 8 b (without angle clips)
Loop_SubPlayItem
length 16 b
Clip_Information_file_name 40 b (e.g. 00075)
Clip_codec_identifier 32 b (M2TS)
reserved 28 b
sp_connection_condition 3 b (1=not seaml, 5=seaml, 6=seaml conc)
is_multi_Clip_entries 1 b
ref_to_STC_id 8 b
SubPlayItem_IN_time 32 b (45kHz ticks)
SubPlayItem_OUT_time 32 b
sync_PlayItem_id 16 b
sync_start_PTS_of_PlayItem 32 b
Select_is_multi_Clip_entries
number_of_Clip_entries 8 b
reserved 8 b
Loop_subClip_entry
Clip_Information_file_name 40 b
Clip_codec_identifier 32 b
ref_to_STC_id 8 b
Loop_subClip_entry
.....
.....
Loop_SubPlayItem
.......
.......
Select_is_multi_Clip_entries
number_of_Clip_entries

r0lZ
21st September 2014, 18:00
Wow! That was fast! Thanks! :-)

bigotti5
21st September 2014, 18:02
Entries are short...

r0lZ
22nd September 2014, 09:03
I have still some questions about the audio formats.

In bdparse.h (from the sources of bdtools 1.5), I see this:

#define BD_AUDIO_FORMAT_MONO 1
#define BD_AUDIO_FORMAT_STEREO 3
#define BD_AUDIO_FORMAT_MULTI_CHAN 6
#define BD_AUDIO_FORMAT_COMBO 12 // Stereo ac3/dts,
// multi mlp/dts-hd

#define BD_AUDIO_RATE_48 1
#define BD_AUDIO_RATE_96 4
#define BD_AUDIO_RATE_192 5
#define BD_AUDIO_RATE_192_COMBO 12 // 48 or 96 ac3/dts
// 192 mpl/dts-hd
#define BD_AUDIO_RATE_96_COMBO 14 // 48 ac3/dts
// 96 mpl/dts-hd

I don't understand the BD_AUDIO_FORMAT_COMBO. Is it stereo when the coding type is AC3 or DTS, and multichannel when the coding type is DTS-HD? And to what coding type corresponds the MLP format?

Similarly, the two BD_AUDIO_RATE_*_COMBO are difficult to understand. Is it also a different rate depending on the coding type? And what means MPL? Typo?

I would also like to know if it is possible to retrieve the exact number of channels from the MPLS. The mono and stereo formats are simple, but for the multi-channels and combo formats, is it a way to know for sure the exact number of channels without having to look in the M2TS?

Another question regarding the IG streams. In all BDs, there are usually some playlists with the same M2TS repeated about 100 times. They are obviously looping menus. In that menus, I was expecting to find a non-zero number of IG streams, but apparently it's not the case. There are no PG streams either. Is it normal? (I don't know at all how the menus are handled internally so it's certainly a basic question, but I would like to understand even if I don't need that info for BD3D2MK3D.)

I would also like to know in what 3D BD I can find an example of a playlist with secondary video and audio, or with a PIP video. (I have seen an example of PIP previously, but I don't remember what movie it was.)

bigotti5
22nd September 2014, 20:25
HD Audio can be DTS-HD and Dolby TrueHD.
DTS-HD consists of a (lossy) core stream (standard DTS) and one or several extensions (extensions are based on core stream).
If Core frequency is different from ExtSubstream frequency BD_AUDIO_RATE Code is 0xC for 192kHz and 0xE for 96kHz.
Core
--------------------------------
Real-Core ExtAudio ExtSubstream MPLSfreqCode
-------------------------------- ----------------------------
DTS-HiR 48 DTS 48khz - XBR 1
DTS-HiR 96 DTS 48kHz - X96K E
DTS-HD-MA 48 DTS 48kHz - XLL 48 1
DTS-HD-MA 96 DTS 48kHz - XLL 96 E
DTS-HD-MA 192 DTS 48kHz - XLL 192 C
DTS-HD-MA 96Core/96 DTS 48kHz X96K XLL 96 4
DTS-HD-MA 96Core/192 DTS 48kHz X96K XLL 192 C

Similar for Dolby Lossless.
Blu-ray TrueHD consists of a (lossy) core AC3 stream and a lossless MLP stream (MLP stream is independent from core).
As the core AC3 stream here is fully independent the core stream can be e.g. 2 channel stereo 48 kHz and the corresponding MLP stream can be 5.1 channel 192 kHz.
BD_AUDIO_FORMAT code would be 0xC (stereo + multichannel), BD_AUDIO_RATE Codes are the same as for DTS, here 0xC for 192kHz.

Dont know if different channel format is possible for DTS.
DTS HD Encoder does not allow different channel in core and extension (or I am too stupid to do).

bigotti5
22nd September 2014, 21:20
I was expecting to find a non-zero number of IG streams, but apparently it's not the case.

IG streams are for HDMV menus - you are obviously parsing BD-J discs.

playlist with secondary video and audio, or with a PIP video

AFAIK the spec does not allow for PiP in 3D playlists.

r0lZ
24th September 2014, 07:25
Thanks for the precisions.

You wrote:


if 2P stereo mode
stream_entry_for_Left_eye_PG
[...]
stream_entry_for_Right_eye_PG
[...]

Are you sure the 2 streams are always for the left and right eyes, in that order? When the base view is the right eye, I wonder if the order is inverted. In that case, the correct format would be:

if 2P stereo mode
stream_entry_for_Base_view_PG
[...]
stream_entry_for_Dependent_view_PG
[...]

That seems logical. Am I right?
Unfortunately, I can't test with the only example of 2P stereo I have here.

bigotti5
24th September 2014, 12:34
Not sure but....
Mux schema in scenarist and bluprint designates it as stream_entry_for_Left_eye_PG and stream_entry_for_Right_eye_PG (scenarist is not capable of 2P stereo mode though).
Video, PGs, IGs are decoded to total different planes (PG pictures are totally independant from each other, no need for base and dependant)
BDedit and tsMuxer abbreviations (there is a bug in BDedit ExtData for stream # in lower pane for sPIDR though)

and most important
Specs are never logical :-))

r0lZ
24th September 2014, 12:48
and most important
Specs are never logical :-))Unfortunately! :mad:

Anyway, I will probably not implement the conversion of the stereo PGS in BD3D2MK3D, at least currently. If a good example becomes available, I will do it, but it's not urgent.

Thanks again for your help!

zza
26th September 2014, 18:11
I am trying to use a 3D clip as menu background. The playlist is created but the "edit offset metadata sequences" operation is disabled. The doc says this means the dependent view mvc stream contains no offset metadata sequences...

Any solutions?

(I want to move the menu IG a little)

bigotti5
26th September 2014, 18:39
Open dependant view stream in any Hexeditor and show me the first 300 bytes.

zza
26th September 2014, 21:40
Open dependant view stream in any Hexeditor and show me the first 300 bytes.

From another Panasonic demo disc (year 2012). All its 3D clips have this "problem"(?)

EDIT: removed image, see next post.

tebasuna51
26th September 2014, 23:53
@zza
Seems you use HxD (hex editor).
If you select the same info than the image and Edit -> Copy As -> Editor view, you can paste here the same info (1,71 KB) instead use a jpg with 194,5 KB.

And you don't need wait until a moderator approve your attachement.

zza
27th September 2014, 05:34
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

00000000 00 00 00 01 18 30 00 00 00 01 6F 80 00 29 4B 63 .....0....o€.)Kc
00000010 49 1C 2C 50 4B 8C C6 71 66 8C 39 84 70 87 E2 CD I.,PKŒÆqfŒ9„p‡âÍ
00000020 18 73 08 E1 0F D0 88 E1 22 03 1C 10 7E 55 31 48 .s.á.Јá"...~U1H
00000030 33 84 3F 2A 98 A4 19 C2 1F 8D 25 34 BA B5 24 B2 3„?*˜¤.Â..%4ºµ$²
00000040 4D 3E 68 40 5C F3 45 62 F1 51 9F 19 FF FD 1A 9A M>h@\óEbñQŸ.ÿý.š
00000050 5D 78 AF 8C FC 29 FC 31 FF FF FF CB 64 01 E0 08 ]x¯Œü)ü1ÿÿÿËd.à.
00000060 9F 97 01 10 00 00 3E 90 00 0B B8 0E 66 00 01 31 Ÿ—....>...¸.f..1
00000070 2D 00 00 72 70 EB DE E0 CC C0 00 26 25 A0 00 0E -..rpëÞàÌÀ.&%*..
00000080 4E 1D 7B DC 0A A9 55 56 53 0A 96 15 40 00 00 FA N.{Ü.©UVS.–.@..ú
00000090 40 00 2E E0 39 98 00 04 C4 B4 00 01 C9 C3 AF 7B @..à9˜..Ä´..Éï{
000000A0 83 33 00 00 98 96 80 00 39 38 75 EF 70 28 00 00 ƒ3..˜–€.98uïp(..
000000B0 00 01 68 4A E3 0C CE 34 91 C2 C5 04 B8 CC 67 16 ..hJã.Î4‘ÂÅ.¸Ìg.
000000C0 68 C3 98 47 08 7E 2C D1 87 30 8E 10 FD 08 8E 12 hØG.~,ч0Ž.ý.Ž.
000000D0 20 31 C1 07 E5 53 14 83 38 43 F2 A9 8A 41 9C 21 1Á.åS.ƒ8Cò©ŠAœ!
000000E0 F8 D2 53 4B AB 52 4B 24 D3 E6 84 05 CF 34 56 2F øÒSK«RK$Óæ„.Ï4V/
000000F0 15 19 F1 9F FF D1 A9 A5 D7 8A F8 CF C2 9F C3 1F ..ñŸÿÑ©¥×ŠøÏŸÃ.
00000100 FF FF FC 33 00 00 00 01 06 25 11 C0 10 00 0D 41 ÿÿü3.....%.À...A
00000110 A1 7B 00 00 03 00 01 A1 7B 00 00 03 00 10 80 00 ¡{.....¡{.....€.
00000120 00 00 01 06 25 21 40 05 1E 17 EE 8C 60 F8 4D 11 ....%!@...îŒ`øM.
00000130 D9 8C D6 08 00 20 0C 9A 66 4F 46 4D 44 81 00 AD ÙŒÖ.. .šfOFMD...
00000140 0F D2 80 80 16 80 00 80 00 00 00 01 06 25 0B C0 .Ò€€.€.€.....%.À
00000150 10 01 07 00 00 03 00 00 03 00 02 04 80 00 00 00 ............€...

bigotti5
27th September 2014, 12:03
Number of offset metadata sequences in this stream is 0 (.. ..AD 0F D2 80 80.. ..).
Not aware of any program can change this after encoding.

kit90
16th July 2016, 06:17
Loop_PG_textST_stream_entries
PG_textST_offset_sequence_id 8b (e.g 0x2 for plane#2)
8b (if 0x0 -> next pg stream entry)
is_SS_PG (if 0x04 = 2P stereo mode)
is_top_AS_PG_TextST (if 0x02 = pg is top aligned)
is_bottom_AS_PG_TextST (if 0x01 = pg is bottom aligned)

......................................................................................

if pg is top aligned
never seen ??? ...
if pg is bottom aligned
never seen ??? ...

Loop_IG_stream_entries
.....................
.....................


In 3D Blu-ray discs, what are "Top-Aligned Subtitles" and "Bottom-Aligned Subtitles"? How are they different from 1P Offset and 2P Stereo subtitles?