Concats a list of videos together using ffmpeg with sexy OpenGL transitions.
npm install node-ffmpeg-concat> Concats a list of videos together using ffmpeg with sexy OpenGL transitions.
!NPM

_(example of 9 videos concatenated together with unique transitions)_
_(note that the quality and fps is only poor due to the GIF preview; here is the original)_
This is a reimagined version of the original ffmpeg-concat package, designed to provide enhanced features, TypeScript support, and a comprehensive collection of transition names. The goal is to offer improved functionality and maintain regular updates. If you encounter any issues or have feedback, please feel free to leave them on the GitHub repository.
Noteworthy Features:
- Extended feature set for more versatile video concatenation and manipulation.
- Full ECMAScript Modules (esm)
Compatibility Note:
- The package includes the 'gl' dependency, which is crucial for its functionality.
FFmpeg is the de facto standard in command-line video editing, but it is really difficult to concatenate videos together using non-trivial transitions. Here are some convoluted examples of a simple cross-fade between two videos. FFmpeg filter graphs are extremely powerful, but for implementing transitions, they are just too complicated and error-prone.
GL Transitions, on the other hand, is a great open source initiative spearheaded by Gaëtan Renaudeau that is aimed at using GLSL to establish a universal collection of transitions. Its extremely simple spec makes it really easy to customize existing transitions or write your own as opposed to struggling with complex ffmpeg filter graphs.
This module and CLI make it easy to concat videos together using gl-transitions.
This module requires ffmpeg to be installed.
IMPORTANT: This package uses the 'gl' dependency which requires native compilation. You must follow the node-gyp installation guide for your system before installing this package.
This module requires ffmpeg to be installed.
``bash`
npm install sharp async-ffmpeg fluent-ffmpeg
`bash
npm install node-ffmpeg-concat
WARNING: The CLI is not supported in this version yet, it will be implemented soon. (I'm considering using another package to avoid adding more dependencies here, please let me know if you need it and I will implement it.)
This package runs on Linux, macOS, and Windows.
CLI
`sh
Usage: node-ffmpeg-concat [options] Options:
-V, --version output the version number
-o, --output
Example:
node-ffmpeg-concat -t circleopen -d 750 -o huzzah.mp4 0.mp4 1.mp4 2.mp4
`Usage
`js
import { concat } from 'node-ffmpeg-concat';// concat 3 mp4s together using 2 500ms directionalWipe transitions
await concat({
output: 'test.mp4',
videos: ['media/0.mp4', 'media/1.mp4', 'media/2.mp4'],
transition: {
name: 'directionalWipe',
duration: 500,
},
});
``js
// concat 5 mp4s together using 4 different transitions
await concat({
output: 'test.mp4',
videos: ['media/0.mp4', 'media/1.mp4', 'media/2.mp4', 'media/0.mp4', 'media/1.mp4'],
transitions: [
{
name: 'circleOpen',
duration: 1000,
},
{
name: 'crossWarp',
duration: 800,
},
{
name: 'directionalWarp',
duration: 500,
// pass custom params to a transition
params: { direction: [1, -1] },
},
{
name: 'squaresWire',
duration: 2000,
},
],
});
``js
import { transitions } from 'node-ffmpeg-concat';
// get a list of all transitions
// all transitions have a strong typescript support, and you can get suggestions for all available transitions name.
`API
$3
Concatenates video files together along with OpenGL transitions. Returns a
Promise for when the output video has been written.Note that you must specify
videos, output, and either transition or transitions.Note that the output video's size and fps are determined by the first input video.
#### options
##### videos
Type:
Array
RequiredArray of videos to concat, where each item is a path or URL to a video file.
##### output
Type:
String
RequiredPath to an
mp4 video file to write.Note: we currently only support outputting to mp4; please open an issue if you'd like to see support for more formats.
##### transition
Type:
ObjectSpecifies a default transition to be used between each video.
Note that you must specify either
transition or transitions, depending on how much control you want over each transition. If you specify both, transitions takes precedence.`js
// example
const transition = {
duration: 1000, // ms
name: 'directionalwipe', // gl-transition name to use (will match with lower-casing)
params: { direction: [1, -1] }, // optionally override default parameters
};
`##### transitions
Type:
Array