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
const axios = require('axios');
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/multi-video-merge";
const data = {
"video_urls": "https://segmind-inference-inputs.s3.amazonaws.com/81d2475e-b9ae-4292-b0db-401b87011e80-output.mp4",
"width": 1920,
"height": 1080,
"fps": 30,
"transition_type": "concat",
"transition_duration": 0.5,
"maintain_aspect_ratio": true,
"audio_handling": "merge"
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();Array of videos to merge. Can be either:1. Array of URL strings (order by index)2. Array of objects with video_url and orderMinimum 2, maximum 10 videos
Output video width in pixels. If 0 or not specified, uses first video's width.
min : 0,
max : 7680
Output video height in pixels. If 0 or not specified, uses first video's height.
min : 0,
max : 4320
Output video frame rate (frames per second). If 0 or not specified, uses first video's fps.
min : 0,
max : 120
Type of transition between videos.
Allowed values:
Duration of fade transition in seconds. Only applies when transition_type is 'fade'.
min : 0.1,
max : 2
Maintain aspect ratio when resizing videos. If true, adds black padding bars. If false, stretches video to fit dimensions.
How to handle audio from multiple videos.
Allowed values:
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.