How to find every cut in a video, with timestamps
One call to /v1/watch_video answers it in words: every cut with its second, and how fast the video is cut. The times come from the video itself, so they cannot drift from the moment they belong to. Keep the session_id that comes back and the next question about the same video is a fraction of the price.
Last updated
The call
Copy this as it stands. “Where are all the cuts in this video, and how fast is it cut?” is the question it answers.
Watch this and list every cut with its timestamp:
https://www.tiktok.com/@user/video/7300000000000000000import { Playhead } from "@playhead/sdk";
const playhead = new Playhead();
const video = await playhead.ask({
url,
question: "list every cut, in seconds, and say how fast this is cut",
});
console.log(video.answer);
// Keep it: every question after this one about the same video is cheap.
const sessionId = video.session_id;curl -X POST https://api.tryplayhead.com/v1/watch_video \
-H "Authorization: Bearer $PLAYHEAD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://www.tiktok.com/@user/video/730…",
"question": "list every cut, in seconds"}' \
| jq -r '.answer'What comes back
Shortened, and real in shape. These are the field names the API actually sends.
{
"session_id": "ses_01HZY6M8Q2",
"answer": "The video is cut at 1.24s, 2.88s, 4.02s, 5.60s and 7.14s. Five cuts across six segments, so about 24 cuts a minute. The shortest segment is 1.14s and the longest is the closing shot from 7.14s to the end.",
"unanswered": [],
"cached": false,
"credits_charged": 150
}Watch out for
Everything the API can refuse, and what to send instead, is on the errors page.