Blu-Ray Software Development

IMPORTANT NOTE

I am now working under NDA with a BD-J content and tools developer and can no longer update this page.

About

There are three very different specifications for Blu-Ray: BD-ROM (read-only), BD-R (recordable), and BD-RE (rewritable). Each specification is tailored for a specific use and has a unique file structure on the disc.

Prerecorded movie titles are distributed as BD-ROM discs. From what I can tell, BD-ROM is the only specification that supports Blu-Ray interactive applications. However, I have observed that you can put BD-ROM files on a BD-RE disc and it will behave like a BD-ROM disc.

The Blu-Ray BD-ROM specification defines the BD-J interactive application environment. It’s based on DVB-MHP GEM 1.0.2 interactive TV specification, which uses Java as its programming language. Blu-Ray extends the GEM environment to provide Blu-Ray specific functionality. The Blu-Ray Disc Association offers some technical white papers which give an overview of the Blu-Ray technologies.

Sadly, the Blu-Ray specifications are very expensive and there is no third-party documentation on the Blu-Ray specific APIs. I take this to mean there is no legal way to use the Blu-Ray specific APIs without purchasing a specification and/or license.

There are also no public details about how to sign a BD-J .jar file. Signing gives access to additional features (network connectivity, access to local storage, cross-disc application lifespan). I assume the signing procedure is similar to J2ME, but I do not know what certificate signing authorities are trusted, and therefore where one would go to procure a legitimate signing certificate. I also do not know what permission strings are required to enable these features, or where I would put them (in the .jar manifest?).

Lastly, there are no publicly available simulators targeted at BD-J. I have found simulators oriented toward MHP and GEM, but those simulators are seemingly limited to standard-definition resolutions and do not implement the Blu-Ray APIs. I will experiment further.

Getting Started

I have pursued a Windows build environment, because my Blu-Ray playback environment is also Windows. But I see no theoretical reason why the following steps would not work as well under Linux.

  • Java SE JDK 5.0 (latest update — I used “10″)
  • Eclipse SDK 3.2.1
  • OpenMHP 1.0.4 binary package (free registration required)
  • JavaTV 1.1_01 binary reference implementation. It’s currently available only for Linux, but that’s OK because we’ll only use the .jars to compile against.
  • Personal Basis Profile 1.1 binary reference implementation (free registration required). This is also available only for Linux, but is fine to compile against.

Install the Java SE JDK and the bundled JRE.
Install (unzip) Eclipse.
Install (unzip) OpenMHP.
Install (unzip) the JavaTV binary package contained within the binary/documentation package.
Install (unzip) the Personal Basis Profile.

Start Eclipse and create a project which references javatv.jar from the JavaTV reference implementation, and basis.jar and btclasses.zip from the Personal Basis Profile. (TODO: instructions to .zip/.jar the OpenMHP classes for referencing.)

It’s crucial to change your “Java Compiler” settings to use compiler compliance level 1.4. If you use 5.0, the classes apparently won’t load. This suggests that the BD-J implementations are based on Java 1.4, and that compiling under a newer JDK introduces new features that older VMs can’t handle.

Create a .jar file: jar cvf app.jar *.class

Video/Audio Media

Preparation of media is beyond my intended scope. But I am experimenting with Apple’s Compressor and its HD DVD MPEG-2 output template. Many of Sony’s first Blu-Ray releases use MPEG-2, and it’s a lot easier to find programs that encode MPEG-2 at HD resolutions than it is to find VC-1 encoders (although I haven’t tried all that hard yet). Besides, for my experiments, I don’t care too much about video quality.

Filesystem

There are a few critical files that must be in place for a BD-J application to load from a BD-ROM filesystem:

  • BDMV\index.bdmv: contains a list of titles on the disc, and also specifies what content object gets run first, and which content object acts as the top menu for the disc. Content objects can be movie objects (which implement DVD-style menus) or BD-J objects (which refer to BD-J applications).
  • BDMV\BDJO\*.bdjo: A file representing a single BD-J application. A .bdjo file appears to contain filename patterns of files to preload (usually .jar files), the name of the .jar file that contains the application’s Xlet class, and the name of the Xlet class. There also seems to be some sort of search/classpath. And I see some characters that appear to be a language tag (for localizing BD-J applications?) and an application name (for display to the user?). Many of the strings are stored Pascal-style, with a preceeding byte indicating the length of the string. Starting at byte 8 of a .bdjo file, there appears to be a series of monotonically-increasing 4-byte pointers into the rest of the file.
  • BDMV\JAR\*.jar: Java .jar files containing the usual bundle of Java .class files and associated application resources.

Other files are involved in media playback:

  • BDMV\PLAYLIST\*.mpls: in progress…
  • BDMV\CLIPINF\*.clpi: in progress…

Many of the files have the following, semi-obvious structure:

    Header

  • 4 bytes: file type
  • 4 bytes: specification revision
  • 8 * 4 bytes: absolute pointer into file (chunks 2 through 9), or zero if unused
  • n bytes: first chunk (not referenced in prior pointer list)
    Chunk

  • 4 bytes: chunk length, not including this field
  • n bytes: varies per chunk type, in progress…

Some files terminate with one or more empty (four-byte) chunks. Other files just have extraneous bytes. The empty chunks would mean something if they were non-empty. This implies that the ordinal of the pointers at the beginning of the file might indicate what type of chunk is referenced.

I have found one case where the above chunk format does not seem to apply. In .bdjo files, sixth chunk (which looks like a Pascal-string Java classpath) doesn’t seem to have a length field. Instead, I’m guessing the sixth chunk is always known to be a particular type of data, and that chunk data extends to the end of the file.

I’m going to write a Python script to explode these various data files into separate files (one for each chunk of data). I’ll post that soon.

If, like me, you do not have a copy of the BD-ROM specification, the easiest way to get a BDMV file system is to copy one from a commercial Blu-Ray BD-J-enhanced movie disc. You’ll have to replace all of the video streams in BDMV\STREAMS (which are protected by AACS content protection) with unprotected placeholder streams. I made myself a BD-RE disc (using Blu-Ray authoring software) with some short HDV placeholder video clips, then replaced all of the files on the movie filesystem with copies of my placeholder video. This probably breaks the disc’s playlists, but doesn’t have any ill effect on the software player I’m using. Now that there are no protected streams on your filesystem, you may delete the AACS and CERTIFICATE folders if desired.

The commercial BD-J movies I have seen are set up to load BDMV\JAR\00001.jar (which is a BD-J menu) when the disc is first inserted. So you’ll replace that .jar file with your new .jar file.

Running Your Application

If you’re using a PC-based software Blu-Ray player, you can launch it against the filesystem without burning to disc first. This really tightens the development cycle.

With any luck, your application will load and run. If it doesn’t, well, your debugging tools are stone-age. The software player I’m using has no obvious debug output, and I would imagine that commercial hardware players do not have any sort of accessable debug output. Of course, I could be wrong… That would be nice.

Call For Help

If you’re working with BD-J and have any revelations you’d like to share, please leave a comment and I’ll incorporate it into this document. I’d particularly like information on:

  • Hardware players supporting BD-J, and does the methodology I describe above work for these players?
  • Additional titles using BD-J. For now, the only titles I have personally verified are “League of Extraordinary Gentlemen” and “Speed”, both recent releases by Fox Home Entertainment. The fastest way to tell if a Blu-Ray movie contains BD-J content is to examine the disc filesystem. If there are .jar files in BDMV\JAR\, the disc has BD-J applications.
  • Reverse-engineering insight into the structure of index.bdmv, MovieObject.bdmv, and .bdjo files. These files determine what titles are available on the disc, which one(s) are loaded initially, and which BD-J application(s) are executed with which titles. For reverse-engineering files under Windows, I recommend Hexplorer (see below). In my interpretation, I don’t see any conflict with the DMCA. The files relating to BD-J are not protected by any mechanism other than a lack of documentation, and there’s some public documentation of these files by Sun and the Blu-Ray Association. If you have a different opinion, please share it.

Links and References


6 comments to “Blu-Ray Software Development”

  1. Comment by Pehr:

    Hi
    Great article on Blu-Ray just the stuff I’ve been looking for, where and how to put JAR files and everything.

    Have you found any other information ?

    I’ve been developing for digtal TV before, but I’m thinking about doing some blu-ray stuff.

    What kind of Blu-Ray player do you have on your computer .. I would love to ask some more questions if possible

    thanks / merry christmas

  2. Comment by Lol:

    Hi!
    Nice work, I was thinking to do exactly the same thing but I found your web site ;-)

    I am based in Europe and we still haven’t got any BD-J titles released, as far as I read on forums also “the descent” US has bd-j, however many bdmv files should be the same for HDMV and BD-j titles.

    I am looking forward for a low cost authoring tool to generate bdmv, probabily a simple bdmv with 2 titles would be easier to understand, for now looks like they all generate bdav.

    I have a Samsung BD-P1000 (XET), the only one available for EU until now, others are coming really soon, probably this month.

    I tested BD-P1000 and doesn’t read BD-RE in any layout (udf 1.02/2.5 bdav, bdmv, jpeg, mp3 …) but it can actually read jpeg and mp3 from dvd-rw even with udf 2.5, however I was not able to make it play any bdav or bdmv :-(

    Actually both manual, web site specs and even a sticker on the player report that it doesn’t read bd-re and bd-r while dvd-r/-rw is reported as supported for jpeg and mp3.

    Some US guys wrote on forums that the first generation of Samsung BD-P1000 XAA, the US version, was able to read BD-RE but after the firmware upgrade released they were not able anymore.

    I hope to be able to make it play bdmv from dvd-rw or that soon or later samsung will release another firmware upgrade supporting home authoring of hd content and AVCHD cameras that actually use BDMV over dvd-rw.

    bests,
    Lol

  3. Comment by Lol:

    DVDit Pro HD can actually generate .iso files with udf 2.5 file system, BDMV directory hierarchy and HDMV files but as far as I understood no BD-J support.

    Hope to test it soon, I will let you know the outcomes.

    bye,
    Lol

  4. Comment by andrea venturi:

    hi, i’d like to test the bd-j development and test here in italy,
    so i purchased a sony blu ray recorder for PC and there’s inside a copy of the “powerdvd 6.6 bd edition”.

    i have been told that this powerdvd 6.6bd is bd-j compliant.

    indeed, inside the program filesystem tree i can find all the java classes of the bd-j environment, btclasses.zip etcetera (maybe they could also be useful as stub libraries when trying to compile bd-j applications..)

    nevertheless, we still don’t have, in italy, bd-j titles like Speed to run and study on, so i’d like to ask if someone can submit an archive with this files, just to get the idea:

    BDMV\index.bdmv
    BDMV\JAR\*.jar
    BDMV\BDJO\*.bdjo

    bye

  5. Comment by javeer:

    Thx so much!

    I’ve looking for some articles like this for several days. ^_^
    and i also study something about java tv api, now i’am very interesting
    in BD-J.

    I use PowerDVD now, and seems it support BD-J. Do you have experience on it?

    I want to write a simple BD-J program which can load some extra subtitles like *.srt for my Blue Ray movies. Do you know how to implement it?

    Thanks again!

  6. Comment by Peter:

    Hi there,
    I wonder how you got a file system to work with on the Bluray disk? I finally can play Pirates of the Caribbean with PowerDVD Ultra, but I can’t see any file system on the External Lacie Drive. Is there a way to copy or create a blu ray file system from scratch to test XLets?

    Thanks for any hints!

    /peter

Leave a Reply

*
To prove that you're not a bot, enter this code
Anti-Spam Image