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 > (HD) DVD, Blu-ray & (S)VCD > (HD) DVD & Blu-ray authoring

Reply
 
Thread Tools Search this Thread Display Modes
Old 4th September 2014, 18:21   #1  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,304
file format of the MPLS extensions for 3D playlists

When helping to debug BD3D2MK3D, Thalyn 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.
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 8th September 2014, 04:29   #2  |  Link
bigotti5
Spielberger
 
bigotti5's Avatar
 
Join Date: Feb 2005
Posts: 837
pics from patent US 7836109 B2


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

Code:
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
     .....................
     .....................
bigotti5 is offline   Reply With Quote
Old 8th September 2014, 10:04   #3  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,304
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.
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 8th September 2014, 10:51   #4  |  Link
bigotti5
Spielberger
 
bigotti5's Avatar
 
Join Date: Feb 2005
Posts: 837
PG_textST_offset_sequence_id == plane number
bigotti5 is offline   Reply With Quote
Old 8th September 2014, 11:55   #5  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,304
OK, that's simple. The official terminology is sometimes so convoluted!
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 19th September 2014, 13:42   #6  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,304
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):



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?
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 19th September 2014, 16:17   #7  |  Link
bigotti5
Spielberger
 
bigotti5's Avatar
 
Join Date: Feb 2005
Posts: 837
Quote:
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).
bigotti5 is offline   Reply With Quote
Old 19th September 2014, 19:16   #8  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,304
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?
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 19th September 2014, 19:32   #9  |  Link
bigotti5
Spielberger
 
bigotti5's Avatar
 
Join Date: Feb 2005
Posts: 837
Quote:
Is it supposed to be equal to the number of subtitle streams
Yes..
bigotti5 is offline   Reply With Quote
Old 20th September 2014, 08:39   #10  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,304
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.)
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 20th September 2014, 17:38   #11  |  Link
bigotti5
Spielberger
 
bigotti5's Avatar
 
Join Date: Feb 2005
Posts: 837
Quote:
a flags that simply tells "this playlist is in 3D"
Not that I know of..

Code:
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
bigotti5 is offline   Reply With Quote
Old 20th September 2014, 18:42   #12  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,304
Thanks! :-)
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 20th September 2014, 19:47   #13  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,304
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...
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 20th September 2014, 20:00   #14  |  Link
bigotti5
Spielberger
 
bigotti5's Avatar
 
Join Date: Feb 2005
Posts: 837
I know but I have no 3D multiangle BDs - so cant help.
bigotti5 is offline   Reply With Quote
Old 21st September 2014, 17:46   #15  |  Link
bigotti5
Spielberger
 
bigotti5's Avatar
 
Join Date: Feb 2005
Posts: 837
Here with multiangle

Code:
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
bigotti5 is offline   Reply With Quote
Old 21st September 2014, 18:00   #16  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,304
Wow! That was fast! Thanks! :-)
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 21st September 2014, 18:02   #17  |  Link
bigotti5
Spielberger
 
bigotti5's Avatar
 
Join Date: Feb 2005
Posts: 837
Entries are short...
bigotti5 is offline   Reply With Quote
Old 22nd September 2014, 09:03   #18  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,304
I have still some questions about the audio formats.

In bdparse.h (from the sources of bdtools 1.5), I see this:
Code:
#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.)
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV

Last edited by r0lZ; 22nd September 2014 at 09:05.
r0lZ is offline   Reply With Quote
Old 22nd September 2014, 20:25   #19  |  Link
bigotti5
Spielberger
 
bigotti5's Avatar
 
Join Date: Feb 2005
Posts: 837
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.
Code:
                                     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).

Last edited by bigotti5; 23rd September 2014 at 08:52.
bigotti5 is offline   Reply With Quote
Old 22nd September 2014, 21:20   #20  |  Link
bigotti5
Spielberger
 
bigotti5's Avatar
 
Join Date: Feb 2005
Posts: 837
Quote:
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.

Quote:
playlist with secondary video and audio, or with a PIP video
AFAIK the spec does not allow for PiP in 3D playlists.

Last edited by bigotti5; 22nd September 2014 at 22:12.
bigotti5 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 02:57.


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