Membuat video Vidu
Buat tugas video Vidu Q3 atau Q4 melalui CometAPI dengan POST /v1/videos. Gunakan Q3 untuk text-to-video atau image-to-video, dan Q4 untuk image-to-video atau reference-to-video. Kemudian polling tugas tersebut dan unduh file MP4 yang telah selesai.
curl https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F model=viduq3-turbo \
-F 'prompt=An astronaut walks through soft blue fog with a slow cinematic camera move.' \
-F seconds=1{
"id": "task_example",
"task_id": "task_example",
"object": "video",
"model": "viduq3-turbo",
"status": "queued",
"progress": 0,
"created_at": 1779938152
}viduq4-preview membuat tugas image-to-video dan reference-to-video. API segera mengembalikan ID tugas, jadi simpan id yang dikembalikan dan polling tugas hingga mencapai status terminal.
POST /v1/videos menggunakan multipart/form-data. Kirim kontrol skalar sebagai field formulir dan gambar referensi sebagai field input_reference.
Pilih mode input
| Tujuan | ID model | Field wajib | Field opsional |
|---|---|---|---|
| Text-to-video | viduq3, viduq3-turbo | model, prompt | seconds, size |
| Image-to-video | viduq3, viduq3-turbo | model, prompt, satu file input_reference | seconds, size |
| Image-to-video | viduq4-preview | model, prompt, satu file input_reference atau URL gambar HTTPS | seconds, size |
| Reference-to-video | viduq4-preview | model, prompt, 2–12 input_reference URL gambar HTTPS | seconds, size, reference_audios |
viduq4-preview memilih mode dari permintaan. Satu gambar referensi tanpa audio referensi membuat tugas image-to-video. Dua atau lebih gambar referensi, atau satu gambar referensi dengan reference_audios, membuat tugas reference-to-video.
Untuk memastikan bahwa viduq3 atau viduq3-turbo tersedia untuk API key Anda, gunakan Daftar model yang tersedia.
Gunakan gambar referensi
Untuk Q3 image-to-video, unggah satu gambar referensi melalui field multipartinput_reference. Ukuran file dapat mencapai 20 MB.
Gambar tersebut memandu komposisi dan tampilan video yang dihasilkan. Gunakan Prompt untuk menjelaskan gerakan, perilaku kamera, dan detail yang harus dipertahankan video.
Untuk viduq4-preview image-to-video, kirim satu gambar sebagai file yang diunggah atau sebagai URL HTTPS yang dapat diakses publik dalam input_reference. Video dimulai dari gambar ini dan mempertahankan rasio aspeknya.
Untuk viduq4-preview reference-to-video, kirim 2–12 URL gambar HTTPS yang dapat diakses publik. Ulangi input_reference satu kali untuk setiap gambar, dan kirim setiap URL dalam field terpisah. Gunakan gambar PNG, JPEG, atau WEBP.
Dalam Prompt, rujuk gambar referensi berdasarkan urutannya dalam permintaan: @1 adalah gambar input_reference pertama, @2 adalah gambar kedua, dan seterusnya. Contoh: The pink car from @1 drives across the snowy hill from @2.
Tambahkan audio referensi
Untukviduq4-preview reference-to-video, reference_audios menambahkan referensi suara. Kirim hingga 3 URL HTTPS yang dapat diakses publik untuk klip MP3, masing-masing berdurasi 3–12 detik, dan ulangi reference_audios satu kali untuk setiap klip. Kirim setidaknya satu gambar input_reference dalam permintaan yang sama.
Atur durasi dan ukuran
| ID Model | seconds | Bawaan |
|---|---|---|
viduq3-turbo | bilangan bulat 1-16 | 5 detik, 1280x720 |
viduq3 | bilangan bulat 1-16 | 5 detik, 1280x720 |
viduq4-preview | bilangan bulat 3-16 | 5 detik, 1280x720 |
size ke salah satu nilai WxH di bawah ini.
| Tingkat resolusi | Rasio aspek | size (WxH) |
|---|---|---|
540p | 16:9 | 960x528 |
720p | 16:9 | 1280x720 |
1080p | 16:9 | 1920x1080 |
viduq4-preview, atur size ke salah satu nilai WxH di bawah ini. Untuk reference-to-video, size menentukan bentuk frame. Untuk image-to-video, output mempertahankan rasio aspek gambar input.
| Tingkat resolusi | Rasio aspek | size (WxH) |
|---|---|---|
720p | 16:9 (bawaan) | 1280x720 |
720p | 9:16 | 720x1280 |
720p | 1:1 | 960x960 |
720p | 4:3 | 1104x816 |
720p | 3:4 | 816x1104 |
viduq4-preview video menyertakan trek audio yang dihasilkan.
Alur tugas
Buat tugas
id yang dikembalikan.Polling tugas
status bernilai completed, failed, atau error.Unduh hasil
completed, panggil Mengambil konten video Vidu untuk mengunduh file MP4.Body
Text prompt that describes the video to generate. For image-to-video, describe the motion and camera behavior that should animate the reference image. For viduq4-preview reference-to-video, refer to reference images as @1, @2, and so on, in the order of the input_reference fields. Up to 5000 characters for viduq4-preview.
"An astronaut walks through soft blue fog with a slow cinematic camera move."
Output size as WxH. Supported WxH size values for viduq3 and viduq3-turbo: 960x528, 1280x720, 1920x1080. Supported WxH size values for viduq4-preview: 1280x720, 720x1280, 960x960, 1104x816, 816x1104. Default is 1280x720. For viduq4-preview reference-to-video, size sets the frame shape. For viduq4-preview image-to-video, the output keeps the aspect ratio of the input image.
Reference images. For Q3 image-to-video, upload one image file up to 20 MB. For viduq4-preview image-to-video, send one image file or one publicly accessible HTTPS image URL. For viduq4-preview reference-to-video, send 2-12 publicly accessible HTTPS image URLs by repeating input_reference once per image. Use PNG, JPEG, or WEBP images. Omit this field for text-to-video.
Voice references for viduq4-preview reference-to-video. Send up to 3 publicly accessible HTTPS URLs of MP3 clips, each 3-12 seconds long, by repeating reference_audios once per clip. Send at least one input_reference image in the same request.
^https://Respons
Task created. Store the returned id and poll GET /v1/videos/{task_id}.
curl https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F model=viduq3-turbo \
-F 'prompt=An astronaut walks through soft blue fog with a slow cinematic camera move.' \
-F seconds=1{
"id": "task_example",
"task_id": "task_example",
"object": "video",
"model": "viduq3-turbo",
"status": "queued",
"progress": 0,
"created_at": 1779938152
}