Text
The Blu-ray format is capable of rendering text fonts, it is usually displaying subtitles, info or others things.
Text Subtitles
Blu-ray uses two types of subtitles, Presentation Graphics Stream (PGS) and Text Subtitle Steam (TextST) The Text Subtitle Stream (TextST) is a text-based subtitle format defined in the Blu-ray specification, designed to provide a lightweight, flexible alternative to the image-based Presentation Graphic Stream (PGS). Introduced as part of the HDMV (High Definition Movie Mode) framework, TextST is embedded within MPEG-2 Transport Stream (M2TS) files, typically in a separate stream from the main video and audio. Identified by the stream coding type 0x92
, it’s multiplexed with a unique Packet Identifier (PID) and relies on real-time rendering by the Blu-ray player, using text data and metadata to display subtitles with customizable styles. Unlike PGS, which pre-renders subtitles as bitmaps, TextST stores subtitles as raw text, paired with a palette and styling instructions, making it more compact and adaptable.
- Text Data: Stores subtitle text (e.g., dialogue or captions) in a compact, editable format, supporting multiple lines and basic formatting.
- Precise Timing: Uses Start PTS and End PTS for frame-accurate display, with durations as short as a single frame or spanning multiple seconds.
- Palette-Based Rendering: Supports an 8-bit palette (256 entries) with YCrCb colors and alpha, enabling monocolor text (e.g., white text, black background) or multi-color effects within the limit.
- Style Customization:
- Font Specification: References external OpenType font files (
.otf
or.ttf
) from the disc’s AUXDATA directory (e.g.,00001.otf
), with options for family, size, bold, italic, etc. - Positioning: Defines x, y coordinates and a rendering region (width, height) for precise screen placement.
- Text Styling: Includes alignment (left, center, right), color assignment from the palette, and effects like outlines or underlines.
- Region Control: Limits subtitles to a designated rectangular area, preventing overlap with video content or other elements.
- Dialog Types: Supports normal subtitles, forced subtitles (e.g., for on-screen text translations), and multi-segment sequences for longer text.
- Language Support: Includes a language identifier (e.g., ISO 639-2 code like "eng") per stream, allowing multiple TextST tracks for different languages on a disc.
- Compact Size: Significantly smaller file size than PGS due to its text-based nature, ideal for discs with many subtitle tracks.
- Palette Restriction: Limited to 256 palette entries per stream, restricting color variety compared to full RGB or deeper color spaces. Complex gradients or multi-color text within a single subtitle are impractical.
- Font Dependency: Relies on external .otf files, which must be present on the disc (in AUXDATA). If missing or incompatible, rendering defaults to a player’s fallback font, potentially altering the intended look.
- Rendering Overhead: Requires real-time rendering by the player, which may strain lower-end hardware compared to pre-rendered PGS subtitles, though this is rarely an issue with modern Blu-ray players.
- Limited Effects: Lacks advanced animation or dynamic effects (e.g., karaoke-style highlights) available in PGS or external formats like ASS, focusing instead on static text with basic styling.
- Player Support: While part of the Blu-ray spec, TextST isn’t as universally supported in software players (e.g., VLC, PowerDVD) when demuxed, often requiring conversion to formats like SRT or ASS, which may discard styling.
- Fixed Encoding: The spec doesn’t mandate UTF-8 universally within the M2TS stream (unlike Matroska adaptations), so character set compatibility can vary, potentially complicating multilingual support in edge cases. However, UTF-8 is the most commonly used and adopted.
- Font Selection:
- Font Family: References an external OpenType font file (
.otf
or.ttf
) stored in the Blu-ray disc’s AUXDATA directory (e.g.,00001.otf
). This allows the use of specific fonts like Arial, Times New Roman, or custom fonts included on the disc. - Font Variants: Supports basic typographic styles such as bold, italic, and potentially bold italic, depending on the font file’s capabilities and the DPS instructions.
- Font Size:
- Adjustable text size, typically specified in points or a relative pixel value compatible with Blu-ray’s rendering resolution (e.g., 1920x1080 for HD).
- Allows scaling to ensure readability across different screen sizes or subtitle densities (e.g., larger for main dialogue, smaller for secondary notes).
- Text Color:
- Colors are assigned from an 8-bit palette with up to 256 entries, defined in YCrCb color space (luma and chroma components).
- Each palette entry can specify a unique color for text, enabling monocolor subtitles (e.g., white text) or distinct colors for different elements (e.g., yellow for emphasis).
- Limited to 256 colors per stream, but these can be any YCrCb value, offering decent variety within Blu-ray’s video color range.
- Transparency (Alpha):
- Each palette entry includes an 8-bit alpha value (256 levels, from 0 = fully transparent to 255 = fully opaque).
- Enables semi-transparent text or backgrounds for subtle overlays, improving readability against complex video backgrounds (e.g., a faint gray text shadow).
- Positioning:
- X, Y Coordinates: Defines the exact screen position of the subtitle text or its rendering region, measured in pixels relative to the 1920x1080 HD frame (or scaled for other resolutions like 720p).
- Region Definition: Specifies a rectangular area (width and height) where the text is confined, allowing precise placement (e.g., bottom center, top left) to avoid obstructing key video content.
- Text Alignment:
- Supports horizontal alignment (left, center, right) within the defined region.
- May include vertical alignment options (top, middle, bottom), though this is less explicitly detailed in the spec and often tied to the region’s positioning.
- Background Styling:
- A background box can be rendered behind the text, assigned its own palette entry for color and alpha.
- Typically used for a semi-transparent black or gray box to enhance contrast and legibility, with control over its size and opacity.
- Outline and Border:
- Supports an outline or border around text characters, drawn using a separate palette entry.
- Thickness and color are adjustable (within the 256-color limit), often used to create a black outline around white text for readability on bright backgrounds.
- Basic Effects:
- Underline: A simple line beneath the text, styled via the font or palette.
- Limited to static effects—no dynamic animations (e.g., fades, wipes, or karaoke-style highlights) like those in PGS or ASS.
- The styling metadata is part of the DPS, applied to the text before rendering into an 8-bit indexed image. The player then uses the palette to translate this image into YCrCb colors with alpha, overlaying it onto the video.
- For example, a subtitle might use:
- Font: Arial, 24pt, bold.
- Text Color: White (palette entry #1).
- Background: Semi-transparent black box (palette entry #2, alpha = 128).
- Outline: Thin black border (palette entry #3).
- Position: Centered at the bottom (x=960, y=900 in a 1920x1080 frame).
- Palette Dependency:
- The background box’s color and transparency are defined by a single entry in the 8-bit palette, which supports up to 256 unique combinations of YCrCb color and 8-bit alpha (0 = fully transparent, 255 = fully opaque).
- Limitation: You’re restricted to one color and transparency level per background box within a given subtitle stream. You can’t have a gradient, multi-color pattern, or varying transparency within the box—every pixel of the background uses the same palette entry.
- Static Nature:
- The background box is a static rectangle with no dynamic effects (e.g., fading in/out, resizing over time, or animated borders).
- Limitation: It’s fixed for the duration of the subtitle’s display (from Start PTS to End PTS), lacking the flexibility of advanced subtitle formats like ASS, which can animate backgrounds.
- Single Box per Subtitle:
- Each Dialog Presentation Segment (DPS) typically defines one background box for the entire text block within its region.
- Limitation: You can’t assign separate background boxes to individual lines or characters within the same subtitle event. The box encompasses all text in the defined region uniformly.
- Outline Interaction:
- If the text has an outline (also drawn from the palette), the background box sits behind both the text and its outline, with no option to layer it differently (e.g., between text and outline).
- Limitation: This restricts creative control over depth or shadow effects, as the background can’t be styled independently of the text-outside layering.
- Rendering Constraints:
- The background box is part of the 8-bit indexed image rendered from the text and style data, subject to the same palette and alpha blending rules as the text itself.
- Limitation: Any transparency in the box (e.g., alpha < 255) blends with the video beneath it, which can reduce contrast if not carefully tuned to the video content.
A BD-J application can control the subtitles using the JMF control SubtitlingControl
, defined in the org.bluray.media
package. Using this will let the application turn on/off subtitles, select a language, discover other languages, and detecting if it's using either Presentation Graphics Stream or Text Subtitle Stream.
BD-J Text
- Font Support:
- BD-J uses vector-based fonts, typically OpenType (
.otf
or.ttf
) sourced from:- The Blu-ray disc (e.g., in the
BDMV/AUXDATA/
directory). - The player’s default font (if no disc font is provided).
- Network-downloaded fonts (for BD-Live applications with internet access).
- Developers can specify font families (e.g., Arial, Helvetica) and variants (e.g., bold, italic) via Java's
java.awt.Font
class.
- Text Styling:
- Basic Styles: Bold, italic, and bold-italic are supported, contingent on font availability.
- Size: Adjustable via point size or pixel height, scalable to fit the display resolution.
- Color: Full RGB color support via
java.awt.Color
, not limited to a 256-entry palette like TextST, allowing millions of colors. - Transparency: Alpha blending via
java.awt.AlphaComposite
, enabling semi-transparent text for effects like fades or overlays. - Outline/Shadow: Programmable outlines or shadows using drawing methods (e.g.,
Graphics2D
), though not native styles like TextST’s outlines.
- Positioning and Layout:
- Text can be drawn at any x, y coordinate on the graphics plane using
Graphics2D.drawString()
, offering pixel-level control. - Advanced Layout: The
java.font.TextLayout
class provides precise glyph positioning, kerning, and multi-line alignment (left, center, right), ideal for complex menus or subtitles. - Dynamic Positioning: Text can move or animate across the screen, synchronized with video playback or user input.
- Dynamic Rendering:
- Text can be updated in real-time based on user interaction (e.g., menu selections) or events (e.g., video frame triggers).
- Supports text animations (e.g., scrolling, fading) by redrawing text frames, leveraging Java’s event-driven model.
- Multilingual Support:
- Uses Unicode encoding (via Java’s native support), allowing text in virtually any language or script (e.g., Latin, Cyrillic, Kanji).
- Language-specific fonts can be loaded to match the content or user preference.
- Integration with Media:
- Text can be synchronized with video playback using Blu-ray-specific APIs (e.g.,
org.bluray.media
for playback control), enabling overlays like director’s commentary or interactive prompts tied to specific scenes.
- Resolution and Quality:
- Rendered at up to 1920x1080 for HD or 3840x2160 for UHD Blu-ray, with anti-aliasing for smooth edges, thanks to vector fonts and Java’s graphics engine.
- Menus: A BD-J application might display a main menu with "Play Movie" in bold Arial, 36pt, white with a black outline, centered at (960, 540).
- Overlays: During playback, text like "Chapter 1" could fade in at the top-left corner in italic Helvetica, 24pt, semi-transparent gray.
- Games: A trivia game might scroll player scores in red, 18pt, across the bottom of the screen.
- Performance Overhead:
- Real-time rendering of complex text (e.g., frequent updates or large strings) can tax lower-end Blu-ray players, as BD-J runs on a Java Virtual Machine (JVM) with limited resources (typically 300-600 MHz CPUs in early players).
- No hardware acceleration for text rendering— reliant on software processing.
- Font Dependency:
- If a specified font isn’t on the disc or supported by the player, it falls back to a default (often Arial or similar), potentially disrupting the intended design.
- Discs must include font files, increasing storage use (e.g., a few MB per font).
- No Native Subtitle Features:
- Unlike TextST, BD-J doesn’t have built-in subtitle-specific features (e.g., predefined background boxes or palette-based rendering), requiring developers to code these manually.However, a BD-J application can control the subtitles using the JMF control
SubtitlingControl
, defined in theorg.bluray.media
package. - Less efficient for static subtitles compared to TextST or PGS.
- Complexity:
- Requires Java programming expertise, unlike TextST’s simpler authoring process, making it less accessible for basic text needs.
- Debugging text layout issues (e.g., clipping, overflow) can be tricky without player-specific testing.
- Sandbox Constraints:
- Unsigned BD-J applications are limited in scope (e.g., no network font downloads), though signed apps (via BD-J security model) can access BD-Live features.
- Memory and graphics plane resources are shared with other BD-J elements (e.g., images, animations), potentially limiting text complexity.
- Lack of Advanced Effects:
- While animations are possible, BD-J doesn’t natively support effects like per-character styling, gradients, or 3D text without significant coding effort, unlike some modern subtitle formats.(Per-character styling in BD-J isn’t a built-in, out-of-the-box feature and requires manual programming effort)
![]() |
An example of a BD-J game using BD-J Text with OpenType fonts using MS Gothic for Japanese. (Kanon) |
Memory Limitations and Performance
The memory for storing and displaying text fonts in the graphics buffer is limited to 4 MB. If you go over the memory limit, you will receive an OutOfMemoryError
.
It should have a minimum font rendering performance of 50 characters per second for fonts up to 72 points in size and 25 characters per second for larger point sizes. These minimum performance recommendations have to take into account of Asian fonts and other complex fonts.
Author(s): Æ Firestone
Sources
- Blu-ray Disc Read-Only Format; Part 3 — Audio Visual Basic Specifications
- HD Cookbook: Pages 18-1 through 18-6🔗
- Scenarist BD Manual
- libbluray.java from VLC
Popular Pages
-
Oppo BDP-103 and BDP-103D are high-end Blu-ray players manufactured by Chinese company, Oppo Inc, who are known for their high quality Blu...
-
When creating a audio BD, it should have an easy-to-use navigation and hassle-free experience for users.
-
Reavon UBR-X100 is an high-end Ultra HD Blu-ray player from the French company, Reavon. There are two other identical models, UBR-X110 and ...