Add or remove media and graphics
Adds or removes stock media from find_media or animated HTML graphics over a video while the speech continues underneath. Media and graphics can be on screen for at most 60 seconds of a video in all. The video can play up to 5 minutes of its recording, counted from the first moment used to the last.
| MCP tool | edit_layers |
| API | POST /api/v1/videos/{clipId}/layers |
| Credits | Free |
When to use it
- Call after
get_scriptand anycut_videoedits, because cuts shift script timestamps. - Add up to 10 items in
addand list layer IDs inremovein one call. Eachadditem takes eithermediaIdorhtml. - Show one photo or video at a time, and one graphic at a time; a graphic can sit over a photo or video. Each must end before the video does.
- New music replaces the music that was there.
- Search for stock media first with
find_media, and inspect placement afterward withshow_frames.
Parameters
| Name | Type | Required | What it is |
|---|---|---|---|
clipId | string | Yes | The clipId from open_video, or a clip ID from list_clips. |
version | integer | Yes | The version the script was read at. |
add | list | No | What to add, up to 10 at a time. |
add[].mediaId | string | No | Media from find_media. An item has this or html. |
add[].html | string | No | A graphic, up to 60,000 characters: one HTML page the size of the frame, transparent where it paints nothing. It sets window.film = { ready: document.fonts.ready, frame(t) { } }, where frame draws the whole picture at t seconds after the graphic appears, always the same for the same t. Up to 8 font styles can come from fonts.googleapis.com/css2; nothing else loads from the web. |
add[].name | string | No | For a graphic, and required there: what it is, in up to 60 characters. |
add[].start | number | No | When it appears, in seconds of the video as the script has them. Music plays through the whole video and needs none. |
add[].seconds | number | No | How long it stays. For media 1.5 to 15, default 3. A graphic needs it: 1 to 30. |
add[].view | string | No | For a photo: "card" (default) sits in free space, off the face and the captions; "full" fills the frame. Footage always fills the frame. One of card, full. |
add[].volume | string | No | For music. Default "normal", under the speech. One of quiet, normal, loud. |
remove | list | No | IDs of layers to take out. |
Call it from an AI agent
{
"name": "edit_layers",
"arguments": {
"clipId": "f8669b08",
"version": 2,
"add": [
{
"mediaId": "photo-1132528",
"start": 8.2,
"seconds": 3
}
]
}
}
A graphic that fades in:
{
"name": "edit_layers",
"arguments": {
"clipId": "f8669b08",
"version": 3,
"add": [
{
"html": "<!doctype html><style>body{margin:0}div{position:absolute;left:6vw;top:18vh;padding:2vw 3vw;background:#101418;color:#fff;font:800 8vw sans-serif}</style><div>3 months</div><script>const box=document.querySelector('div');window.film={ready:document.fonts.ready,frame(t){box.style.opacity=Math.min(1,t/0.3)}}</script>",
"name": "3 months",
"start": 12.4,
"seconds": 3
}
]
}
}
Call it from your code
curl -X POST https://pogclip.com/api/v1/videos/f8669b08/layers \
-H "Authorization: Bearer $POGCLIP_API_KEY" \
-H "Content-Type: application/json" \
-d '{"version": 2, "add": [{"mediaId": "photo-1132528", "start": 8.2, "seconds": 3}]}'
What you get back
{
"clipId": "f8669b08",
"name": "Why I started filming again",
"pageUrl": "https://pogclip.com/dashboard/projects/8e4ed643?clip=f8669b08",
"downloadPageUrl": "https://pogclip.com/dashboard/projects/8e4ed643?download=f8669b08",
"status": "ready",
"version": 3,
"durationSeconds": 194.5,
"script": [
{
"line": 1,
"start": 0.1,
"end": 2,
"text": "Okay, here's the deal."
},
{
"line": 2,
"start": 2.3,
"end": 8.1,
"text": "I want to show you what I got wrong."
}
],
"layers": [
{
"id": "b669a5e4",
"name": "microphone, studio",
"start": 8.2,
"end": 11.2
}
],
"previousVersion": 2,
"next": "Saved. Version 2 can be put back."
}
The example above shows only the first two lines of script.
version: the new version after saving; use it for any follow-up edits.previousVersion: pass this torestore_videoto undo the layer change.layers: lists every active media, music and graphic layer; pass a layer'sidinremoveto take it out later.next: confirms the change was saved and notes which version you can restore.
Errors
| Code | What it means |
|---|---|
video_changed | The video has a newer version than the one you sent. Read the script again and use its version. |
invalid_request | A field is missing or wrong, the video has no transcript yet, the media could not be fetched, two items overlap, or a limit above is passed. The message says which. |
not_found | There is no such video or media. |
unauthorized | The API key or sign-in is missing, wrong or revoked. |
rate_limited | More than 60 requests in a minute. Wait for retryAfterSeconds. |