ltcsync
ltcsync copied to clipboard
Quality score for LTC track
It is desirable to assign a formal quality score to LTC tracks to help chose which stream to use, if at all, for sync.
Sometimes, random noise may look like LTC frames. Sometimes, LTC can bleed from one channel to another with unbalanced connections. Sometimes the audio hass too much noise that garbles LTC. Sometimes LTC generators do strange things.
For highest score, LTC streams would have:
- No gaps between frames: if one frame ends at sample 23187, the next frame begins at sample 23188. Another way to express this is ratio of number of frames to stream duration. A 3-minute stream with two or apparent frames is probably garbage.
- Valid time designations: LTC's binary-coded-decimal representation has room for invalid time (seconds and minutes up to 85, hours and frames up to 45); occurrences of these in a file represent errors.
- Consistent frame duration: delta quantization errors, all frames would have the same number of samples.
- Monotonic increase in frame numbers: skipping to the future (gaps in frames) or the past (repeating frames) indicates errors
- Consistent number of frames in a second: each second would have the same last frame, e.g., 23, 24, 29 for common frame rates.
- Agreement between frame length and max frame numbers: if frame durations imply 23.98fps, each second would have frames 0..23
- Drop-frame flag consistent with frame rate and frame numbering: Drop-frame flag is valid only for 29.97fps. With DF flag set, frames 0 and 1 must be absent in every second except those divisible by 10.
- Consistent drop-frame/non-drop-frame flags: all frames in a stream must have the same value for DF flag.
- Consistent direction: if a track contains forward and reverse frames, its quality is low.
It is yet unclear what relative weights we want to assign to these heuristics.
At user option, we can check that the framerate is one of the common ones, i.e. 23.98, 24, 25, 29.97 or 30fps. Any other framerates, while possible under LTC, are highly suspect.
Some of the heuristics remain unimplemented. It appears that in practice, gaps-between-frames test alone catches all the false positives we've been seeing. Additional real-world examples can help clarify the need for additional tests. It is desirable to measure the performance impact of these heuristics and weigh it against a more complete coverage.