|
1 | | -# (Legacy project) Fluent ffmpeg-API for node.js |
| 1 | +# Fluent FFmpeg-API with types for node.js |
2 | 2 |
|
3 | 3 | [](https://coveralls.io/github/fluent-ffmpeg/node-fluent-ffmpeg?branch=master) |
4 | 4 | [](https://app.fossa.io/projects/git%2Bgithub.com%2Ffluent-ffmpeg%2Fnode-fluent-ffmpeg?ref=badge_shield) |
5 | 5 |
|
| 6 | +## What will be done with this legacy project |
| 7 | +I will merge types from https://www.npmjs.com/package/@types/fluent-ffmpeg into this repo, put types and code ready at one place. \ |
| 8 | +And later I'm planing to fix [issues from previous repo](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues) and [merge PRs](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/pulls). |
| 9 | + |
| 10 | + |
| 11 | +## Installation |
| 12 | + |
| 13 | +Via npm: |
| 14 | + |
| 15 | +```sh |
| 16 | +# 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. |
| 17 | +$ npm install @ts-ffmpeg/fluent-ffmpeg |
| 18 | +``` |
| 19 | + |
| 20 | + |
| 21 | +### Creating an FFmpeg command |
| 22 | + |
| 23 | +The fluent-ffmpeg module returns a constructor that you can use to instanciate FFmpeg commands. |
| 24 | + |
| 25 | +```ts |
| 26 | +// ts |
| 27 | +import ffmpeg from '@ts-ffmpeg/fluent-ffmpeg' |
| 28 | +const command = ffmpeg(); |
| 29 | +``` |
| 30 | + |
| 31 | +You may pass an input file name or readable stream, a configuration object, or both to the constructor. |
| 32 | + |
| 33 | +```js |
| 34 | +const command = ffmpeg('/path/to/file.avi'); |
| 35 | +const command = ffmpeg(fs.createReadStream('/path/to/file.avi')); |
| 36 | +const command = ffmpeg({ option: "value", ... }); |
| 37 | +const command = ffmpeg('/path/to/file.avi', { option: "value", ... }); |
| 38 | +``` |
| 39 | + |
| 40 | +The following options are available: |
| 41 | +* `source`: input file name or readable stream (ignored if an input file is passed to the constructor) |
| 42 | +* `timeout`: ffmpeg timeout in seconds (defaults to no timeout) |
| 43 | +* `preset` or `presets`: directory to load module presets from (defaults to the `lib/presets` directory in fluent-ffmpeg tree) |
| 44 | +* `niceness` or `priority`: ffmpeg niceness value, between -20 and 20; ignored on Windows platforms (defaults to 0) |
| 45 | +* `logger`: logger object with `debug()`, `info()`, `warn()` and `error()` methods (defaults to no logging) |
| 46 | +* `stdoutLines`: maximum number of lines from ffmpeg stdout/stderr to keep in memory (defaults to 100, use 0 for unlimited storage) |
| 47 | + |
| 48 | + |
| 49 | +### Specifying inputs |
| 50 | + |
| 51 | +You can add any number of inputs to an Ffmpeg command. An input can be: |
| 52 | +* a file name (eg. `/path/to/file.avi`); |
| 53 | +* an image pattern (eg. `/path/to/frame%03d.png`); |
| 54 | +* 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. |
| 55 | + |
| 56 | +```js |
| 57 | +// Note that all fluent-ffmpeg methods are chainable |
| 58 | +ffmpeg('/path/to/input1.avi') |
| 59 | + .input('/path/to/input2.avi') |
| 60 | + .input(fs.createReadStream('/path/to/input3.avi')); |
| 61 | + |
| 62 | +// Passing an input to the constructor is the same as calling .input() |
| 63 | +ffmpeg() |
| 64 | + .input('/path/to/input1.avi') |
| 65 | + .input('/path/to/input2.avi'); |
| 66 | + |
| 67 | +// Most methods have several aliases, here you may use addInput or mergeAdd instead |
| 68 | +ffmpeg() |
| 69 | + .addInput('/path/to/frame%02d.png') |
| 70 | + .addInput('/path/to/soundtrack.mp3'); |
| 71 | + |
| 72 | +ffmpeg() |
| 73 | + .mergeAdd('/path/to/input1.avi') |
| 74 | + .mergeAdd('/path/to/input2.avi'); |
| 75 | +``` |
| 76 | + |
| 77 | +### More |
| 78 | +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 doc below. They are all the same with the lib `fluent-ffmpeg`. |
| 79 | + |
| 80 | + |
| 81 | +## Credits |
| 82 | +### Main contributors from [fluent-ffmpeg/node-fluent-ffmpeg](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg) project |
| 83 | + |
| 84 | +* [enobrev](http://github.com/enobrev) |
| 85 | +* [njoyard](http://github.com/njoyard) |
| 86 | +* [sadikzzz](http://github.com/sadikzzz) |
| 87 | +* [smremde](http://github.com/smremde) |
| 88 | +* [spruce](http://github.com/spruce) |
| 89 | +* [tagedieb](http://github.com/tagedieb) |
| 90 | +* [tommadema](http://github.com/tommadema) |
| 91 | +* [Weltschmerz](http://github.com/Weltschmerz) |
| 92 | + |
| 93 | +[and more others](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/graphs/contributors) |
| 94 | + |
| 95 | + |
| 96 | +### TS types authors from [@types/fluent-ffmpeg](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fluent-ffmpeg) |
| 97 | +These definitions were written by KIM Jaesuck a.k.a. gim tcaesvk, DingWeizhe, Mounir Abid, Doyoung Ha, and Prasad Nayak. |
| 98 | + |
| 99 | + |
| 100 | +## License |
| 101 | + |
| 102 | +(The MIT License) |
| 103 | + |
| 104 | +Copyright (c) 2011 Stefan Schaermeli <schaermu@gmail.com> |
| 105 | + |
| 106 | +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: |
| 107 | + |
| 108 | +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
| 109 | + |
| 110 | +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. |
| 111 | + |
| 112 | + |
| 113 | +[](https://app.fossa.io/projects/git%2Bgithub.com%2Ffluent-ffmpeg%2Fnode-fluent-ffmpeg?ref=badge_large) |
| 114 | + |
| 115 | + |
| 116 | +--- |
| 117 | +# Below are doc from legacy project |
| 118 | + |
6 | 119 | ## Fluent-ffmpeg is now deprecated |
7 | 120 |
|
8 | 121 | This library is **no longer maintained** and no longer works properly with recent ffmpeg versions. Use it as your own risk, this repository is readonly and does not accept issues or PRs. |
@@ -66,14 +179,14 @@ Alternatively, you may set the ffmpeg, ffprobe and flvtool2/flvmeta binary paths |
66 | 179 | The fluent-ffmpeg module returns a constructor that you can use to instanciate FFmpeg commands. |
67 | 180 |
|
68 | 181 | ```js |
69 | | -var FfmpegCommand = require('fluent-ffmpeg'); |
| 182 | +var FfmpegCommand = require('@ts-ffmpeg/fluent-ffmpeg'); |
70 | 183 | var command = new FfmpegCommand(); |
71 | 184 | ``` |
72 | 185 |
|
73 | 186 | You can also use the constructor without the `new` operator. |
74 | 187 |
|
75 | 188 | ```js |
76 | | -var ffmpeg = require('fluent-ffmpeg'); |
| 189 | +var ffmpeg = require('@ts-ffmpeg/fluent-ffmpeg'); |
77 | 190 | var command = ffmpeg(); |
78 | 191 | ``` |
79 | 192 |
|
@@ -1261,7 +1374,7 @@ fluent-ffmpeg enables you to query your installed ffmpeg version for supported f |
1261 | 1374 |
|
1262 | 1375 | ```js |
1263 | 1376 |
|
1264 | | -var Ffmpeg = require('fluent-ffmpeg'); |
| 1377 | +var Ffmpeg = require('@ts-ffmpeg/fluent-ffmpeg'); |
1265 | 1378 |
|
1266 | 1379 | Ffmpeg.getAvailableFormats(function(err, formats) { |
1267 | 1380 | console.log('Available formats:'); |
|
0 commit comments