Skip to content

Supported Formats

mjuhasz edited this page Oct 31, 2012 · 5 revisions

Sony BDN XML format

This format consists of an XML file containing all the information but the caption graphics and a number of PNG image files (one for each caption).
The XML file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<BDN Version="0.93" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BD-03-006-0093b BDN File Format.xsd">
  <Description>
	<Name Title="BDN Example" Content=""/>
	<Language Code="eng"/>
	<Format VideoFormat="720p" FrameRate="23.976" DropFrame="False"/>
	<Events Type="Graphic" FirstEventInTC="00:00:00:00" LastEventOutTC="02:26:38:18" NumberofEvents="22"/>
  </Description>
  <Events>
	<Event InTC="00:00:00:00" OutTC="00:00:05:00" Forced="False">
	  <Graphic Width="1" Height="1" X="0" Y="0">subtitles_0001.png</Graphic>
	</Event>
	...
	<Event InTC="02:26:35:12" OutTC="02:26:38:18" Forced="False">
	  <Graphic Width="601" Height="88" X="343" Y="511">subtitles_0022.png</Graphic>
	</Event>
  </Events>
</BDN>

Palettized or 24bit ARGB images are supported for import - the latter will be converted to a 256 color palette automatically. As a matter of fact, the BDN implementation of BDSup2Sub is pretty unrestricted regarding the image formats for import. Apart from PNG, also e.g. BMP, JPG or GIF files should work. Indeed every format supported by Java's ImageIO library will work. Note that BDSup2Sub will only export 8bit palettized PNGs with transparency (via tRNS tag) for maximum compatibility with Sonic Scenarist HDMV. Unfortunately, only a few (free) graphic programs support this format correctly. Paint.NET however seems to work just fine. So via BDN SUP export/import, it's even possible to alter any caption beyond the built-in possibilities of BDSup2Sub.

Note: although the BDN XML looks pretty straight forward and clean, the timing information in this format is a little weird for unknown reasons. Indeed the timings are always based on an integer frame rate. E.g. in the above example, while the frame rate is 23.976 Hz (24p), the time codes are related to a 24Hz Signal. E.g. for the end time this means:

02:26:38:18 (time code in XML)
2 hours = 2*60*60 seconds = 7200s 
26 minutes = 26*60 seconds = 1560s
38 seconds = 38s
18 frames = 18/24 s = 750ms
In sum this equals 8798750 ms.
Now since the given frame rate is really 23.976Hz, this value is multiplied by 1.001
This equals 8807548.75ms
This equals 2 hours, 26 minutes, 47 seconds and 549ms
2:26:47.549 (real time code displayed in BDSup2Sub)

Keep this in mind when editing the XML manually. It's weird, and believe me: I would have defined it in a more sensible way, but that's unfortunately how it works.

VobSub IDX file

There are several keywords in the IDX file that some tools may use and other don't. Here's a list of the keywords and what BDSup2Sub makes of them:

keyword example remark
size size: 720x576 screen size: Mandatory.
org org: 10, 10 origin: x,y position of upper left corner in pixels. Optional.
scale scale: 104%, 164% scaling factors for image: Ignored
(use conversion dialog settings or CLI options instead)
alpha alpha: 0% global alpha blending factor: Ignored.
smooth smooth: OFF apply smoothing algorithm: Ignored.
fadein/out fadein/out: 50, 50 create fade in/out (times in ms): Ignored.
align align: OFF at LEFT TOP force caption placement: Ignored.
time offset time offset: 0 Global delay in in ms or hh:mm:ss:ms: Optional.
forced subs forced subs: OFF Show only forced captions: Ignored.
(use export dialog setting or CLI options instead)
palette palette: 000000, 141207, [...], bdab4f 16 color DVD subtitle palette: Mandatory.
custom colors custom colors: OFF, tridx: 1111, colors: 000000, [...], bdab4f Global palette/alpha setting: Ignored.
langidx langidx: 7 Active language index: Mandatory.
id, index id: en, index: 7 Language ID and caption index: Mandatory.
(at least one index in the file must fit langidx)
timestamp, filepos timestamp: 00:01:47:520, filepos: 000000000 Timestamp and file offset of one caption: Mandatory

Regarding the language index: there are some tools that store multiple subtitle streams inside one SUB/IDX file (e.g. for different language). In this case, the "id, index" keyword does exist several times, where each appearance has a different index and a separate section of timestamps,filepos pairs defining the captions for this index. Note that BDSup2Sub ignores all captions but those after the id,index header that fits the language index defined via the "langidx" keyword.

Notes about SUP/IFO

The SUP/IFO format as defined by IfoEdit/VobEdit is supported since version 3.9.0 due to public demand. Internally (e.g. regarding RLE encoding, palette definitions etc.) it's virtually the same as SUB/IDX. Note that there are some limitations to this format though.
Firstly, the palette and the screen size are stored inside an IFO file. BDSup2Sub needs a valid IFO file for each SUP file and both have to share the same file name (except the extension of course). If you e.g. exported a file "english.sup" from a "VTS_02_1.VOB" and the according IFO is "VTS_02_0.IFO", then you need to copy the IFO and rename it to "english.ifo" to make BDSup2Sub accept it as input.
Note that BDSup2Sub recognizes the extension "IFO" for SUP/IFO, but not "SUP". The reason is that BDSup2Sub can differ between BD-SUP and HD-DVD-SUP during import only because both format have different packet identifiers. Unfortunately, HD-DVD-SUP and DVD-SUP use the same (outer) package structure so they can only be distinguished between during parsing of the command buffer. BDSup2Sub tries to treat a SUP file as SUP/IFO if there is an IFO file next to the SUP file with the same name. Otherwise it will treat a SUP with as "HD-DVD-SUP" and will throw an error if it is a SUP/IFO file but the IFO file is missing.
When exporting, you should be aware that there are only PAL and NTSC resolutions defined in the DVD format (and therefore in the IFO).Thus hires or cropped formats will lead to major problems, even when importing these files back in BDSup2Sub. I'd strongly suggest to use VobSub in such cases.