Fix 40ms gap in rolling teletext subtitles - #2292
Conversation
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 2feb09a...:
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. |
|
the test failure is a CI infra 504 timeout, not related to the change so can any maintainer re-trigger the test |
|
Claude review, but I've reviewed the review First, ignore the CI run — it's invalid. The per-category results are: Options 0/86 XDS 0/34 General 0/27 WTV 0/13 CEA-708 1/14 A change inside Your change fixes a bug you didn't mention. On master, teletext pages that master: 00:00:00.997 --> 00:00:00.997 <- start == end this PR: 00:00:00.997 --> 00:00:01.037 Counted across the teletext samples I have locally:
Every zero-length cue disappears. That's very likely a large part of the blink But the reasoning in the description is wrong. You state that the WebVTT That's likely harmless (WebVTT allows touching cues, and it's what makes rolling ctx->page_buffer.hide_timestamp = timestamp - 1;
That gives the 1 ms separation you describe, still eliminates every zero-length
cue, and still removes the blink. If you'd rather keep touching boundaries,
that's defensible too — just say so explicitly and drop the claim about the
exporter's 1 ms.
Dead code: with hide_timestamp = timestamp, the guard immediately below can
never fire:
if (ctx->page_buffer.hide_timestamp > timestamp)
{
ctx->page_buffer.hide_timestamp = 0;
}
It was there to catch the unsigned underflow of timestamp - 40. Please remove
it, or keep it if you go with - 1, where it still guards timestamp == 0.
Unrelated to this PR, but I hit it while testing: 85c7fc1ad7…mpg and
f1422b8bfe…ts both segfault on --out=webvtt, identically on master and on
this branch. Not your problem — I'll open a separate ticket.
Please push the above and re-run CI. |
[FIX] Remove 40ms hide timestamp contraction in
telxcccausing rolling subtitle blinkIn raising this pull request, I confirm the following (please check boxes):
Reason for this PR:
Sanity check:
Fixes
Closes #2288
Problem
When converting DVB teletext subtitles to WebVTT, rolling/scrolling subtitles that update every ~40ms produce a visible blink or flash between cues in players such as Infuse.
The root cause is in
src/lib_ccx/telxcc.c. Thetelxcccomponent hardcodes a 40ms contraction on every subtitle hide timestamp:This was originally intended to hide a subtitle one video frame early on 25fps content. However, the WebVTT exporter independently subtracts 1ms from end timestamps to prevent adjacent cues from sharing the same boundary timestamp. The two reductions combine, producing a ~41ms gap between consecutive rolling teletext cues.
For rolling teletext that updates every ~40ms, this gap is effectively the same duration as a full cue, so compliant players interpret it as the subtitle completely disappearing before the next one appears causing the blink.
Two additional problems with the original approach:
Fix
Remove the 40ms contraction in
telxcc.cand let the WebVTT exporter's existing 1ms gap handle overlap prevention on its own. The 1ms gap is spec-compliant and imperceptible.Repro Instructions
The gap is also directly visible in the raw WebVTT output consecutive cues have a ~40ms hole between the end of one timestamp and the start of the next instead of being contiguous.