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
const axios = require('axios');
const FormData = require('form-data');
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/modify-video";
const reqBody = {
"mode": "adhere_1",
"prompt": "woman in a yarn doll style",
"video_url": "https://segmind-resources.s3.amazonaws.com/input/c08771b9-b671-4c12-9ea7-af4048b9d194-894a8bdf-6064-40ea-a78d-06c1abff262b.mp4",
"first_frame_url": "https://segmind-resources.s3.amazonaws.com/input/f2220449-e53a-40d5-aba7-e12c6f562ab5-modify-video-ip.png"
};
(async function() {
try {
const formData = new FormData();
// Append regular fields
for (const key in reqBody) {
if (reqBody.hasOwnProperty(key)) {
formData.append(key, reqBody[key]);
}
}
// Convert and append images as Base64 if necessary
const response = await axios.post(url, formData, {
headers: {
'x-api-key': api_key,
...formData.getHeaders()
}
});
console.log(response.data);
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);
}
})();How closely the output should follow the source video. Adhere: very close, for subtle enhancements. Flex: allows more stylistic change while keeping recognizable elements. Reimagine: loosely follows the source, for dramatic or transformative changes.
Allowed values:
Guides video modification.
The source video URL. Use short MP4s under 30 seconds. Maximum video size is 100mb.
An optional URL of the first frame of the video. This should be a modified version of the original first frame, it will be used to guide the video modification.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Modify Video is Luma AI’s state-of-the-art generative video editing model designed for high-fidelity transformations without reshooting. By leveraging advanced pose, facial and lip-sync tracking, it maintains full-body motion consistency while enabling scene swaps, environment retexturing and style restyling. Creators and developers can generate multiple variants from a single clip, each preserving natural temporal flow and actor performance signals.
adhere_1.reimagine_1.first_frame_url to guide overall look.Q: What video formats are supported?
MP4 clips (under 30 seconds) are recommended for reliable ingestion and native resolution outputs.
Q: How do I choose between adhere, flex, and reimagine modes?
Use adhere modes for faithful edits, flex for moderate stylizations, and reimagine for full creative overhauls.
Q: Can I preserve lip-sync accuracy?
Yes—Modify Video’s facial tracking maintains lip-sync motion even when retexturing environments.
Q: Is a custom first frame required?
No. It’s optional but highly effective for guiding strong stylistic changes.
Q: How do I guide specific edits?
Set the prompt parameter with natural-language instructions (e.g., “make it look like film noir”) to direct the AI.