Created
June 9, 2019 08:54
-
-
Save Saccarab/c8e0540e8a9ba26c771c2808c804e066 to your computer and use it in GitHub Desktop.
fluent-ffmpeg merge audio with video
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const command = ffmpeg() | |
const commandArray = [] | |
command.addInput(`./best.mp4`) | |
command.addInput(`./best2.wav`) | |
commandArray.push(`[1]volume=0.1[a1]`) | |
command.addInput(`./voiceover.mp3`) | |
commandArray.push(`[2]volume=0.9[a2]`) | |
let ffmpegKeys = '[a1][a2]amix=inputs=2[a]' | |
commandArray.push(ffmpegKeys) | |
command.complexFilter(commandArray) | |
command.addOptions(['-map 0:v', '-map [a]', '-c:v copy']) | |
.format('mp4') | |
.on('error', (error) => { | |
console.log(error) | |
}) | |
.on('end', function() { | |
console.log('Merging finished !'); | |
}) | |
.save('./merged.mp4'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! I get this error, I've been looking for a long time how to merge audio and video and it's taking a while
This is my code:
This is the error: