Measure how far the sound is out of sync with the picture
0:20CC0 · Benoît Prieur
Proof frames
Tool calls
sync_check
Arguments
{
"source": "$CLIP",
"cues": [
{
"time_sec": 3.233333,
"label": "flash 1"
}
]
}
Result
{
"ok": true,
"data": {
"source_path": "~/hill/gallery/repo/cards/sync-monitoring/clip.mp4",
"tolerance_ms": 80,
"cue_recovery_window_ms": 500,
"search_window_ms": 500,
"bpm": null,
"beats_per_bar": null,
"cue_signatures": {},
"systematic_lags": [],
"cuts": [
{
"time_sec": 1.05,
"score": 0.0824,
"nearest_onset": {
"time_sec": 1.029333,
"strength": 0.159305
},
"offset_ms": -20.667
},
{
"time_sec": 3.233333,
"score": 0.965669,
"nearest_onset": {
"time_sec": 2.986667,
"strength": 1
},
"offset_ms": -246.666
},
{
"time_sec": 6.85,
"score": 0.991761,
"nearest_onset": {
"time_sec": 6.602667,
"strength": 1
},
"offset_ms": -247.333
},
{
"time_sec": 10.466667,
"score": 1,
"nearest_onset": {
"time_sec": 10.218667,
"strength": 1
},
"offset_ms": -248
},
{
"time_sec": 13.55,
"score": 0.07264,
"nearest_onset": {
"time_sec": 13.536,
"strength": 0.147649
},
"offset_ms": -14
},
{
"time_sec": 15.55,
"score": 0.089426,
"nearest_onset": {
"time_sec": 15.557333,
"strength": 0.162777
},
"offset_ms": 7.333
},
{
"time_sec": 19.15,
"score": 0.074186,
"nearest_onset": {
"time_sec": 19.130667,
"strength": 0.146841
},
"offset_ms": -19.333
}
],
"cues": [
{
"time_sec": 3.233333,
"label": "flash 1",
"status": "early",
"matched_onset_time_sec": 2.986667,
"offset_ms": -246.666,
"nearest_onset_time_sec": 2.986667,
"nearest_onset_offset_ms": -246.666,
"cue_group": "flash",
"dominant_band": "44.2-55.7 Hz",
"simple_check_on_time": false,
"simple_check_onset_offset_ms": null,
"simple_check_level_db": -120,
"simple_check_reference_db": -120,
"simple_check_reference": "preceding_90ms",
"group_typical_level_db": null,
"template_status": "early",
"evidence": "template_and_simple_agree",
"audible_in_any_band": false,
"signature_bands": [],
"signature_sample_count": 0,
"signature_score": 1,
"group_median_score": null,
"group_typical_attack_lag_ms": null,
"on_cue_score": null,
"companion_gain": null,
"displaced_time_sec": null,
"shifted_null_floor": null,
"credible_score_floor": null,
"slot_before_ms": null,
"slot_after_ms": null,
"signature_excess_ratio": null,
"search_window_ms": 500,
"match_method": "broad_onset",
"ambiguous_reason": null,
"candidate_onsets": [
{
"time_sec": 2.986667,
"offset_ms": -246.666,
"strength": 1
},
{
"time_sec": 3.488,
"offset_ms": 254.667,
"strength": 1
},
{
"time_sec": 3.594667,
"offset_ms": 361.334,
"strength": 0.161415
},
{
"time_sec": 3.642667,
"offset_ms": 409.334,
"strength": 0.146253
},
{
"time_sec": 3.68,
"offset_ms": 446.667,
"strength": 0.127184
},
{
"time_sec": 3.712,
"offset_ms": 478.667,
"strength": 0.138945
}
]
}
],
"unmatched_strong_onsets": [
{
"time_sec": 3.488,
"strength": 1,
"band_db": {
"sub": -22.648,
"low_mid": -27.738,
"mid": -26.757,
"high": -48.186,
"air": -64.282
}
},
{
"time_sec": 6.602667,
"strength": 1,
"band_db": {
"sub": -35.622,
"low_mid": -29.876,
"mid": -7.489,
"high": -49.071,
"air": -60.148
}
},
{
"time_sec": 7.114667,
"strength": 1,
"band_db": {
"sub": -27.621,
"low_mid": -35.03,
"mid": -37.589,
"high": -59.459,
"air": -76.532
}
},
{
"time_sec": 10.218667,
"strength": 1,
"band_db": {
"sub": -42.692,
"low_mid": -35.052,
"mid": -7.164,
"high": -35.119,
"air": -39.774
}
},
{
"time_sec": 10.741333,
"strength": 1,
"band_db": {
"sub": -30.273,
"low_mid": -30.341,
"mid": -33.258,
"high": -54.643,
"air": -79.167
}
}
],
"uncued_sounds": [],
"strong_onset_threshold": 0.5,
"total_cuts": 7,
"total_cues": 1
}
}
sync_check
Arguments
{
"source": "$CLIP",
"cues": [
{
"time_sec": 6.85,
"label": "flash 2"
}
]
}
Result
{
"ok": true,
"data": {
"source_path": "~/hill/gallery/repo/cards/sync-monitoring/clip.mp4",
"tolerance_ms": 80,
"cue_recovery_window_ms": 500,
"search_window_ms": 500,
"bpm": null,
"beats_per_bar": null,
"cue_signatures": {},
"systematic_lags": [],
"cuts": [
{
"time_sec": 1.05,
"score": 0.0824,
"nearest_onset": {
"time_sec": 1.029333,
"strength": 0.159305
},
"offset_ms": -20.667
},
{
"time_sec": 3.233333,
"score": 0.965669,
"nearest_onset": {
"time_sec": 2.986667,
"strength": 1
},
"offset_ms": -246.666
},
{
"time_sec": 6.85,
"score": 0.991761,
"nearest_onset": {
"time_sec": 6.602667,
"strength": 1
},
"offset_ms": -247.333
},
{
"time_sec": 10.466667,
"score": 1,
"nearest_onset": {
"time_sec": 10.218667,
"strength": 1
},
"offset_ms": -248
},
{
"time_sec": 13.55,
"score": 0.07264,
"nearest_onset": {
"time_sec": 13.536,
"strength": 0.147649
},
"offset_ms": -14
},
{
"time_sec": 15.55,
"score": 0.089426,
"nearest_onset": {
"time_sec": 15.557333,
"strength": 0.162777
},
"offset_ms": 7.333
},
{
"time_sec": 19.15,
"score": 0.074186,
"nearest_onset": {
"time_sec": 19.130667,
"strength": 0.146841
},
"offset_ms": -19.333
}
],
"cues": [
{
"time_sec": 6.85,
"label": "flash 2",
"status": "early",
"matched_onset_time_sec": 6.602667,
"offset_ms": -247.333,
"nearest_onset_time_sec": 6.602667,
"nearest_onset_offset_ms": -247.333,
"cue_group": "flash",
"dominant_band": "44.2-55.7 Hz",
"simple_check_on_time": false,
"simple_check_onset_offset_ms": null,
"simple_check_level_db": -120,
"simple_check_reference_db": -120,
"simple_check_reference": "preceding_90ms",
"group_typical_level_db": null,
"template_status": "early",
"evidence": "template_and_simple_agree",
"audible_in_any_band": false,
"signature_bands": [],
"signature_sample_count": 0,
"signature_score": 1,
"group_median_score": null,
"group_typical_attack_lag_ms": null,
"on_cue_score": null,
"companion_gain": null,
"displaced_time_sec": null,
"shifted_null_floor": null,
"credible_score_floor": null,
"slot_before_ms": null,
"slot_after_ms": null,
"signature_excess_ratio": null,
"search_window_ms": 500,
"match_method": "broad_onset",
"ambiguous_reason": null,
"candidate_onsets": [
{
"time_sec": 6.602667,
"offset_ms": -247.333,
"strength": 1
},
{
"time_sec": 7.114667,
"offset_ms": 264.667,
"strength": 1
},
{
"time_sec": 7.242667,
"offset_ms": 392.667,
"strength": 0.153413
},
{
"time_sec": 7.28,
"offset_ms": 430,
"strength": 0.143555
},
{
"time_sec": 7.312,
"offset_ms": 462,
"strength": 0.140158
}
]
}
],
"unmatched_strong_onsets": [
{
"time_sec": 2.986667,
"strength": 1,
"band_db": {
"sub": -42.94,
"low_mid": -35.361,
"mid": -7.8,
"high": -35.489,
"air": -40.134
}
},
{
"time_sec": 3.488,
"strength": 1,
"band_db": {
"sub": -22.648,
"low_mid": -27.738,
"mid": -26.757,
"high": -48.186,
"air": -64.282
}
},
{
"time_sec": 7.114667,
"strength": 1,
"band_db": {
"sub": -27.621,
"low_mid": -35.03,
"mid": -37.589,
"high": -59.459,
"air": -76.532
}
},
{
"time_sec": 10.218667,
"strength": 1,
"band_db": {
"sub": -42.692,
"low_mid": -35.052,
"mid": -7.164,
"high": -35.119,
"air": -39.774
}
},
{
"time_sec": 10.741333,
"strength": 1,
"band_db": {
"sub": -30.273,
"low_mid": -30.341,
"mid": -33.258,
"high": -54.643,
"air": -79.167
}
}
],
"uncued_sounds": [],
"strong_onset_threshold": 0.5,
"total_cuts": 7,
"total_cues": 1
}
}
sync_check
Arguments
{
"source": "$CLIP",
"cues": [
{
"time_sec": 10.466667,
"label": "flash 3"
}
]
}
Result
{
"ok": true,
"data": {
"source_path": "~/hill/gallery/repo/cards/sync-monitoring/clip.mp4",
"tolerance_ms": 80,
"cue_recovery_window_ms": 500,
"search_window_ms": 500,
"bpm": null,
"beats_per_bar": null,
"cue_signatures": {},
"systematic_lags": [],
"cuts": [
{
"time_sec": 1.05,
"score": 0.0824,
"nearest_onset": {
"time_sec": 1.029333,
"strength": 0.159305
},
"offset_ms": -20.667
},
{
"time_sec": 3.233333,
"score": 0.965669,
"nearest_onset": {
"time_sec": 2.986667,
"strength": 1
},
"offset_ms": -246.666
},
{
"time_sec": 6.85,
"score": 0.991761,
"nearest_onset": {
"time_sec": 6.602667,
"strength": 1
},
"offset_ms": -247.333
},
{
"time_sec": 10.466667,
"score": 1,
"nearest_onset": {
"time_sec": 10.218667,
"strength": 1
},
"offset_ms": -248
},
{
"time_sec": 13.55,
"score": 0.07264,
"nearest_onset": {
"time_sec": 13.536,
"strength": 0.147649
},
"offset_ms": -14
},
{
"time_sec": 15.55,
"score": 0.089426,
"nearest_onset": {
"time_sec": 15.557333,
"strength": 0.162777
},
"offset_ms": 7.333
},
{
"time_sec": 19.15,
"score": 0.074186,
"nearest_onset": {
"time_sec": 19.130667,
"strength": 0.146841
},
"offset_ms": -19.333
}
],
"cues": [
{
"time_sec": 10.466667,
"label": "flash 3",
"status": "early",
"matched_onset_time_sec": 10.218667,
"offset_ms": -248,
"nearest_onset_time_sec": 10.218667,
"nearest_onset_offset_ms": -248,
"cue_group": "flash",
"dominant_band": "44.2-55.7 Hz",
"simple_check_on_time": false,
"simple_check_onset_offset_ms": null,
"simple_check_level_db": -120,
"simple_check_reference_db": -120,
"simple_check_reference": "preceding_90ms",
"group_typical_level_db": null,
"template_status": "early",
"evidence": "template_and_simple_agree",
"audible_in_any_band": false,
"signature_bands": [],
"signature_sample_count": 0,
"signature_score": 1,
"group_median_score": null,
"group_typical_attack_lag_ms": null,
"on_cue_score": null,
"companion_gain": null,
"displaced_time_sec": null,
"shifted_null_floor": null,
"credible_score_floor": null,
"slot_before_ms": null,
"slot_after_ms": null,
"signature_excess_ratio": null,
"search_window_ms": 500,
"match_method": "broad_onset",
"ambiguous_reason": null,
"candidate_onsets": [
{
"time_sec": 10.218667,
"offset_ms": -248,
"strength": 1
},
{
"time_sec": 10.741333,
"offset_ms": 274.666,
"strength": 1
},
{
"time_sec": 10.826667,
"offset_ms": 360,
"strength": 0.145556
},
{
"time_sec": 10.874667,
"offset_ms": 408,
"strength": 0.147752
},
{
"time_sec": 10.912,
"offset_ms": 445.333,
"strength": 0.138367
}
]
}
],
"unmatched_strong_onsets": [
{
"time_sec": 2.986667,
"strength": 1,
"band_db": {
"sub": -42.94,
"low_mid": -35.361,
"mid": -7.8,
"high": -35.489,
"air": -40.134
}
},
{
"time_sec": 3.488,
"strength": 1,
"band_db": {
"sub": -22.648,
"low_mid": -27.738,
"mid": -26.757,
"high": -48.186,
"air": -64.282
}
},
{
"time_sec": 6.602667,
"strength": 1,
"band_db": {
"sub": -35.622,
"low_mid": -29.876,
"mid": -7.489,
"high": -49.071,
"air": -60.148
}
},
{
"time_sec": 7.114667,
"strength": 1,
"band_db": {
"sub": -27.621,
"low_mid": -35.03,
"mid": -37.589,
"high": -59.459,
"air": -76.532
}
},
{
"time_sec": 10.741333,
"strength": 1,
"band_db": {
"sub": -30.273,
"low_mid": -30.341,
"mid": -33.258,
"high": -54.643,
"air": -79.167
}
}
],
"uncued_sounds": [],
"strong_onset_threshold": 0.5,
"total_cuts": 7,
"total_cues": 1
}
}
frame_at
Arguments
{
"source": "$CLIP",
"time_sec": 3.2375
}
Result
{
"ok": true,
"data": {
"frame_time_sec": 3.233333,
"width": 640,
"height": 1138,
"source_width": 640,
"source_height": 1138,
"crop": null,
"scale": 1,
"file_path": "<cache>/c1f31f7b1a2a157b395e/frame_at/frame_at_32320d294a614233.png",
"tool_file": {
"_tag": "ToolFile",
"name": "frame_at_32320d294a614233.png",
"mimeType": "image/png",
"encoding": "base64",
"data": "<6144 base64 chars dropped>",
"byteLength": 4606
}
}
}
Question and answer
- Question
- Is the sound out of sync in this clip? By how much?
- Answer
- The sync check puts the sound 247 ms early against the picture. That is the median of the three flash cues.
Check passedanswer -247.333, expected -246 ±40
How it was checked
- Truth from
- constructed
- Fixed at
Planted by this recipe before any tool ran: a one-frame white flash and a 30 ms click at the same instant at 3.23333, 6.85, 10.4667 s, with the original sound muted 0.5 s either side of each click; then the whole sound track was moved 246 ms earlier (sound early) with ffmpeg (adelay or atrim), the picture not moved. The truth is that planted shift; the tolerance 40 ms is about one frame at 60 fps.
The script added three white flashes with clicks at known times, then moved the sound by a set amount, so the answer is that set amount, not a fault in the film. Each cue was measured by its own sync_check call.
Try it yourself
Using agentic-video, check whether the sound in my video is out of sync with the picture. Find three moments where a sharp visual flash and a click happen together. Run sync_check once for each of those times, with that one time as the only cue, then tell me the median of the three offsets in milliseconds. Then run frame_at on the first flash so I can see it.
- Get the .mcpb file and open it in Claude Desktop.
- Or:
pip install agentic-video
Clip and licence
- Licence
- CC0
- Author
- Benoît Prieur
- Source
- commons.wikimedia.org
This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.