Video Concatenate Serverless API
Effortlessly merge videos with customized layouts, spacing, and audio for seamless content creation.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/video-concatenate"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "video1": "https://segmind-resources.s3.amazonaws.com/input/sample1-sunflower.mp4",
12 "video2": "https://segmind-resources.s3.amazonaws.com/input/sample2.mp4",
13 "direction": "horizontal",
14 "spacing": 10,
15 "spacing_color": "#FFFFFF",
16 "size_adjustment": "reduce_biggest",
17 "audio_source": "video2",
18 "crf": 24,
19 "preset": "fast"
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25 result = response.json()
26 print(json.dumps(result, indent=2))
27else:
28 print(f"Error: {response.status_code}")
29 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/video-concatenate"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "video1": "https://segmind-resources.s3.amazonaws.com/input/sample1-sunflower.mp4",
12 "video2": "https://segmind-resources.s3.amazonaws.com/input/sample2.mp4",
13 "direction": "horizontal",
14 "spacing": 10,
15 "spacing_color": "#FFFFFF",
16 "size_adjustment": "reduce_biggest",
17 "audio_source": "video2",
18 "crf": 24,
19 "preset": "fast"
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25 result = response.json()
26 print(json.dumps(result, indent=2))
27else:
28 print(f"Error: {response.status_code}")
29 print(response.text)API Endpoint
https://api.segmind.com/v1/video-concatenateParameters
video1requiredstring (uri)First input video URL. Use high-quality videos for best output.
video2requiredstring (uri)Second input video URL. Match quality with Video 1 for consistency.
audio_sourceoptionalstringAudio source choice. Use 'none' for silent output.
"video2""video1""video2""none"crfoptionalintegerH.264 quality (CRF). Lower values for better quality, higher for smaller file.
24Range: 0 - 51directionoptionalstringConcatenation direction. Use 'horizontal' for side-by-side, 'vertical' for stacking.
"horizontal""horizontal""vertical"presetoptionalstringEncoding speed. 'Fast' saves time, 'Medium' for balance, 'Slow' for quality.
"fast""ultrafast""superfast""veryfast""faster""fast""medium""slow""slower""veryslow"size_adjustmentoptionalstringAdjust size for uniformity. Use 'magnify_smallest' for smaller to match larger.
"reduce_biggest""magnify_smallest""reduce_biggest""crop_biggest"spacingoptionalintegerPixels space between videos. Increase for clear separation.
10Range: 0 - 2000spacing_coloroptionalstringColor of spacing in hex. Use black (#000000) or white (#FFFFFF) for contrast.
"#FFFFFF"Response Type
Returns: Video
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out