Skip to content

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:

https://code.videolan.org/videolan/vlc/-/blob/1f7c0703c86c44982319a94259a9cdc0cdd380ce/modules/codec/cea708.c#L1538-1543

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 and cea708_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):

    vlcsnap-2021-10-03-16h51m45s679

    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:

    vlcsnap-2021-10-03-16h50m53s017

    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:

vlcsnap-2021-10-03-17h03m26s583

References:

Environment:

  • VLC version: 3.0.16
  • Platform: win64
Edited by Michael Farrell
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information