Looking at a frame
Three calls answer about one frame. inspect gives what is on screen and running. inspect with action: "pick" gives the object under one pixel. frame draws the frame and returns it as a picture, so an agent that can see looks at it, or a stretch of frames as a contact sheet and a loop to see motion. inspect and its pick answer with pointers, which Reading a video describes along with the words used here.
Every call takes video, as bash shows it, or works on the video of the window you used last, and inputs, other values for the video's controls (Which video). The samples here read basics/tweens. To see the window itself as you see it, the studio round the picture, the tool app takes a screenshot of it (The tools an agent has).
What is on screen
inspect answers with what is on screen and running at one frame: the spans that cover it, and one pointer for each animated property of each object that is there.
{ "video": "/videos/basics/tweens", "frame": 60 }
| Parameter | Means |
|---|---|
frame |
The frame, zero-based. Required. |
{
"frame": 60,
"time": 1,
"spans": [
{
"kind": "timeline",
"site": null,
"start": 0,
"end": 2.7
},
{
"kind": "all",
"site": "basics/tweens/index.ts:99:12",
"start": 0.5,
"end": 1.9
},
{
"kind": "tween",
"site": "basics/tweens/index.ts:100:7",
"start": 0.5,
"end": 1.9
}
],
"pointers": [
{
"frame": 60,
"time": 1,
"object": {
"id": "o16",
"name": "set",
"type": "Mesh",
"span": "s18",
"site": "basics/tweens/index.ts:93:28"
},
"path": "position.x",
"value": -0.6,
"chain": [],
"editable": {}
}
]
}
Cut: three more spans (two tweens and a delay) and three more pointers, one of them the pointer shown in full in Pointers. The pointer kept here is the dot that set moves at 1.2 s: at frame 60 nothing has written it yet, so it has no segment.
Objects that are on screen and never animated have no pointer, since a pointer belongs to a track. A frame past the video's end answers with empty lists.
What is under a pixel
inspect with action: "pick" answers with the object under one pixel of a frame, with its pointers. Use it to get from something you see in a picture to the code behind it.
{ "video": "/videos/basics/tweens", "action": "pick", "frame": 60, "x": 1492, "y": 258 }
| Parameter | Means |
|---|---|
frame |
The frame, zero-based. Required. |
x |
Pixels from the left edge, in the video's size. Required. |
y |
Pixels from the top edge. Required. |
{
"frame": 60,
"time": 1,
"x": 1492,
"y": 258,
"object": {
"id": "o10",
"name": "tween",
"type": "Mesh",
"span": "s12",
"site": "basics/tweens/index.ts:75:26"
},
"pointers": [
{
"frame": 60,
"path": "position.x",
"value": 3.9528425655976682
}
]
}
The one pointer is the one shown in full in Pointers; only three of its fields are kept here. Empty space answers with "object": null and no pointers. A point outside the video fails:
error: (5000, 540) is outside the video, which is 1920 by 1080 pixels.
The pixel must lie on what is drawn. For text that is the ink of a letter, not the gap between two. Name your objects (title.name = "title"), so that the answer says which one was hit.
A frame as a picture
frame draws one frame and returns it as a picture, with a summary and the PNG it wrote. The picture is drawn at full quality, at the video's size. Without out the PNG goes into a temporary folder, and the summary's path says where; with it, the PNG is kept in the video.
{ "video": "/videos/basics/tweens", "frame": 60, "out": "out/tweens-60.png" }
{
"video": "tweens",
"frame": 60,
"time": 1,
"path": "/videos/basics/tweens/out/tweens-60.png",
"width": 1920,
"height": 1080,
"bytes": 87018
}
Say which frame in one of three ways, and only one:
| Parameter | Means |
|---|---|
frame |
The frame's number, zero-based. A number past the end fails. |
time |
A moment in seconds, rounded to the nearest frame and kept inside the video. |
comment |
The id of a comment on the video: its moment is drawn. |
| Parameter | Means |
|---|---|
out |
The PNG to write, in the video. Its folder is made when it is not there. A temporary file when left out. |
crop |
A part of the frame, "left,top,width,height". Each number is a share of the frame from 0 to 1: 0.25,0.25,0.5,0.5 is the middle. |
crop: "comment" |
With comment: the half of the frame round the comment's point. A comment without a point gives the whole frame. |
scale |
The picture's size as a share of the video's, from 0.05 to 1. Default: 1. |
{ "video": "/videos/basics/tweens", "time": 1.2, "crop": "0.5,0,0.5,0.5", "scale": 0.5, "out": "out/part.png" }
{
"video": "tweens",
"frame": 72,
"time": 1.2,
"crop": [0.5, 0, 0.5, 0.5],
"scale": 0.5,
"path": "/videos/basics/tweens/out/part.png",
"width": 480,
"height": 270,
"bytes": 5227
}
width and height are those of the picture written. path names the file as bash shows it. A crop that leaves the frame, or is given in pixels, is refused.
A smaller picture is quicker to look at. Take the whole frame at scale 0.5 to see the layout, and a crop at full size to judge a detail. The same frame gives the same bytes every time on one machine, so two pictures can be compared before and after a change.
Motion: a stretch as a contact sheet and a loop
One frame cannot show how something moves. Give frame a stretch in place of a frame and it returns a contact sheet as the picture: frames of the stretch in rows, each labelled with its time and frame number, so a second of motion is judged in one call, without an export.
{ "video": "/videos/rise", "from": 0, "to": 2, "out": "out/rise-sheet.png", "loop": "out/rise.webp" }
{
"video": "rise",
"from": 0,
"to": 2,
"tiles": [
{ "frame": 0, "time": 0 },
{ "frame": 11, "time": 0.18333333333333332 },
{ "frame": 120, "time": 2 }
],
"columns": 4,
"rows": 3,
"tile": { "width": 480, "height": 270 },
"scale": 0.25,
"path": "/videos/rise/out/rise-sheet.png",
"width": 1950,
"height": 930,
"bytes": 107387,
"loop": {
"path": "/videos/rise/out/rise.webp",
"format": "webp",
"frames": 61,
"fps": 30,
"duration": 2.033333333333333,
"width": 480,
"height": 270,
"bytes": 155858
}
}
Cut: nine of the twelve tiles. The sheet holds twelve tiles spread evenly over the stretch, its first and last frame among them, in about as many rows as columns.
| Parameter | Means |
|---|---|
from |
Where the stretch starts, in seconds. Default: the video's start. |
to |
Where it ends, in seconds, kept inside the video. Default: the video's end. It must lie after from. |
count |
How many tiles, from 2 to 400, spread evenly with both ends included. Default: 12. |
every |
In place of count: one tile every so many seconds from from. More than 400 tiles is refused. |
scale |
The size of each tile, and of the loop, as a share of the video's, from 0.05 to 1. Default: 0.25 for a stretch; 0.1 fits 100 tiles. |
crop |
Show the same part of every frame, as for one frame. |
loop |
Also write the stretch as a short loop that plays forever: .webp (an animated WebP), .gif or .mp4. Every frame, up to 30 a second, plays. |
at |
In place of a stretch: the moments to show, in seconds, separated by commas, such as 0,1.5,3. One tile each, in time order, 1 to 400 of them. |
out |
The sheet's PNG, in the video. A temporary file when left out. |
count alone spreads its tiles over the whole video, which shows a whole piece at a glance. at names the moments that matter instead, such as the end of each entrance and the held frame between; it takes no from, to, count, every or loop.
{ "video": "/videos/rise", "at": "0.4,1.2,2.5,4" }
A loop holds at most 300 frames and 40 million pixels in all; a longer stretch or a larger loop is refused with what to change: a shorter stretch, a smaller scale or a crop, or an export. A stretch of one frame, or a frame, time or comment beside a stretch, is refused. The loop is written to its file only, for a person to watch; to judge motion yourself, read the sheet, and take every 0.05 over a short stretch to see an entrance frame by frame.
See also
- Reading a video: the schedule, and what a pointer holds
- Checking a video
- Controls and comments
- The loop an agent works in
- Comments and review:
framewithcommentdraws a comment's moment