Add Audio to Video: Replace or Mix Soundtrack, Music, Voice
Pricing
from $24.00 / 1,000 video with audio addeds
Add Audio to Video: Replace or Mix Soundtrack, Music, Voice
Replace or mix a soundtrack into videos from direct file URLs: add music or a voice-over, set volumes, duck music under speech, loop short tracks, fade and delay. Video is copied, not re-encoded. mp4 out with signed links. No YouTube. Free when a video fails.
Pricing
from $24.00 / 1,000 video with audio addeds
Rating
0.0
(0)
Developer
Data Done Right
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
7 days ago
Last modified
Categories
Features
Share
This tool will add audio to video files: give it direct video URLs and one audio file (music, a voice-over, a sound effect), and it returns an mp4 for every video with the soundtrack replaced or mixed with the original audio. Set the volumes, let the music duck under speech, loop a short track to fill the video, start it at a chosen second and fade it in and out. The picture is copied, not re-encoded, in the normal case. It runs ffmpeg in the cloud, so there is nothing to install and no API key.
What it does not do. It does not create audio: no text-to-speech, no music generation, no transcription. You bring the audio file. It reads direct video and audio files (mp4, mov, webm, mkv, avi; mp3, wav, m4a, aac, flac, ogg) from a public URL; it does not download from YouTube, Vimeo, TikTok, Spotify, SoundCloud or other streaming sites and rejects those links without charge. HLS/DASH playlists are not supported. It follows the robots.txt of the host that serves your files. It does not cut, trim or merge video, does not match audio to the picture automatically (no beat sync, no lip sync) and does not normalise loudness. Only the first audio track of each file is used. The result is always an mp4 with one AAC audio track. Use it only on files you own or have the right to process.
What you get
- One dataset row per video: source and audio URLs, mode, how often the audio was looped, whether the video had to be re-encoded, measured duration, size, width, height, a signed download link, and a status or a clear error.
- The result is as long as the video: longer audio is cut at the end of the video, shorter audio is looped (or left silent if you turn
loopoff). - Bad inputs never stop the run, say exactly what is wrong, and are free: a private or streaming-site link, a file that is not media, an audio file with no audio stream, a start time past the end of the video.
How to add audio to a video
- Put one or more direct video URLs in
videoUrls. - Put the audio file URL in
audioUrl. It is used for every video in the list. - Leave
modeonreplaceto swap the soundtrack, or choosemixto keep the original audio and play the new audio with it. - Run it. Open the dataset: every row has a
urlto the finished mp4. TheSUMMARYrecord lists each video's duration, resolution and notes.
How to add background music under speech (ducking)
Use mode: "mix", set audioVolume low (0.2 to 0.4 suits background music) and turn on duck. While the original audio is loud, the music is pushed down; in the pauses it comes back to the volume you set. Ducking works on loudness only: it cannot tell speech from other loud sounds, so loud background noise in the original also lowers the music. Example: {"mode": "mix", "audioVolume": 0.3, "duck": true, "fadeOutSeconds": 2}.
How to replace the audio of a video
mode: "replace" (the default) removes the original audio completely and uses the new audio at audioVolume. If the video has no audio track at all, both modes simply add the new audio, and the row says so.
How to give every video its own audio file
Use videos: [{"url": "https://example.com/ep1.mp4", "audioUrl": "https://example.com/ep1.mp3", "name": "episode-1"}, {"url": "https://example.com/ep2.mp4", "audioUrl": "https://example.com/ep2.wav", "mode": "mix", "audioVolume": 0.4, "delaySeconds": 2}]. Videos listed there are added to videoUrls, and an entry can set mode, audioVolume, originalVolume, duck, loop, delaySeconds, fadeInSeconds and fadeOutSeconds for that video only. Each distinct audio URL is downloaded once per run.
Looping, cutting, delay and fades
- Shorter audio,
loopon (default): repeated until the video ends. There is no crossfade, so a hard cut can be heard at each repeat; use a longer file or fade out at the end. The row'saudioLoopsandnotesay how often it repeated. - Shorter audio,
loopoff: the rest of the video is silent in replace mode, or has only the original audio in mix mode. - Longer audio: always cut at the end of the video.
fadeOutSecondsfades the new audio out over the last seconds of the video, so the cut is not abrupt. delaySecondsstarts the new audio that many seconds into the video (before that, silence in replace mode, the original audio in mix mode).fadeInSecondsfades in from that point.- The result has the same length as the video. If a video's own audio track is longer or shorter than its picture, the result still ends with the picture.
Video copy or re-encode
| Video copied (normal) | Video re-encoded (fallback) | |
|---|---|---|
| When | the video codec fits an mp4 (H.264, HEVC, AV1, VP9, MPEG-4) | the codec does not (for example VP8 from a webm, MJPEG) or the copy fails |
| What happens | the picture stream is copied bit for bit; only the audio is processed | the picture is re-encoded to H.264 (crf sets quality) with an even width and height |
| Quality and speed | no quality loss; seconds per video | one re-compression generation; much slower |
| Limit | the default limits (60 minutes, 500 MB) | 15 minutes: longer videos that need a re-encode are rejected without charge |
videoReencoded in the row tells you which happened. Other streams of the source (extra audio tracks, subtitles, data tracks) are dropped.
Input
| Field | Default | What it does |
|---|---|---|
videoUrls | sample video | Direct video file links (required). |
audioUrl | sample audio | Direct link to an audio file (or a video file whose audio is used). Max 200 MB by default. |
videos | empty | Per-video audio and options: [{"url", "audioUrl", "name", ...}]. |
mode | replace | replace or mix. |
audioVolume | 1 | Volume of the new audio (0 to 4; 1 = unchanged). |
originalVolume | 1 | Mix mode: volume of the video's own audio. |
duck | false | Mix mode: lower the new audio while the original is loud. |
loop | true | Repeat short audio until the video ends. |
delaySeconds | 0 | Start the new audio this many seconds into the video. |
fadeInSeconds / fadeOutSeconds | 0 / 0 | Fade the new audio in at its start / out at the end of the video. |
audioBitrateKbps | 192 | AAC bitrate of the result (64 to 320). |
crf | 23 | Quality when the video has to be re-encoded (16 best, 35 smallest). |
maxVideosPerRun | 50 | Hard cap on videos per run (max 1000). |
maxVideoSizeMb / maxAudioSizeMb | 500 / 200 | Source size caps (max 2048). |
maxDurationMinutes | 60 | Video duration cap. |
videoTimeoutSecs | 900 | Per download and per ffmpeg job. |
outputStoreName | empty | Save the files in a named store that is kept until you delete it. |
Input example:
{"videoUrls": ["https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4"],"audioUrl": "https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3","mode": "mix","audioVolume": 0.4,"duck": true,"fadeOutSeconds": 1.5}
Output
One row per video, from a real local run of the input above:
{"sourceUrl": "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4","videoIndex": 1,"name": null,"audioSource": "https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3","mode": "mix","originalAudioKept": true,"audioLoops": 2,"videoReencoded": false,"durationSeconds": 5.055,"width": 960,"height": 540,"bytes": 1088781,"url": "https://api.apify.com/v2/key-value-stores/<store>/records/v01-with-audio.mp4","key": "v01-with-audio.mp4","status": "ok","error": null,"note": "the audio (2.1s) is shorter than the video, so it was looped 2 more times (a hard cut at each seam; use a longer file or fadeOutSeconds)"}
A failure row has status: "error", an error that names the problem, and url: null, for example the audio file has no audio stream. On Apify the url is a signed link that downloads without a token. status is ok, error or skipped (spending limit or maxVideosPerRun reached).
Use with the Apify API, MCP, n8n and Make
Python:
from apify_client import ApifyClientclient = ApifyClient("<APIFY_TOKEN>")run = client.actor("data-done-right/add-audio-to-video").call(run_input={"videoUrls": ["https://example.com/promo.mp4"],"audioUrl": "https://example.com/music.mp3","mode": "mix", "audioVolume": 0.3, "duck": True})for row in client.dataset(run["defaultDatasetId"]).iterate_items():print(row["status"], row["url"] or row["error"])
JavaScript:
import { ApifyClient } from 'apify-client';const client = new ApifyClient({ token: '<APIFY_TOKEN>' });const run = await client.actor('data-done-right/add-audio-to-video').call({videoUrls: ['https://example.com/promo.mp4'], audioUrl: 'https://example.com/voiceover.wav', mode: 'replace' });const { items } = await client.dataset(run.defaultDatasetId).listItems();
In n8n or Make use the Apify node with the actor name and the same JSON. With Apify's MCP server (mcp.apify.com) an AI assistant can call it: "put this music under this video". It needs only a video URL and an audio URL.
Use cases
- Put a music bed under a batch of product or social videos, lowered automatically under any speech.
- Replace the soundtrack of a video after a licensing change, or swap a scratch track for the final mix.
- Add a voice-over (made by a text-to-speech tool or a person) to a screen recording or slideshow video.
- Dub a video: replace the original speech with a translated audio file, one file per video.
- Finish a video pipeline: frames or clips from earlier steps, then an audio track from a generator, then this step.
How much does it cost
Pay per event: $0.03 per video delivered (video-audio-added, $30 per 1,000). Failed and skipped videos, rejected links and the SUMMARY record are free. Plan discounts apply (Silver about 10%, Gold and higher about 20%).
- 1,000 videos: $30.
- 10,000 videos: $300.
- 100,000 videos: $3,000.
The price is per video whatever its length, size or mode; Apify platform usage is included. maxVideosPerRun caps a run, and if you set a maximum spend per run the Actor stops cleanly when it is reached and removes the file it could not charge for. When the video is copied, the ffmpeg step took well under a second for a 1-minute 1280x720 file in a local test; download and upload of the files is most of the time. Re-encoding (see above) is much slower, which is why it is limited to 15 minutes of video.
FAQ
Does it re-encode my video?
Normally not. If the video codec fits an mp4 (H.264, HEVC, AV1, VP9, MPEG-4) the picture is copied unchanged and only the audio is processed, so quality is not lost and it is fast. For other codecs, for example VP8 in a webm, the video is re-encoded to H.264, the row says so (videoReencoded: true), and videos over 15 minutes are rejected in that case.
Can it keep the original audio and add music?
Yes: mode: "mix" with audioVolume for the music and originalVolume for the original. Turn on duck to lower the music while someone is speaking. If the video has no audio, the new audio is added as it is.
How well does ducking work?
It compresses the new audio with the original audio as the trigger (ffmpeg sidechaincompress: threshold about -30 dB, ratio 8, 20 ms attack, 400 ms release). In tests the music is lowered while the original is loud and returns to its normal level in the silence after it. It reacts to loudness, not to speech, and the settings are not adjustable. Mixed output is passed through a limiter so the sum cannot clip.
What if the audio is shorter or longer than the video?
Shorter audio is looped by default (a hard cut at each repeat, noted in the row); turn loop off to leave the rest silent. Longer audio is cut at the end of the video. The result always has the length of the video.
Which audio formats work?
Whatever ffmpeg can read from a file: mp3, wav, m4a/aac, flac, ogg/opus, and the audio of a video file. The file must be a direct link. Files with no audio stream are rejected without charge. Only the first audio stream is used.
Which limits apply?
Videos up to 2 GB (default 500 MB) and 60 minutes by default (set maxDurationMinutes for more), audio files up to 2 GB (default 200 MB), up to 1,000 videos per run. Links to private or internal addresses are blocked, and the hosts of your files must allow automated fetching in their robots.txt. The whole source file is downloaded once per video.
How long are the files kept?
They live in the run's key-value store, which expires with your plan's retention period. Set outputStoreName to keep them in a named store until you delete it.
Related tools
- Video Frame Extractor: Keyframes, Scenes & Thumbnails for AI pulls still images from the same videos.
- Audio & Video to Text: Whisper Transcription, SRT & VTT turns speech into a transcript or subtitle file.
- Remove Silence from Audio & Video: Cut Pauses, Jump Cuts cuts pauses out before you add the music.
- Video Compressor & Resizer: Shrink MP4 for Web, Social & AI shrinks the finished file for web or social.
- Extract Audio from Video: MP3, WAV & FLAC in Bulk pulls the audio out of a video, the opposite of this step.