[PR #1916] feat(scc): Add configurable frame rate and styled PAC codes for SCC output #2713

Open
opened 2026-01-29 17:23:33 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/CCExtractor/ccextractor/pull/1916

State: closed
Merged: Yes


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

**Original Pull Request:** https://github.com/CCExtractor/ccextractor/pull/1916 **State:** closed **Merged:** Yes --- ## 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 - [x] Build succeeds - [x] SCC output with different frame rates produces correct frame numbers - [x] Rust SCC demuxer tests pass (12/12) - [ ] CI regression tests ## Issue Reference Fixes #1191 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claunia added the pull-request label 2026-01-29 17:23:33 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2713