diff --git a/marketing/lib/av-sync.mjs b/marketing/lib/av-sync.mjs new file mode 100644 --- /dev/null +++ b/marketing/lib/av-sync.mjs @@ -0,0 +1,193 @@ +// av-sync.mjs — is the mouth early, or is the sound? +// +// Consumer cameras and old webcam captures routinely bake in an A/V offset: the +// picture and the audio are written with timestamps that disagree by a frame or +// four, and nobody notices until you put captions under it and the lips start +// reading as dubbed. +// +// You can measure it. A talking mouth is a motion signal, and a talking voice is +// an amplitude signal, and they are the same signal — a mouth opens when a +// syllable lands. So: pull motion energy from the mouth region of every frame, +// pull an RMS envelope from the audio, and slide one against the other. The lag +// with the strongest correlation is the offset. +// +// node marketing/lib/av-sync.mjs