Skip to content

DocsGuides

Background music

Mix a music track under the original sound at the level you choose.

audio.mix puts more sound under the output's own: a music bed under a voice. The original keeps its level and the output ends with the video.

The request#

bash
curl "$VIDEXO_API_URL/v1/transcode" \
  -H "Authorization: Bearer $VIDEXO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": "https://example.com/talk.mp4",
  "filename": "talk-music.mp4",
  "extra_inputs": {
    "music": "https://example.com/music.mp3"
  },
  "video": {
    "codec": "copy"
  },
  "audio": {
    "mix": [
      {
        "input": "music",
        "volume": 0.2
      }
    ]
  }
}'

talk-music.mp4: the same picture, the music at a fifth of its volume under the voice, ending with the video.

The music is an extra input (extra_inputs on a per-operation endpoint, or another entry in inputs on POST /v1/jobs); volume sets its level, 0.2 is a fifth.

A video without sound#

Mixing needs an audio track to mix under. For a silent video, take the sound from the music instead; the output ends with the video, the music cut there or padded with silence:

bash
curl "$VIDEXO_API_URL/v1/transcode" \
  -H "Authorization: Bearer $VIDEXO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": "https://example.com/talk.mp4",
  "filename": "slideshow.mp4",
  "extra_inputs": {
    "music": "https://example.com/music.mp3"
  },
  "video": {
    "codec": "copy"
  },
  "audio": {
    "input": "music"
  }
}'