Video Audio Merge Serverless API

Effortlessly merge audio and video with our intuitive Video Audio Merge model. Create stunning multimedia content with precise timing, fade effects, and customizable audio options. Perfect for content creators, filmmakers, and marketers.

POST /v2/video-audio-merge · submit + poll
 1# pip install "segmind>=1.1.0"
 2# export SEGMIND_API_KEY="YOUR_API_KEY"
 3from segmind import SegmindClient, InferenceFailed, InferenceTimeout
 4
 5# Async (v2) — recommended for long-running / video models.
 6# run() blocks up to 600s; submit_async + job.wait(timeout=...) sets a longer
 7# deadline and keeps the request_id so you can re-poll later.
 8client = SegmindClient()                      # reads SEGMIND_API_KEY
 9payload = {
10    "input_video": "https://segmind-sd-models.s3.amazonaws.com/display_images/video-audio-merge-input.mp4",
11    "input_audio": "https://segmind-sd-models.s3.amazonaws.com/display_images/audio-merge-input-aud.mp3",
12    "video_start": 0,
13    "video_end": -1,
14    "audio_start": 0,
15    "audio_end": -1,
16    "audio_fade_in": 0,
17    "audio_fade_out": 0,
18    "override_audio": False,
19    "merge_intensity": 0.5,
20}
21job = client.submit_async("video-audio-merge", **payload)
22print(job.request_id)                         # available immediately
23try:
24    result = job.wait(timeout=900, interval=2.0)
25    print(result["status"])                  # COMPLETED
26    print(result.get("output"))              # model output (e.g. video URL)
27except InferenceTimeout as e:
28    print("still running:", e.request_id)    # re-poll later with this id
29except InferenceFailed as e:
30    print("failed:", e.detail)
31
32# Fast models (<=600s) can use the one-liner instead:
33# result = segmind.run("video-audio-merge", **payload)

API Endpoint

POSThttps://api.segmind.com/v1/video-audio-merge

Parameters

input_audiorequired
string (uri)

URL of the input audio to be merged with the video

Default: "https://segmind-sd-models.s3.amazonaws.com/display_images/audio-merge-input-aud.mp3"
input_videorequired
string (uri)

URL of the input video to be merged

Default: "https://segmind-sd-models.s3.amazonaws.com/display_images/video-audio-merge-input.mp4"
audio_endoptional
number

End time of the audio in seconds (-1 for full duration)

Default: -1Range: -1 - 3600
audio_fade_inoptional
number

Duration of audio fade-in effect in seconds

Default: 0Range: 0 - 10
audio_fade_outoptional
number

Duration of audio fade-out effect in seconds

Default: 0Range: 0 - 10
audio_startoptional
number

Start time of the audio in seconds

Default: 0Range: 0 - 3600
merge_intensityoptional
number

Intensity of audio merging (0.0 to 1.0)

Default: 0.5Range: 0 - 1
override_audiooptional
boolean

Whether to completely replace the original video audio

Default: false
video_endoptional
number

End time of the video in seconds (-1 for full duration)

Default: -1Range: -1 - 3600
video_startoptional
number

Start time of the video in seconds

Default: 0

Response Type

Returns: Video

Asynchronous requests (v2)

Use Async for video, long-running (>~60s), or high-concurrency workloads; Sync is simplest for fast image & LLM calls. Async submits a request and you poll it to completion.

  1. 1
    POST /v2/video-audio-merge

    Submitreturns request_id, status_url, response_url

  2. 2
    GET /v2/requests/{id}/status

    Polluntil COMPLETED or FAILED

  3. 3
    GET /v2/requests/{id}

    Resultfinal response body

Status states

QUEUEDAccepted, waiting for a worker
PROCESSINGRunning on a worker
COMPLETEDDone — result body is ready
FAILEDErrored (incl. content/RAI blocks)
  • A FAILED request is served as HTTP 422 — the body still carries the error detail.
  • An unknown or expired request_id returns HTTP 404.
  • Results are retained for 1 hour, then expire.
  • Content / RAI blocks surface as FAILED, not a separate state.
  • Track completion by polling the status endpoint.

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out