Off-by-one pen and window subtitle styles for CEA-708 DefineWindow
CEA-708-E DefineWindow
declares:
window style ID
: when non-zero, specifies 1 of 7 present window attribute styles...pen style ID
: when non-zero, specifies 1 of 7 present pen attribute styles...
Tables 26 and 27 define these presets, starting at 1.
VLC handles these styles here:
This goes into two arrays, cea708_default_pen_styles
and cea708_default_window_styles
, which start counting at 0.
As a result:
-
VLC renders CEA-708 captions using predefined window or pen styles incorrectly.
Depending on the value used, this may result in pop-up captions rendered in roll-up mode, or roll-up captions being rendered in ticker-tape mode, and have rather severe rendering problems.
-
Using pen style 7 or window style 7 results in styles being read from past the end of the arrays
cea708_default_pen_styles
andcea708_default_window_styles
.
Playing the sample files requires setting Input / Codecs
-> Preferred Closed Captions decoder
to CEA 708
. Files uploaded to stream.videolan.org:
-
define-window-style4-pen5-frame0.mp4
: uses window style 4 (NTSC style roll-up captions), pen style 5 (NTSC style proportional sans-serif).VLC incorrectly interprets this as window style 5 (roll-up captions with transparent background), pen style 6 (mono sans-serif, bordered text, transparent background):
This file upload is associated with #26159 (closed)
-
define-window-style7-pen7-frame0.mp4
: uses window style 7 (ticker-tape), pen style 7 (proportional sans-serif, bordered text with transparent background).VLC interprets this as window style 8 (overflow), pen style 8 (overflow), and renders the text as black-on-black in a box in the top third of the screen:
This file upload is associated with this bug.
With the exception of DefineWindow
commands, the tracks are identical, and are designed for roll-up display (styles 4 and 5), not ticker-tape (style 7). However, rendering as a black text on a black background is probably not the right answer. For comparison, setting window style 6, pen style 6 in the stream has legible text in VLC:
References:
- Spec document (free, but requires registration): https://shop.cta.tech/products/digital-television-dtv-closed-captioning
- Wikipedia: https://en.wikipedia.org/wiki/CEA-708#DefineWindow07_(0x98-0x9F,_+_6_bytes)
Environment:
- VLC version: 3.0.16
- Platform: win64