Skip to content

Conversation

@cfsmp3
Copy link
Contributor

@cfsmp3 cfsmp3 commented Dec 27, 2025

Summary

Add native support for reading SCC (Scenarist Closed Caption) files directly, eliminating the need for external conversion tools like SCC2RAW.exe or Perl scripts.

  • New Rust parser module with SMPTE timecode parsing and CEA-608 hex pair extraction
  • Auto-detection of SCC format (with UTF-8 BOM handling)
  • New --scc-framerate option supporting 29.97 (default), 24, 25, 30 fps
  • Integration following the McPoodle DVD raw pattern

Closes #1293

Implementation Details

Files Added

  • src/rust/src/demuxer/scc.rs - Core SCC parser with 12 unit tests

Files Modified

  • Stream mode detection (C and Rust)
  • FFI exports (ccxr_is_scc_file, ccxr_process_scc)
  • Command line argument parsing
  • Integration in raw_loop()

Testing

Round-Trip Test

Verified caption preservation through the SCC format:

  1. Extract CEA-608 captions from video to SRT (original)
  2. Extract same video to SCC format
  3. Convert SCC back to SRT (roundtrip)
  4. Compare both SRT files

Result: 118/118 captions matched (100% accuracy)

=== Summary ===
Matching captions: 118/118 (100.0%)

Additional Tests

  • ✅ Multiple output formats (SRT, WebVTT, transcript)
  • ✅ Frame rate option (--scc-framerate 24)
  • ✅ UTF-8 BOM handling
  • ✅ All 260 Rust unit tests pass

Usage

# Basic usage
ccextractor input.scc -o output.srt

# With custom frame rate (for 25fps PAL content)
ccextractor input.scc --scc-framerate 25 -o output.srt

Test Plan

  • Round-trip test (video → SCC → SRT matches video → SRT)
  • Verify SRT output format
  • Verify WebVTT output format
  • Verify transcript output format
  • Test --scc-framerate option
  • Test UTF-8 BOM handling
  • Run Rust unit tests
  • Run full regression test suite

🤖 Generated with Claude Code

cfsmp3 and others added 3 commits December 27, 2025 00:54
Add native support for reading SCC files directly, eliminating the need
for external conversion tools like SCC2RAW.exe or Perl scripts.

Implementation:
- New Rust parser module (src/rust/src/demuxer/scc.rs) with:
  - SMPTE timecode parsing (HH:MM:SS:FF format)
  - Configurable frame rates: 29.97 (default), 24, 25, 30 fps
  - CEA-608 hex pair extraction
  - UTF-8 BOM handling
  - 12 comprehensive unit tests
- Stream mode detection in both C and Rust code
- FFI exports for C integration (ccxr_is_scc_file, ccxr_process_scc)
- New --scc-framerate command line option
- Integration in raw_loop() following the McPoodle DVD raw pattern

Testing performed:
- Round-trip test: video → SRT, video → SCC, SCC → SRT
  Result: 118/118 captions matched (100% accuracy)
- Multiple output formats verified (SRT, WebVTT, transcript)
- Frame rate option tested with 24fps sample
- UTF-8 BOM handling verified
- All 260 Rust tests pass

Usage:
  ccextractor input.scc -o output.srt
  ccextractor input.scc --scc-framerate 25 -o output.srt

Closes CCExtractor#1293

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Replace tabs with spaces in doc comments
- Use #[derive(Default)] with #[default] attribute
- Use array syntax for char pattern matching
- Apply clang-format to C files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
The scc_framerate field was not being initialized in the C init_options()
function, leaving it with an undefined value. This could cause undefined
behavior when the options struct is used before the Rust code initializes
the field.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@ccextractor-bot
Copy link
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 dc352a2...:
Report Name Tests Passed
Broken 13/13
CEA-708 14/14
DVB 7/7
DVD 3/3
DVR-MS 2/2
General 27/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 86/86
Teletext 21/21
WTV 13/13
XDS 34/34

Congratulations: Merging this PR would fix the following tests:

  • ccextractor --autoprogram --out=srt --latin1 --quant 0 85271be4d2..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 1974a299f0..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla dab1c1bd65..., Last passed: Never
  • ccextractor --out=srt --latin1 --autoprogram 29e5ffd34b..., Last passed: Never
  • ccextractor --out=spupng c83f765c66..., Last passed: Never
  • ccextractor --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --startcreditsnotbefore 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --startcreditsnotafter 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --startcreditsforatleast 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --startcreditsforatmost 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never

All tests passed completely.

Check the result page for more info.

Timing issues in tests 226-230 are pre-existing and unrelated to SCC support.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@ccextractor-bot
Copy link
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 921cbe0...:
Report Name Tests Passed
Broken 13/13
CEA-708 14/14
DVB 7/7
DVD 3/3
DVR-MS 2/2
General 24/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 81/86
Teletext 21/21
WTV 13/13
XDS 34/34

Your PR breaks these cases:

  • ccextractor --autoprogram --out=ttxt --latin1 1974a299f0...
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla dab1c1bd65...
  • ccextractor --out=srt --latin1 --autoprogram 29e5ffd34b...
  • ccextractor --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...
  • ccextractor --startcreditsnotbefore 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...
  • ccextractor --startcreditsnotafter 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...
  • ccextractor --startcreditsforatleast 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...
  • ccextractor --startcreditsforatmost 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...

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.

@cfsmp3 cfsmp3 merged commit b0800a1 into CCExtractor:master Dec 27, 2025
23 of 25 checks passed
@cfsmp3 cfsmp3 deleted the feat/scc-input-support branch December 27, 2025 15:16
@bbgdzxng1
Copy link

bbgdzxng1 commented Dec 29, 2025

@cfsmp3 thankyou very much, Carlos. Very useful addition to the tool. ❤️

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.

[QUESTION] - Scenarist Closed Caption (SCC) Input support

3 participants