Skip to content

Conversation

@cfsmp3
Copy link
Contributor

@cfsmp3 cfsmp3 commented Dec 27, 2025

Summary

This PR addresses the remaining items from issue #1191 (SCC/CCD format improvements):

  • SCC Output Frame Rate: The --scc-framerate option now affects both input parsing AND output encoding (was hardcoded to 29.97fps)
  • Styled PAC Optimization: When captions start at column 0 with non-default color/font, uses a single styled PAC instead of indent PAC + mid-row code

Changes

1. SCC Output Frame Rate

  • Added scc_framerate to encoder_cfg and encoder_ctx structs
  • Added get_scc_fps() helper function in SCC encoder
  • Updated add_timestamp() to use configurable frame rate
  • Supports 24, 25, 29.97 (default), and 30 fps

2. Styled PAC (Preamble Address Code) Optimization

  • Added get_styled_pac_byte2() - computes byte2 for styled PACs (0x40-0x4F range)
  • Added row_uses_high_range() - determines which PAC byte range to use
  • Added write_styled_preamble() - writes styled PAC directly
  • Added can_use_styled_pac() - checks if optimization applies
  • Updated write_cc_buffer_as_scenarist() to use styled PAC when appropriate

This resolves the TODO comment at line 487: "Preamble code need to take into account font as well"

Test plan

  • Build succeeds
  • SCC output with different frame rates produces correct frame numbers
  • Rust SCC demuxer tests pass (12/12)
  • CI regression tests

Issue Reference

Fixes #1191

🤖 Generated with Claude Code

…utput

This commit addresses the remaining items from issue #1191:

1. SCC Output Frame Rate:
   - Added scc_framerate to encoder_cfg and encoder_ctx structs
   - The --scc-framerate option now affects both input parsing AND output
   - Supports 24, 25, 29.97 (default), and 30 fps

2. Styled PAC (Preamble Address Code) Optimization:
   - Added support for styled PACs that encode color/font at column 0
   - When captions start at column 0 with non-default style, uses a single
     styled PAC instead of indent PAC + mid-row code
   - More efficient output that matches professional SCC files

Files changed:
- ccx_common_option.h/c: Added scc_framerate to encoder_cfg
- ccx_encoders_common.h/c: Added scc_framerate to encoder_ctx
- ccx_encoders_scc.c: Added get_scc_fps(), styled PAC functions,
  and optimized write_cc_buffer_as_scenarist()
- common.rs: Copy scc_framerate to enc_cfg

Fixes #1191

🤖 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 b0800a1...:
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=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 --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.

@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 b0800a1...:
Report Name Tests Passed
Broken 13/13
CEA-708 14/14
DVB 6/7
DVD 3/3
DVR-MS 2/2
General 24/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 80/86
Teletext 21/21
WTV 13/13
XDS 34/34

Your PR breaks these cases:

  • ccextractor --autoprogram --out=srt --latin1 --quant 0 85271be4d2...
  • ccextractor --autoprogram --out=ttxt --latin1 1974a299f0...
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla dab1c1bd65...
  • ccextractor --out=srt --latin1 --autoprogram 29e5ffd34b...
  • ccextractor --out=spupng c83f765c66...
  • 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 b6d7c7e into master Dec 28, 2025
41 of 43 checks passed
@cfsmp3 cfsmp3 deleted the fix/issue-1191-scc-framerate-and-preamble-codes branch December 28, 2025 05:54
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.

[BUG/PROPOSAL] SSC and CCD feature implementation

3 participants