Open rafapgomes-zz opened 3 years ago
Same issue - I try merge three mp3s, and I get this error:
Cannot find a matching stream for unlabeled input pad 2 on filter Parsed_concat_0
The first input has multiple streams, but I am selecting 0:0. If I switch it so the first input only has 1 stream, it works
@wesbos Any solution how to merge audio to a video in nodejs?
@xts-bit I switched to this package: https://github.com/FFmpeg-wasm/FFmpeg.wasm
@wesbos Can you give me an example to do that? for adding a audio to a video in nodejs
Ask ChatGPT for the FFmpeg commands, they translate perfect to the wasm package
@wesbos Are you sure i tried this.
import { path as ffmpegPath } from '@ffmpeg-installer/ffmpeg';
import ffmpeg from '@ffmpeg.wasm/main';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
import path from 'path';
// ffmpeg.setFfmpegPath(ffmpegPath);
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const video = path.resolve(__dirname, 'video1.mp4');
const audio = path.resolve(__dirname, 'audio.mp3');
const destination = path.resolve(__dirname, 'output.mp4');
setTimeout(() => {
ffmpeg()
.input(video)
.input(audio)
.complexFilter([
{
filter: 'amix', options: { inputs: 2, duration: 'longest' }
}
])
.on('end', async function (output) {
console.log(output, 'files have been merged and saved.')
})
.saveToFile(destination)
}, 3000);
@wesbos Can you please help?
From my experience wasm package, while usable, was magnitudes slower than actual ffmpeg, so if performance is crucial, I would not recommend it
Im trying to merge a audio and a video file using ffmpeg-concat. I can merge two mp4 files with no audio, but when I try to put my mp3 file I receive an error
Version information
Code to reproduce
(note: if the problem only happens with some inputs, include a link to such an input file)
Expected results
files have been merged succesfully
Observed results
an error happened: ffmpeg exited with code 1: Cannot find a matching stream for unlabeled input pad 3 on filter Parsed_concat_0