promise-audioconcat
v1.0.2
Published
Concatenates multiple audio files using ffmpeg
Downloads
4
Readme
promise-audioconcat
Concatenates multiple audio files using ffmpeg
.
promise-audioconcat
provides a programmatic interface to do basically the same as calling ffmpeg
via CLI like:
ffmpeg -i "concat:audio1.mp3|audio2.mp3" -acodec copy out.mp3
Install
npm install promise-audioconcat
Usage
TypeScript
import audioconcat from 'promise-audioconcat';
JavaScript
const audioconcat = require('promise-audioconcat');
API
audioconcat(inputs: string[], output: string): Promise<void>
- inputs: an array of the filenames of the audio files to concatenate
- output: the filename of the output file
Note: The output file will be overwritten if it exists.
const songs = [
'introduction.mp3',
'recording.mp3',
];
const output = 'combined.mp3';
try {
const output = await audioconcat(songs, output);
console.log(`Audio created in ${output}`);
} catch (err) {
console.error('Error:', err);
console.error('ffmpeg stderr:', err.stderr);
}
See also
- audioconcat - The package that inspired this one
- fluent-ffmpeg - The underlying ffmpeg library
- @ffmpeg-installer/ffmpeg - Provides the required ffmpeg binaries