[BUG] encoders: WebVTT encoder generates invalid ## delimiter and malformed @import violating W3C specification

Open Beginner friendly
#2,465 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 7 days

@yasar710 is already working on this.

Since Nov 17, 2026.

  • #2467 by @yasar710 — open

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c
Domain
cli

Research direction

Both defects are in src/lib_ccx/ccx_encoders_webvtt.c: start with write_webvtt_header, where the STYLE block ends in the invalid ## token, then the @import call around line 278 that is emitted outside any STYLE block. Fix the block terminator to a plain blank line and emit the import as @import url("..."); inside a STYLE block. Done means running --webvtt --webvtt-css-rule=... on a sample input produces output a WebVTT parser accepts with no ## or bare @import(.

Written by the indexing model from the issue text.

Description

CCExtractor version: 0.94+ (git commit 77daaddb9f61a356e4a7732179212b192f9656b6)

Necessary information

  • Is this a regression (i.e. did it work before)? NO
  • What platform did you use? Linux (Ubuntu 24.04 LTS x86_64)
  • What were the used arguments? --webvtt --webvtt-css-rule="..." input.ts

Additional information

In src/lib_ccx/ccx_encoders_webvtt.c, write_webvtt_header outputs inline CSS styles when --webvtt-css-rule is provided:

if (context->webvtt_css_rule)
{
    fdprintf(context->out->fh, "STYLE\n\n::cue {\n%s\n}\n##\n\n", context->webvtt_css_rule);
}

Under Section 4.3 of the W3C WebVTT specification, blocks (such as STYLE or NOTE) must terminate and separate from subsequent blocks or cues with a blank line (\n\n). Emitting ##\n\n injects an invalid token into the WebVTT stream. In browser video players (Chromium, Firefox), this token is treated as an invalid cue identifier or malformed block, causing parsers to reject the styling block or fail cue playback.

Additionally, at line 278:

fdprintf(context->out->fh, "@import(%s);\n\n", context->sentence_cap_file);

External stylesheets are written directly into the file body without being enclosed inside a STYLE block and without valid CSS @import url("...") syntax.

Dominant language
C
Stars
919
Forks
604
Avg merge
13d 12h
Merged PRs (30d)
7

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from CCExtractor/ccextractor

All issues in CCExtractor/ccextractor

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.