Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions schemas/videoasset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,27 @@
type: string
speed:
description: >-
Adjust the playback speed of the video clip between 0 (paused) and 10 (10x normal speed) where 1 is normal
speed (defaults to 1). Adjusting the speed will also adjust the duration of the clip and may require you to
adjust the Clip length. For example, if you set speed to 0.5, the clip will need to be 2x as long to play
the entire video (i.e. original length / 0.5). If you set speed to 2, the clip will need to be half as long
to play the entire video (i.e. original length / 2).
type: number
format: float
minimum: 0
maximum: 10
example: 1
Adjust the playback speed of the video clip. Use a number for a constant speed or an array of
[Tween](./#tocs_tween) objects to change speed over time, for example easing from normal speed up to 3x.
oneOf:
- type: number
description: >-
The playback speed between 0 (paused) and 10 (10x normal speed) where 1 is normal speed (defaults to
1). Adjusting the speed will also adjust the duration of the clip and may require you to adjust the
Clip length. For example, if you set speed to 0.5, the clip will need to be 2x as long to play the
entire video (i.e. original length / 0.5). If you set speed to 2, the clip will need to be half as
long to play the entire video (i.e. original length / 2).
format: float
minimum: 0
maximum: 10
example: 1
- type: array
description: >-
An array of [Tween](./#tocs_tween) objects that change the playback speed over time. A speed of 0
holds the current frame. The clip length is not adjusted, so set it to cover the footage you want to
play.
items:
$ref: "./tween.yaml#/Tween"
crop:
$ref: "./crop.yaml#/Crop"
chromaKey:
Expand Down
14 changes: 14 additions & 0 deletions tests/smoke.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,20 @@ async function run() {
assert.strictEqual(result.src, "https://example.com/video.mp4");
});

check("Parse videoAsset with animated speed", () => {
const result = zodCjs.videoAssetSchema.parse({
type: "video",
src: "https://example.com/video.mp4",
speed: [{ from: 1, to: 3, start: 0, length: 1, interpolation: "bezier", easing: "easeInOut" }],
});
assert.strictEqual(result.speed.length, 1);
});

check("Parse videoAsset with numeric speed (existing shape)", () => {
const result = zodCjs.videoAssetSchema.parse({ type: "video", src: "https://example.com/video.mp4", speed: 2 });
assert.strictEqual(result.speed, 2);
});

check("Parse audioAsset with src only (existing shape)", () => {
const result = zodCjs.audioAssetSchema.parse({
type: "audio",
Expand Down
Loading