Skip to content

Fix SSA compliance issues #2310 - #2316

Open
alaotach wants to merge 6 commits into
CCExtractor:masterfrom
alaotach:fix-ssa-compliance-2310
Open

Fix SSA compliance issues #2310#2316
alaotach wants to merge 6 commits into
CCExtractor:masterfrom
alaotach:fix-ssa-compliance-2310

Conversation

@alaotach

Copy link
Copy Markdown
Contributor

In raising this pull request, I confirm the following (please check boxes):

Reason for this PR:

  • This PR adds new functionality.
  • This PR fixes a bug that I have personally experienced or that a real user has reported and for which a sample exists.
  • This PR is porting code from C to Rust.

Sanity check:

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • If the PR adds new functionality, I've added it to the changelog. If it's just a bug fix, I have NOT added it to the changelog.
  • I am NOT adding new C code unless it's to fix an existing, reproducible bug.

Repro instructions:

  1. Download the DresdenTest.ts sample provided in Issue Substation Alpha (SSA/ASS) output is not fully compliant with format specification #2310: DresdenTest.ts
  2. Run CCExtractor to generate Substation Alpha output:
    ccextractor DresdenTest.ts -out=ass
  3. Inspect the resulting .ass file.
    • Before this PR: The file contains two-digit hours (00:), misaligned milliseconds (.7 instead of .07), and raw HTML tags (<i>).
    • After this PR: The file contains compliant single-digit hours (0:), correctly padded milliseconds (.07), and ASS override tags ({\i1}).

Description

This PR resolves several compliance issues with the Substation Alpha (SSA/ASS) output generated by CCExtractor, addressing the bugs reported in #2310.

Fixes included:

  1. Timestamp Formatting

    • Changed the hour format from zero-padded two digits (%02u) to a single unpadded digit (%u) in all Dialogue: lines to comply with strict SSA parser expectations.
    • Fixed a critical padding bug where centiseconds/milliseconds were incorrectly formatted (missing leading zeros), which caused timestamp values to shift silently (e.g., 12.07s rendering as 12.7s).
  2. CEA-608 Override Tag Generation

    • Modified get_decoder_line_encoded() so that when outputting SSA, it emits valid SSA override tags directly (e.g., {\i1}, {\u1}, {\c&H00FF00&}) instead of generating HTML tags (<i>, <u>, <font...>) that are technically invalid in SSA.
    • Hoisted the SSA color mapping table (ssa_cols) to file-scope in ccx_encoders_helpers.c to ensure the emitted font colors stay safely synchronized with the tag-stack tracking logic.
  3. HTML-to-SSA Tag Translation (DVB/Teletext/708)

    • Implemented a table-driven tag replacement inside write_stringz_as_ssa() for subtitle formats that generate generic HTML-tagged C-strings upstream. This gracefully translates <i>, <u>, <b>, and <font color="#RRGGBB"> into their respective SSA equivalents ({\i1}, {\u1}, {\b1}, {\c&HBBGGRR&}) without breaking other format outputs that rely on the HTML representation.

Fixes #2310.

@ccextractor-bot

Copy link
Copy Markdown
Collaborator
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 6077cf5...:
Report Name Tests Passed
Broken 9/13
CEA-708 2/14
DVB 0/7
DVD 3/3
DVR-MS 2/2
General 22/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 69/86
Teletext 0/21
WTV 12/13
XDS 31/34

Your PR breaks these cases:

NOTE: The following tests have been failing on the master branch as well as the PR:


It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you).

Check the result page for more info.

@ccextractor-bot

Copy link
Copy Markdown
Collaborator
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit c328108...:
Report Name Tests Passed
Broken 9/13
CEA-708 2/14
DVB 0/7
DVD 3/3
DVR-MS 2/2
General 22/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 69/86
Teletext 0/21
WTV 12/13
XDS 31/34

Your PR breaks these cases:

NOTE: The following tests have been failing on the master branch as well as the PR:


It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you).

Check the result page for more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Substation Alpha (SSA/ASS) output is not fully compliant with format specification

2 participants