How to change the subtitles color using DVDBuilder

In order to change the subtitles color it is necessary to know the color indexes that are used in the subpicture stream and then to define those colors in the subpicture palette.

Details

The DVD subtitles are placed in a subpicture stream in an MPEG-2 file.

The subpicture stream contains a series of bitmaps in which the colors are defined not as absolute colors but as indexes from a color palette.

The color palette contains 16 colors and can be defined using the <subpicturePalette> tag in DVDBuilder. The color indexes are numbered from 0 to 15.

The undefined colors (indexes) in the subpicture palette default to white. Each subtitle bitmap uses up to 4 color indexes from this subpicture palette.

Example

If the subpicture stream uses color indexes 7 and 8, then the DVDBuilder project will look like this:

<?xml version="1.0" encoding="utf-8"?>
<dvd version="2.3" xmlns="http://www.primosoftware.com/dvdbuilder/2.3">
    <videoManager firstPlayNavigate="Title=1;"/>
    <titleSet>
        <subpictureStreams>
            <stream languageCode="EN" mpegStreamID="0xBD" mpegSubstreamID="0x20"/>
        </subpictureStreams>

        <titles>
            <title id="1" chapters="00:00:00">
                <subpicturePalette>
                    <color index="0" value="#000000" />
                    <color index="1" value="#000000" />
                    <color index="2" value="#000000" />
                    <color index="3" value="#000000" />
                    <color index="4" value="#000000" />
                    <color index="5" value="#000000" />
                    <color index="6" value="#000000" />
                    <color index="7" value="#FF0000" /> <!-- red -->
                    <color index="8" value="#00FF00" /> <!-- green -->
                    <color index="9" value="#000000" />
                    <color index="10" value="#000000" />
                    <color index="11" value="#000000" />
                    <color index="12" value="#000000" />
                    <color index="13" value="#000000" />
                    <color index="14" value="#000000" />
                    <color index="15" value="#000000" />
                </subpicturePalette>
                <videoObject file="movie.mpg" />
            </title>
        </titles>
    </titleSet>
</dvd>

If the subtitles in this sample are designed, so that color index 7 represents the main color (fill) and color index 8 represents the outline. The result will be red text with green outline.

The subtitle color is also affected by the pixel contrast (transparency). The effective color can be a mix of the color coming from the subpicture palette and the color of the video content.

Both subpicture transparency and color indexes are part of the subpicture stream and cannot be changed by DVDBuilder. DVDBuilder only remaps the already used color indexes to different colors.


Blog Comments powered by Disqus.

Search