I will merge types from @types/fluent-ffmpeg into this repo, put types and code ready at one place.
And later I'm planing to fix issues from previous repo and merge PRs.
Via npm:
# this lib starts from v2.2.0, which is the same code with `fluent-ffmpeg@2.1`. I just reduce the useless code in npm lib.
$ npm install @ts-ffmpeg/fluent-ffmpegThe fluent-ffmpeg module returns a constructor that you can use to instanciate FFmpeg commands.
// ts
import ffmpeg from '@ts-ffmpeg/fluent-ffmpeg'
const command = ffmpeg();You may pass an input file name or readable stream, a configuration object, or both to the constructor.
const command = ffmpeg('/path/to/file.avi');
const command = ffmpeg(fs.createReadStream('/path/to/file.avi'));
const command = ffmpeg({ option: "value", ... });
const command = ffmpeg('/path/to/file.avi', { option: "value", ... });The following options are available:
source: input file name or readable stream (ignored if an input file is passed to the constructor)timeout: ffmpeg timeout in seconds (defaults to no timeout)presetorpresets: directory to load module presets from (defaults to thelib/presetsdirectory in fluent-ffmpeg tree)nicenessorpriority: ffmpeg niceness value, between -20 and 20; ignored on Windows platforms (defaults to 0)logger: logger object withdebug(),info(),warn()anderror()methods (defaults to no logging)stdoutLines: maximum number of lines from ffmpeg stdout/stderr to keep in memory (defaults to 100, use 0 for unlimited storage)
You can add any number of inputs to an Ffmpeg command. An input can be:
- a file name (eg.
/path/to/file.avi); - an image pattern (eg.
/path/to/frame%03d.png); - a readable stream; only one input stream may be used for a command, but you can use both an input stream and one or several file names.
// Note that all fluent-ffmpeg methods are chainable
ffmpeg('/path/to/input1.avi')
.input('/path/to/input2.avi')
.input(fs.createReadStream('/path/to/input3.avi'));
// Passing an input to the constructor is the same as calling .input()
ffmpeg()
.input('/path/to/input1.avi')
.input('/path/to/input2.avi');
// Most methods have several aliases, here you may use addInput or mergeAdd instead
ffmpeg()
.addInput('/path/to/frame%02d.png')
.addInput('/path/to/soundtrack.mp3');
ffmpeg()
.mergeAdd('/path/to/input1.avi')
.mergeAdd('/path/to/input2.avi');This lib is currently written in js for code, and a standalone index.d.ts for typing. So you can easily import lib by require or import.
For more examples, you can explore the legacy doc. They are all the same with the lib fluent-ffmpeg.
Main contributors from fluent-ffmpeg/node-fluent-ffmpeg project
TS types authors from @types/fluent-ffmpeg
These definitions were written by
(The MIT License)
Copyright (c) 2011-2024 Stefan Schaermeli <schaermu@gmail.com>
Copyright (c) 2025-2026 Jonham Chen <jonhamchen@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.