1.0.2 • Published 8 months ago

promise-audioconcat v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

promise-audioconcat NPM Licence TypeScript

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

1.0.2

8 months ago

1.0.1

9 months ago

1.0.0

9 months ago