[libbluray-devel] bd_read output m2ts and language tags

John Stebbins jstebbins at jetheaddev.com
Thu Apr 9 19:38:17 CEST 2020


On Wed, 2020-04-08 at 17:29 +0300, Shaya Potter wrote:
> I know, I have all that data, that's why I know its available, I read
> it out of bd_title_info
> 
> it's lost in the sense that if I dump the bd_read() data to a file,
> its lost, so if I'm streaming the m2ts (say over http), the reader
> (say vlc), doesn't have it.  vlc can enumerate the all the streams,
> but without the metadata associated with it  That's the problem I'm
> trying to solve.  perhaps there's a better way.  The best option
> would be something that preserves the random seek nature that I get
> with the bd "file descriptor" of libbluray.
> 
> i.e. I'd be ok with writing my own packets at the beginning of the
> stream if that was possible (and pointers given to me on how to do
> it) if that would solve the issue.
> 
> On Wed, Apr 8, 2020 at 4:53 PM Hendrik Leppkes <h.leppkes at gmail.com>
> wrote:
> > Information about languages is not "lost", it was typically never
> > in
> > those m2ts files. If you are interested in additional metadata, you
> > need to get it from the playlist files, which luckily libbluray
> > also
> > reads for you, so its just a matter of calling the right API
> > functions.
> > Similar, chapter information is also available through the
> > libbluray API.
> > 
> > - Hendrik
> > 
> > On Wed, Apr 8, 2020 at 12:19 PM Shaya Potter <spotter at gmail.com>
> > wrote:
> > >
> > > when I read a title with libbluray, i get a nice m2ts (I believe)
> > stream.  However, while this stream has all the video/audio/pg
> > streams, it loses the language associated with them (as part of
> > juts the clip info I guess, not the raw m2ts stream).
> > >
> > > Now, it seems that it is possible for this info to be part of the
> > mpegts stream (or at least I think), as ffmpeg can assign the
> > metadata language to it, but that just works now for audio streams
> > as ffmpeg is known to not be able to write hdmv_pgs streams to an
> > mpegts container.
> > >
> > > Any chance libbluray could just append the language metadata
> > itself (at least if asked by the api user?).
> > >
> > > not as important (and perhaps less possible), but what about
> > chapters?
> > >
> > > thanks.

What you're asking for is essentially a remux of the ts stream with
this information added. Seems to me this is beyond the scope of what
libbluray is meant to do. IIRC the information you want to add is
carried in descriptors in that program map table (PMT) of transport
streams. But I think m2ts do not have any PMTs. So to add this
information, you would have to build a complete PMT (which describes
all the elementary streams in the transport) and add the necessary
descriptors. Not an easy task and not something easily tought via a few
emals. You would have to read the mpeg transport stream spec to get a
complet enough understanding. But once build, you could just tack it on
to the start of the stream and you should be good to go.

Random seek behavior of libbluray is completely another matter.
libbluray is using the metadata of the disc structure for that.
Transport stream have no index. Even worse, transport stream timestamps
can have discontinuities (i.e. go backwards, jump forwards). There are
markers designating when a discontinuity is happening and a player
adjusts accordingly during linear playback, but you can't seek to some
random location in a stream and know how far in seconds you have
seeked.



More information about the libbluray-devel mailing list