ccextractor icon indicating copy to clipboard operation
ccextractor copied to clipboard

[BUG] Unescaped caption text breaks WebVTT and SMPTE-TT output

Open harshalsp07 opened this issue 1 month ago • 2 comments

Caption text <BOB> & HI is written without escaping: WebVTT loses <BOB> when rendered, and SMPTE-TT produces invalid XML. Both commands exit with status 0.

Tested: Linux x86_64, CCExtractor 0.96.5 at 6c9fc900. Regression status unknown.

Reproduce

Download markup.bin, a 77-byte RCWT sample containing that caption, then run:

ccextractor markup.bin --out=webvtt -o markup.vtt
ccextractor markup.bin --out=smptett -o markup.xml
python3 -c 'import xml.etree.ElementTree as E; E.parse("markup.xml")'

Actual result

  • WebVTT: Chromium's cue.getCueAsHTML().textContent gives & HI; the literal <BOB> is treated as a tag.
  • SMPTE-TT: output contains <span><BOB> & HI. XML parsing fails: not well-formed (invalid token): line 20, column 21.
  • Control: transcript output preserves the full caption. A HELLO WORLD sample produces parseable XML.

Sample generator and control · Generated WebVTT · Generated XML

Expected

Preserve <BOB> & HI as visible text and produce valid XML. Escape literal caption characters, e.g. &lt;BOB&gt; &amp; HI, without escaping encoder-generated formatting.

Related: #1703 proposed escaping for SRT but was closed without merging.

Screenshot

Actual generated WebVTT parsed in a browser verification page:

Original caption compared with browser-parsed output

harshalsp07 avatar Oct 30 '26 10:10 harshalsp07

Hi Harshal, are you already preparing the fix? I'd like to help with a coordinated regression-test scope if that would be useful.

I read the encoders at d7eb132. WebVTT writes caption characters separately from its generated italic/underline/colour tags, while SMPTE-TT processes the tagged decoder line. Tests should check that literal <BOB> & HI survives without turning the encoder's formatting tags into visible text. I also checked #1703 and #2400; the latter handles the separate credits-string bounds issue.

Could you and a maintainer delegate that test scope to me? I'd start by reproducing your sample on current master, then cover plain text, literal markup and styled captions, checking XML parsing and WebVTT cue text. I haven't built CCExtractor or run these cases yet.

Shubham-Padkonde avatar Oct 31 '26 11:10 Shubham-Padkonde

Hi, I'd like to take this issue. Could you assign it to me?

Anurag-S1ngh avatar Oct 31 '26 13:10 Anurag-S1ngh