Videos

Get the beats of the background music

Changed on

Returns the tempo, every beat and every bar's first beat (downbeat) of the video's background music, in ms on the video's playback timeline: the track starts at 0 and restarts every trackDurationMs until the video ends, so the beats repeat with it. Use them to cut, start overlays or animate on the beat. Each track is analyzed once and cached; the first request for a new track can take a few seconds, and answers 503 unavailable if the analysis is still running, so retry.

get/v1/videos/{id}/background-music/beats

Request

Path parameters

idstring required

Unique video identifier

Example:vid_abc123def456

Response

OK

beatsMsnumber[] required

Every beat, in ms: on the video's playback timeline for background music (the same times as get_timeline), in source time for a source

beatsPerBarinteger required

Beats in each bar: 4, or 3 for a waltz-like meter

bpmnumber required

Tempo in beats per minute. 0 when the track has no beat at all

confidencenumber required

How clearly the track has a pulse, 0 to 1. Steady produced music is usually above 0.4; beatless ambient music below 0.1, where the beats are only a guess

downbeatsMsnumber[] required

The first beat of every bar, a subset of beatsMs. Cut or start a motion on these for the strongest musical accents

durationMsnumber required

Length of the timeline the beats are on: the video's playback duration for background music, the source's duration for a source

trackDurationMsnumber required

Length of one pass of the track. Background music restarts after it, so its beat grid restarts too

Example response

{
  "beatsMs": [
    512,
    1012,
    1512,
    2012
  ],
  "beatsPerBar": 4,
  "bpm": 120,
  "confidence": 0.86,
  "downbeatsMs": [
    512,
    2512
  ],
  "durationMs": 95200,
  "trackDurationMs": 180036
}

Changes