Repository navigation
[FIX] Validate SCC SMPTE timecodes and handle 29.97 drop-frame - #2477
RohitSutar1823 wants to merge 4 commits into
Conversation
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
CCExtractor CI platform finished running the test files on linux. 172/238 tests matched the approved output:
66 tests do not match the approved output. That is the pass/fail verdict. Whether this branch caused it is a separate question, answered below.
Compared with the tip of master — test 9984, commit 24d1e0a:
Compared with the commit this branch was cut from: the same run as the tip of master (test 9984), so the comparison above already covers it. No test changes behaviour relative to the tip of master: every failure above fails there too, byte for byte. The approved output for those tests is out of date, which is a baseline to review rather than a regression in this branch. |
CCExtractor CI platform finished running the test files on windows. 172/238 tests matched the approved output:
66 tests do not match the approved output. That is the pass/fail verdict. Whether this branch caused it is a separate question, answered below.
Compared with the tip of master — test 9985, commit 24d1e0a:
Compared with the commit this branch was cut from: the same run as the tip of master (test 9985), so the comparison above already covers it. No test changes behaviour relative to the tip of master: every failure above fails there too, byte for byte. The approved output for those tests is out of date, which is a baseline to review rather than a regression in this branch. |
cfsmp3
left a comment
There was a problem hiding this comment.
This is Carlos' claude doing the first pass. Before Carlos takes a look, please address these issues.
-
Rejecting a timecode drops the whole line. When
parse_smpte_timecode()returnsNone,parse_scc()skips the line along with its commands. A drop-frame label that skips;00/;01at a minute that isn't a multiple of 10 is not legal SMPTE, but such labels exist. CCExtractor's own SCC writer (ccx_encoders_scc.c) derives the frame from wall-clock milliseconds, so a caption between 60.000 and 60.066 s is written as00:01:00;00. With this file:00:00:58;00 9420 9420 94ae 94ae 9470 9470 c1c1 942f 942f 00:01:00;00 942c 942c 9420 9420 94ae 94ae 9470 9470 c2c2 942f 942f 00:01:03;00 942c 942cmaster outputs both captions (
AA0–2 s,BB2–5 s). This branch drops the00:01:00;00line, soBBdisappears andAAstays on screen until 4.937 s. Please don't throw away lines with an unusual but readable label. For the skipped DF labels, treat them as the next valid frame (or convert them as-is), and keepNonefor timecodes that really can't be parsed (non-digits, wrong layout). -
The drop-frame change is a few milliseconds, not a timing bug fix. DF labels already follow wall-clock time, so the old formula and the new one differ by a few ms (
00:01:00;02: 60066 vs 60060). I exported SCC from 14 real 608 samples with master and imported them with master and with this branch. All 14 SRTs are byte-identical, so the importer's frame timing absorbs the difference. That's fine to keep, but please describe it accurately in the PR. -
Coordinate with #2452, which adds
SccFrameRate::Fps23_976in the same file.nominal_fps()has no arm for it, so whichever PR merges second won't compile until that's added (24 for 23.976).
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
Thanks for the detailed review and for providing the reproduction sample. I've addressed the requested changes:
Validation:
Thanks again for the helpful feedback. I've updated the implementation and regression tests for another review. |
cfsmp3
left a comment
There was a problem hiding this comment.
This is Carlos' claude doing the first pass. Before Carlos takes a look, please address these issues.
Thanks. The ;00/;01 mapping fixes the case I reported: my three-line file now keeps BB. The branch also merges cleanly onto current master (which now has #2452), and all 39 SCC tests pass on the merged tree. The same class of problem remains, though: any timecode the new validation rejects still drops the whole line and its commands.
-
Drop-frame labels at any rate other than 29.97 now lose every caption.
parse_smpte_timecode()returnsNonefor a;separator whenfps != Fps29_97, andparse_scc()then skips the line. Most SCC files in the wild use;labels. Take this file:Scenarist_SCC V1.0 00:00:01;00 9420 9420 94ae 94ae 9470 9470 c1c1 942f 942f 00:00:03;00 942c 942c 9420 9420 94ae 94ae 9470 9470 c2c2 942f 942f 00:00:05;00 942c 942c--scc-frameratemaster this branch (merged onto master) 29.97 2 cues 2 cues 30 / 25 / 24 / 23.976 2 cues 0 cues, exit code 10 The
f >= nominal_fpsandh > 23rejections behave the same way: a frame number that's out of range for the selected rate silently deletes that caption. Master converted these lines. A wrong label shouldn't cost the caption. Please convert these labels instead of dropping the line. Treat;as non-drop-frame at rates without drop-frame, and keepNoneonly for strings that can't be parsed (wrong layout, non-digits). If you want to flag a bad label, a warning is fine. -
Validation is done twice. After the fixed-layout check (
bytes.len() == 11with separators at 2, 5 and 8), the loop that collectsseparator_indicesand the checks after it (scc.rs:152and:158) can't find anything new. The separators are already known to be at 2, 5 and 8, so every other byte only needs to be a digit. Please reduce it to one check (layout plusis_ascii_digit()on the eight digit positions) and slice at the fixed offsets.
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
Updated the PR to address the review feedback:
The changes are pushed to the existing PR branch. Thank you for the feedback! |
Summary
Fixes #2464.
This PR improves SMPTE timecode parsing and validation in the Rust SCC demuxer.
Changes
HH:MM:SS:FForHH:MM:SS;FFformat.:) and drop-frame (;) timecodes.;00and;01) at non-tenth-minute transitions by treating them as the next valid;02frame.SccFrameRate::Fps23_976.Regression Tests
Added tests covering:
Testing
cargo fmt --checkpassed.cargo testpassed (445 tests).git diff --checkpassed.Scope
Changes are limited to
src/rust/src/demuxer/scc.rs.This PR improves SMPTE timecode validation, drop-frame conversion handling, and compatibility with existing SCC parsing behavior.