]> git.sesse.net Git - vlc/blob - doc/subtitles/cvd-subtitles.txt
Use var_InheritString for --decklink-video-connection.
[vlc] / doc / subtitles / cvd-subtitles.txt
1 $Id$
2 The following information is culled from information from 
3 Julio Sanchez Fernandez (http://subhandler.sourceforge.net)
4 by Rocky Bernstein. 
5
6 We do not have information on the subtitle format used on CVD's except
7 the submux sample code and a couple of samples of dubious
8 origin. Thus, the information below is result of reading some code
9 whose correctness is not known and some experimentation.
10
11 Please, if you have any corrections or additions to make, send
12 them to rocky@panix.com.
13
14 CVD subtitles are different in several ways from SVCD OGT subtitles
15 (see see corresponding info on that.)
16
17 The image data comes first and meta data is at the end.  So that the
18 metadata can be found easily, the subtitle packet starts with two
19 bytes (everything is big-endian again) that gives the total size of
20 the subtitle data and the offset to the metadata - i.e. size of the
21 image data plus the four bytes at the beginning.
22
23 As with OGT subtitles, Data for single screen subtitle may come in
24 several non-contiguous packets of a stream.  From the scant data on
25 the format, the only way known to detect the first packet in a
26 subtitle.  The first packet seems to have a valid PTS while later
27 packets for the same image don't.
28
29 The image data comes interlaced and is run-length encoded (RLE). Each
30 field is a four-bit nibbles that is further subdivided in a two-bit
31 repeat count and a two-bit color number - up to three pixels can be
32 described in four bits.  What a 0 repeat count means not known.  It
33 might be used for RLE extension.  There is a special case of a 0
34 repeat count that has been inferred: when the full nibble is zero, the
35 rest of the line is filled with the color value in the next nibble.
36 It is unknown what happens if the color value is greater than three.
37 The rest seems to use a 4-entries palette.  It is possible that the
38 fill-line general case above is not as described and the zero repeat
39 count means fill line.  But since this hasn't been ever seen, the
40 preceding is only conjecture.
41
42 Here is information given at the start of a subtitle:
43
44 SPU size        2 bytes
45 metadata offset 2 bytes
46
47 Although metadata information does come in a fixed field order, every
48 metadata field consists of a tag byte followed by parameters. In all
49 cases seen, the size including the tag byte is exactly four bytes.
50
51 code    Meaning 
52 ----    -------
53 0x0c    Unknown
54
55 0x04    24-bit subtitle duration in 1/90000ths of a second
56
57 0x17    upper left x, y position, each a 10-bit value, encoded:
58            x = ((p[1]&0x0f)<<6) + (p[2]>>2)
59            y = ((p[2]&0x03)<<8) + p[3];
60
61 0x1f    lower right x, y position, each a 10-bit (0-1023) value,
62         encoded as above 
63
64 0x24    3 bytes primary palette 0 - 1 byte for each of y, u, and v 
65 0x25    3 bytes primary palette 1 - 1 byte for each of y, u, and v
66 0x26    3 bytes primary palette 2 - 1 byte for each of y, u, and v
67 0x27    3 bytes primary palette 3 - 1 byte for each of y, u, and v
68
69 0x2c    3 bytes highlight palette 0 - 1 byte for each of y, u, and v 
70 0x2d    3 bytes highlight palette 1 - 1 byte for each of y, u, and v
71 0x2e    3 bytes highlight palette 2 - 1 byte for each of y, u, and v
72 0x2f    3 bytes highlight palette 3 - 1 byte for each of y, u, and v
73
74 0x37    3 bytes transparency for primary palette - 1 byte for each 
75         of y, u  and v
76
77 0x3f    3 bytes transparency for highlight palette - 1 byte for each 
78         of y, u  and v
79
80 0x47    Offset to start of even rows of interlaced image.
81 0x4f    Offset to start of odd rows of interlaced image.
82
83
84
85
86
87
88
89
90