-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreference_to_video.mjs
More file actions
43 lines (37 loc) · 1.35 KB
/
reference_to_video.mjs
File metadata and controls
43 lines (37 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Seedance 2.0 Reference-to-Video example (fal.ai).
//
// Model: bytedance/seedance-2.0/fast/reference-to-video
// Docs: https://fal.ai/models/bytedance/seedance-2.0/fast/reference-to-video/api
//
// Provide up to 9 images, 3 videos, and 3 audio clips as references.
// Refer to them inside the prompt as @Image1, @Video1, @Audio1, etc.
import { fal } from "@fal-ai/client";
const MODEL_ID =
process.env.SEEDANCE_MODEL ||
"bytedance/seedance-2.0/fast/reference-to-video";
if (!process.env.FAL_KEY) {
console.error("Error: FAL_KEY environment variable is not set.");
process.exit(1);
}
const REF_IMAGE =
"https://v3b.fal.media/files/b/0a8eba37/Cqg-4Uwzyz4DELfceT1CF_a17e588773ec45b1a9e6f100a787b80b.jpg";
const result = await fal.subscribe(MODEL_ID, {
input: {
prompt:
"The character in @Image1 walks through a bustling night market, neon signs reflecting in puddles, cinematic dolly-in, ambient market chatter and distant music.",
image_urls: [REF_IMAGE],
resolution: "720p",
duration: "8",
aspect_ratio: "16:9",
generate_audio: true,
},
logs: true,
onQueueUpdate: (update) => {
if (update.status === "IN_PROGRESS") {
update.logs?.map((l) => l.message).forEach((m) => console.log(m));
}
},
});
console.log("\nDone.");
console.log("Video URL:", result.data.video.url);
console.log("Seed: ", result.data.seed);