UNPKG

ffmpeg-concat

Version:

Concats a list of videos together using ffmpeg with sexy OpenGL transitions.

30 lines (26 loc) 571 B
'use strict' const ffmpeg = require('fluent-ffmpeg') module.exports = (opts) => { const { log, videoPath, outputFileName, start, duration } = opts return new Promise((resolve, reject) => { const cmd = ffmpeg(videoPath) .noVideo() .audioCodec('libmp3lame') .on('start', cmd => log({ cmd })) .on('end', () => resolve(outputFileName)) .on('error', (err) => reject(err)) if (start) { cmd.seekInput(start) } if (duration) { cmd.duration(duration) } cmd.save(outputFileName) }) }