|
1
|
# Video Generation |
|
2
|
|
|
3
|
## Available Functions |
|
4
|
|
|
5
|
### generateVideo(prompt, ...) |
|
6
|
|
|
7
|
Generate short video clips from text descriptions. |
|
8
|
|
|
9
|
**Parameters:** |
|
10
|
|
|
11
|
- `prompt` (str, required): Detailed text description of the desired video |
|
12
|
- `summary` (str, default "generated_video"): Short description for the filename |
|
13
|
- `aspectRatio` (str, default "16:9"): "16:9" (landscape) or "9:16" (portrait) |
|
14
|
- `resolution` (str, default "720p"): "720p" or "1080p" |
|
15
|
- `durationSeconds` (int, default 6): 4, 6, or 8 seconds |
|
16
|
- `negativePrompt` (str, optional): Description of what should NOT appear |
|
17
|
- `personGeneration` (str, optional): "dont_allow" or "allow_adult" for controlling people |
|
18
|
|
|
19
|
**Returns:** Dict with `filePath` and `description` keys |
|
20
|
|
|
21
|
**Example:** |
|
22
|
|
|
23
|
```javascript |
|
24
|
const result = await generateVideo({ |
|
25
|
prompt: "A cat playing with a ball of yarn, cute and playful, natural lighting", |
|
26
|
summary: "playful cat", |
|
27
|
aspectRatio: "16:9", |
|
28
|
durationSeconds: 6 |
|
29
|
}); |
|
30
|
console.log(`Video saved to: ${result.filePath}`); |
|
31
|
``` |
|
32
|
|
|
33
|
### generateVideoAsync(prompt, ...) |
|
34
|
|
|
35
|
Generate a video asynchronously. Returns immediately with a workflow ID. Same parameters as `generateVideo`. |
|
36
|
|
|
37
|
**Returns:** Dict with `workflowId`, `workflowAlias`, `status`, and `videoPath` |
|
38
|
|
|
39
|
**Example:** |
|
40
|
|
|
41
|
```javascript |
|
42
|
const result = await generateVideoAsync({ |
|
43
|
prompt: "A cat playing with a ball of yarn, cute and playful, natural lighting", |
|
44
|
summary: "playful cat", |
|
45
|
aspectRatio: "16:9", |
|
46
|
durationSeconds: 6 |
|
47
|
}); |
|
48
|
console.log(`Started workflow: ${result.workflowAlias}`); |
|
49
|
console.log(`Video will be saved to: ${result.videoPath}`); |
|
50
|
|
|
51
|
// Later, wait for completion |
|
52
|
await wait_for_background_tasks({ wait_mode: "all" }); |
|
53
|
``` |
|
54
|
|
|
55
|
## When to Use Each Function |
|
56
|
|
|
57
|
### generateVideo / generateVideoAsync |
|
58
|
|
|
59
|
- Use `generateVideoAsync` when the video is not needed immediately |
|
60
|
- Short animated clips or motion graphics |
|
61
|
- Video backgrounds or visual effects |
|
62
|
- Product animations or demonstrations |
|
63
|
- Social media video content |
|
64
|
|
|
65
|
## Aspect Ratio Guidelines |
|
66
|
|
|
67
|
### Videos |
|
68
|
|
|
69
|
- **16:9** - Widescreen landscape, good for web videos, presentations |
|
70
|
- **9:16** - Vertical portrait, good for mobile stories, social media shorts |
|
71
|
|
|
72
|
## Output Locations |
|
73
|
|
|
74
|
- Generated videos: `attached_assets/generated_videos/` |
|
75
|
|
|
76
|
## Limitations |
|
77
|
|
|
78
|
- Generated videos: 8 seconds maximum |
|
79
|
|
|
80
|
## Copyright |
|
81
|
|
|
82
|
- Generated videos are created for your use |