diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8d970499..d89a9324 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -2,30 +2,29 @@ ## Reporting issues -Please start by [reading the FAQ][faq] first. If your question is not answered, here are some guidelines on how to effectively report issues. +Please start by [reading the FAQ][faq] first. If your question is not answered, here are some guidelines on how to effectively report issues. ### Required information When reporting issues be sure to include at least: -* Some code that may be used to reproduce the problem -* Which version of fluent-ffmpeg, of ffmpeg and which OS you're using -* If the problem only happens with some input sources, please include a link to a source that may be used to reproduce the problem -* Be sure to include the full error message when there is one -* When an ffmpeg error happens (eg. 'ffmpeg exited with code 1'), you should also include the full output from ffmpeg (stdout and stderr), as it may contain useful information about what whent wrong. You can do that by looking at the 2nd and 3rd parameters of the `error` event handler on an FfmpegCommand, for example: +- Some code that may be used to reproduce the problem +- Which version of fluent-ffmpeg, of ffmpeg and which OS you're using +- If the problem only happens with some input sources, please include a link to a source that may be used to reproduce the problem +- Be sure to include the full error message when there is one +- When an ffmpeg error happens (eg. 'ffmpeg exited with code 1'), you should also include the full output from ffmpeg (stdout and stderr), as it may contain useful information about what whent wrong. You can do that by looking at the 2nd and 3rd parameters of the `error` event handler on an FfmpegCommand, for example: ```js -ffmpeg('some/input.mp4') - .on('error', function(err, stdout, stderr) { - console.log('An error happened: ' + err.message); - console.log('ffmpeg standard output:\n' + stdout); - console.log('ffmpeg standard error:\n' + stderr); - }); +ffmpeg('some/input.mp4').on('error', function (err, stdout, stderr) { + console.log('An error happened: ' + err.message) + console.log('ffmpeg standard output:\n' + stdout) + console.log('ffmpeg standard error:\n' + stderr) +}) ``` ### Ffmpeg usage -If your command ends up with an ffmpeg error (eg. 'ffmpeg exited with code X : ...'), be sure to try the command manually from command line. You can get the ffmpeg command line that is executed for a specific Fluent-ffmpeg command by using the `start` event: +If your command ends up with an ffmpeg error (eg. 'ffmpeg exited with code X : ...'), be sure to try the command manually from command line. You can get the ffmpeg command line that is executed for a specific Fluent-ffmpeg command by using the `start` event: ```js ffmpeg('some/input.mp4') @@ -37,7 +36,7 @@ ffmpeg('some/input.mp4') If it does not work, you most likely have a ffmpeg-related problem that does not fit as a fluent-ffmpeg issue; in that case head to the [ffmpeg documentation](ffmpeg.org/documentation.html) to find out what you did wrong. -If it _does_ work, please double-check how you escaped arguments and options when passing them to fluent-ffmpeg. For example, when running from command line, you may have to quote arguments to tell your shell that a space is indeed part of a filename or option. When using fluent-ffmpeg, you don't have to do that, as you're already passing options and arguments separately. Here's a (dumb) example: +If it _does_ work, please double-check how you escaped arguments and options when passing them to fluent-ffmpeg. For example, when running from command line, you may have to quote arguments to tell your shell that a space is indeed part of a filename or option. When using fluent-ffmpeg, you don't have to do that, as you're already passing options and arguments separately. Here's a (dumb) example: ```sh $ ffmpeg -i video with spaces.avi diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index f6c7181d..693610b9 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -2,31 +2,26 @@ ### Version information -* fluent-ffmpeg version: -* ffmpeg version: -* OS: +- fluent-ffmpeg version: +- ffmpeg version: +- OS: ### Code to reproduce ```js - ``` (note: if the problem only happens with some inputs, include a link to such an input file) ### Expected results - - ### Observed results - - ### Checklist -* [ ] I have read the [FAQ](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/wiki/FAQ) -* [ ] I tried the same with command line ffmpeg and it works correctly (hint: if the problem also happens this way, this is an ffmpeg problem and you're not reporting it to the right place) -* [ ] I have included full stderr/stdout output from ffmpeg +- [ ] I have read the [FAQ](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/wiki/FAQ) +- [ ] I tried the same with command line ffmpeg and it works correctly (hint: if the problem also happens this way, this is an ffmpeg problem and you're not reporting it to the right place) +- [ ] I have included full stderr/stdout output from ffmpeg diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97b9679e..b077ffcf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,55 +1,106 @@ -name: CI Testing +name: Continuous integration on: - pull_request: push: branches: - master + pull_request: jobs: - test: - name: Run tests + lint: + name: Lint source files + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup node + uses: actions/setup-node@v3 + with: + cache: yarn + + - name: Install dependencies + run: yarn + + - name: Lint source files + run: yarn lint + + unit-tests: + name: Unit tests runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup node + uses: actions/setup-node@v3 + with: + cache: yarn + + - name: Install dependencies + run: yarn + + - name: Build + run: yarn build + + - name: Run unit tests + run: yarn test tests/unit + + - name: Upload coverage + uses: coverallsapp/github-action@v2 + with: + parallel: true + + integration-tests: strategy: matrix: - node: [18, 20, 21] + os: + - ubuntu-latest + - macos-latest + - windows-latest + node: + - 18 + - 20 + name: Test Node ${{ matrix.node }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v4 - - name: Install flvtool2 - run: sudo gem install flvtool2 - - name: Install ffmpeg - run: sudo apt install -y ffmpeg + - name: Setup node uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} cache: yarn + + - name: Install ffmpeg + uses: ConorMacBride/install-package@v1 + with: + apt: ffmpeg + brew: ffmpeg + choco: ffmpeg + - name: Install dependencies run: yarn + + - name: Build + run: yarn build + - name: Run tests - run: yarn test - - name: Generate coverage report - run: yarn coverage - - name: Store coveralls coverage + run: yarn test tests/integration + + - name: Upload coverage uses: coverallsapp/github-action@v2 with: - flag-name: linux-node-${{ matrix.node }} parallel: true - - name: Upload to codecov - uses: codecov/codecov-action@v3 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - files: coverage/lcov.info - name: ubuntu-latest-node-${{ matrix.node }} - upload-coverage: - name: Upload coverage - needs: test + finish-coverage: + name: Finalize coverage + needs: + - unit-tests + - integration-tests if: ${{ always() }} runs-on: ubuntu-latest steps: - - name: Upload to coveralls + - name: Finalize coverage uses: coverallsapp/github-action@v2 with: parallel-finished: true - carryforward: "linux-node-18,linux-node-20,linux-node-21" diff --git a/.gitignore b/.gitignore index 604c00ea..357242c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ -*.project +build +coverage node_modules .nyc_output -*.swp -.idea -*.iml -coverage +types \ No newline at end of file diff --git a/.npmignore b/.npmignore index bb1c3b14..043d950f 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,3 @@ -*.md .git* test/ -examples/ \ No newline at end of file +src/ \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..5498e0f4 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +build +coverage diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..eca9e731 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +semi: false +singleQuote: true +trailingComma: none diff --git a/Makefile b/Makefile deleted file mode 100644 index 53ad230a..00000000 --- a/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -REPORTER = spec -MOCHA = node_modules/.bin/mocha - -test: - @NODE_ENV=test $(MOCHA) --require should --reporter $(REPORTER) - -test-colors: - @NODE_ENV=test $(MOCHA) --require should --reporter $(REPORTER) --colors - -publish: - @npm version patch -m "version bump" - @npm publish - -JSDOC = node_modules/.bin/jsdoc -JSDOC_CONF = tools/jsdoc-conf.json - -doc: - $(JSDOC) --configure $(JSDOC_CONF) - -.PHONY: test test-colors publish doc \ No newline at end of file diff --git a/README.md b/README.md index 313f4f04..b98d844f 100644 --- a/README.md +++ b/README.md @@ -1,1489 +1,24 @@ # Fluent ffmpeg-API for node.js [![Coverage Status](https://coveralls.io/repos/github/fluent-ffmpeg/node-fluent-ffmpeg/badge.svg?branch=master)](https://coveralls.io/github/fluent-ffmpeg/node-fluent-ffmpeg?branch=master) -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Ffluent-ffmpeg%2Fnode-fluent-ffmpeg.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Ffluent-ffmpeg%2Fnode-fluent-ffmpeg?ref=badge_shield) > **Fluent-ffmpeg is looking for new maintainers** > More details [on the wiki](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/wiki/Looking-for-a-new-maintainer) This library abstracts the complex command-line usage of ffmpeg into a fluent, easy to use node.js module. In order to be able to use this module, make sure you have [ffmpeg](http://www.ffmpeg.org) installed on your system (including all necessary encoding libraries like libmp3lame or libx264). -> This is the documentation for fluent-ffmpeg 2.x. -> You can still access the code and documentation for fluent-ffmpeg 1.7 [here](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/tree/1.x). +> This is the documentation for fluent-ffmpeg 3.x. -## Installation - -Via npm: - -```sh -$ npm install fluent-ffmpeg -``` - -Or as a submodule: -```sh -$ git submodule add git://github.com/schaermu/node-fluent-ffmpeg.git vendor/fluent-ffmpeg -``` - - - -## Usage - -You will find a lot of usage examples (including a real-time streaming example using [flowplayer](http://www.flowplayer.org) and [express](https://github.com/visionmedia/express)!) in the `examples` folder. - - -### Prerequisites +## Prerequisites -#### ffmpeg and ffprobe +fluent-ffmpeg requires ffmpeg >= 0.9 to work. It may work with previous versions but several features won't be available (and the library is not tested with lower versions anylonger). -fluent-ffmpeg requires ffmpeg >= 0.9 to work. It may work with previous versions but several features won't be available (and the library is not tested with lower versions anylonger). - -If the `FFMPEG_PATH` environment variable is set, fluent-ffmpeg will use it as the full path to the `ffmpeg` executable. Otherwise, it will attempt to call `ffmpeg` directly (so it should be in your `PATH`). You must also have ffprobe installed (it comes with ffmpeg in most distributions). Similarly, fluent-ffmpeg will use the `FFPROBE_PATH` environment variable if it is set, otherwise it will attempt to call it in the `PATH`. - -Most features should work when using avconv and avprobe instead of ffmpeg and ffprobe, but they are not officially supported at the moment. +If the `FFMPEG_PATH` environment variable is set, fluent-ffmpeg will use it as the full path to the `ffmpeg` executable. Otherwise, it will attempt to call `ffmpeg` directly (so it should be in your `PATH`). You must also have ffprobe installed (it comes with ffmpeg in most distributions). Similarly, fluent-ffmpeg will use the `FFPROBE_PATH` environment variable if it is set, otherwise it will attempt to call it in the `PATH`. **Windows users**: most probably ffmpeg and ffprobe will _not_ be in your `%PATH`, so you _must_ set `%FFMPEG_PATH` and `%FFPROBE_PATH`. -**Debian/Ubuntu users**: the official repositories have the ffmpeg/ffprobe executable in the `libav-tools` package, and they are actually rebranded avconv/avprobe executables (avconv is a fork of ffmpeg). They should be mostly compatible, but should you encounter any issue, you may want to use the real ffmpeg instead. You can either compile it from source or find a pre-built .deb package at https://ffmpeg.org/download.html (For Ubuntu, the `ppa:mc3man/trusty-media` PPA provides recent builds). - -#### flvtool2 or flvmeta - -If you intend to encode FLV videos, you must have either flvtool2 or flvmeta installed and in your `PATH` or fluent-ffmpeg won't be able to produce streamable output files. If you set either the `FLVTOOL2_PATH` or `FLVMETA_PATH`, fluent-ffmpeg will try to use it instead of searching in the `PATH`. - -#### Setting binary paths manually - -Alternatively, you may set the ffmpeg, ffprobe and flvtool2/flvmeta binary paths manually by using the following API commands: - -* **Ffmpeg.setFfmpegPath(path)** Argument `path` is a string with the full path to the ffmpeg binary. -* **Ffmpeg.setFfprobePath(path)** Argument `path` is a string with the full path to the ffprobe binary. -* **Ffmpeg.setFlvtoolPath(path)** Argument `path` is a string with the full path to the flvtool2 or flvmeta binary. - - -### Creating an FFmpeg command - -The fluent-ffmpeg module returns a constructor that you can use to instanciate FFmpeg commands. - -```js -var FfmpegCommand = require('fluent-ffmpeg'); -var command = new FfmpegCommand(); -``` - -You can also use the constructor without the `new` operator. - -```js -var ffmpeg = require('fluent-ffmpeg'); -var command = ffmpeg(); -``` - -You may pass an input file name or readable stream, a configuration object, or both to the constructor. - -```js -var command = ffmpeg('/path/to/file.avi'); -var command = ffmpeg(fs.createReadStream('/path/to/file.avi')); -var command = ffmpeg({ option: "value", ... }); -var 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) -* `preset` or `presets`: directory to load module presets from (defaults to the `lib/presets` directory in fluent-ffmpeg tree) -* `niceness` or `priority`: ffmpeg niceness value, between -20 and 20; ignored on Windows platforms (defaults to 0) -* `logger`: logger object with `debug()`, `info()`, `warn()` and `error()` 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) - - -### Specifying inputs - -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. - -```js -// 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'); -``` - - -### Input options - -The following methods enable passing input-related options to ffmpeg. Each of these methods apply on the last input added (including the one passed to the constructor, if any). You must add an input before calling those, or an error will be thrown. - -#### inputFormat(format): specify input format - -**Aliases**: `fromFormat()`, `withInputFormat()`. - -This is only useful for raw inputs, as ffmpeg can determine the input format automatically. - -```js -ffmpeg() - .input('/dev/video0') - .inputFormat('mov') - .input('/path/to/file.avi') - .inputFormat('avi'); -``` - -Fluent-ffmpeg checks for format availability before actually running the command, and throws an error when a specified input format is not available. - -#### inputFPS(fps): specify input framerate - -**Aliases**: `withInputFps()`, `withInputFPS()`, `withFpsInput()`, `withFPSInput()`, `inputFps()`, `fpsInput()`, `FPSInput()`. - -This is only valid for raw inputs, as ffmpeg can determine the input framerate automatically. - -```js -ffmpeg('/dev/video0').inputFPS(29.7); -``` - -#### native(): read input at native framerate - -**Aliases**: `nativeFramerate()`, `withNativeFramerate()`. - -```js -ffmpeg('/path/to/file.avi').native(); -``` - -#### seekInput(time): set input start time - -**Alias**: `setStartTime()`. - -Seeks an input and only start decoding at given time offset. The `time` argument may be a number (in seconds) or a timestamp string (with format `[[hh:]mm:]ss[.xxx]`). - -```js -ffmpeg('/path/to/file.avi').seekInput(134.5); -ffmpeg('/path/to/file.avi').seekInput('2:14.500'); -``` - -#### loop([duration]): loop over input - -```js -ffmpeg('/path/to/file.avi').loop(); -ffmpeg('/path/to/file.avi').loop(134.5); -ffmpeg('/path/to/file.avi').loop('2:14.500'); -``` - -#### inputOptions(option...): add custom input options - -**Aliases**: `inputOption()`, `addInputOption()`, `addInputOptions()`, `withInputOption()`, `withInputOptions()`. - -This method allows passing any input-related option to ffmpeg. You can call it with a single argument to pass a single option, optionally with a space-separated parameter: - -```js -/* Single option */ -ffmpeg('/path/to/file.avi').inputOptions('-someOption'); - -/* Single option with parameter */ -ffmpeg('/dev/video0').inputOptions('-r 24'); -``` - -You may also pass multiple options at once by passing an array to the method: - -```js -ffmpeg('/path/to/file.avi').inputOptions([ - '-option1', - '-option2 param2', - '-option3', - '-option4 param4' -]); -``` - -Finally, you may also directly pass command line tokens as separate arguments to the method: - -```js -ffmpeg('/path/to/file.avi').inputOptions( - '-option1', - '-option2', 'param2', - '-option3', - '-option4', 'param4' -); -``` - - -### Audio options - -The following methods change the audio stream(s) in the produced output. - -#### noAudio(): disable audio altogether - -**Aliases**: `withNoAudio()`. - -Disables audio in the output and remove any previously set audio option. - -```js -ffmpeg('/path/to/file.avi').noAudio(); -``` - -#### audioCodec(codec): set audio codec - -**Aliases**: `withAudioCodec()`. - -```js -ffmpeg('/path/to/file.avi').audioCodec('libmp3lame'); -``` - -Fluent-ffmpeg checks for codec availability before actually running the command, and throws an error when a specified audio codec is not available. - -#### audioBitrate(bitrate): set audio bitrate - -**Aliases**: `withAudioBitrate()`. - -Sets the audio bitrate in kbps. The `bitrate` parameter may be a number or a string with an optional `k` suffix. This method is used to enforce a constant bitrate; use `audioQuality()` to encode using a variable bitrate. - -```js -ffmpeg('/path/to/file.avi').audioBitrate(128); -ffmpeg('/path/to/file.avi').audioBitrate('128'); -ffmpeg('/path/to/file.avi').audioBitrate('128k'); -``` - -#### audioChannels(count): set audio channel count - -**Aliases**: `withAudioChannels()`. - -```js -ffmpeg('/path/to/file.avi').audioChannels(2); -``` - -#### audioFrequency(freq): set audio frequency - -**Aliases**: `withAudioFrequency()`. - -The `freq` parameter specifies the audio frequency in Hz. - -```js -ffmpeg('/path/to/file.avi').audioFrequency(22050); -``` - -#### audioQuality(quality): set audio quality - -**Aliases**: `withAudioQuality()`. - -This method fixes a quality factor for the audio codec (VBR encoding). The quality scale depends on the actual codec used. - -```js -ffmpeg('/path/to/file.avi') - .audioCodec('libmp3lame') - .audioQuality(0); -``` - -#### audioFilters(filter...): add custom audio filters - -**Aliases**: `audioFilter()`, `withAudioFilter()`, `withAudioFilters()`. - -This method enables adding custom audio filters. You may add multiple filters at once by passing either several arguments or an array. See the Ffmpeg documentation for available filters and their syntax. - -Each filter pased to this method can be either a filter string (eg. `volume=0.5`) or a filter specification object with the following keys: -* `filter`: filter name -* `options`: optional; either an option string for the filter (eg. `n=-50dB:d=5`), an options array for unnamed options (eg. `['-50dB', 5]`) or an object mapping option names to values (eg. `{ n: '-50dB', d: 5 }`). When `options` is not specified, the filter will be added without any options. - -```js -ffmpeg('/path/to/file.avi') - .audioFilters('volume=0.5') - .audioFilters('silencedetect=n=-50dB:d=5'); - -ffmpeg('/path/to/file.avi') - .audioFilters('volume=0.5', 'silencedetect=n=-50dB:d=5'); - -ffmpeg('/path/to/file.avi') - .audioFilters(['volume=0.5', 'silencedetect=n=-50dB:d=5']); - -ffmpeg('/path/to/file.avi') - .audioFilters([ - { - filter: 'volume', - options: '0.5' - }, - { - filter: 'silencedetect', - options: 'n=-50dB:d=5' - } - ]); - -ffmpeg('/path/to/file.avi') - .audioFilters( - { - filter: 'volume', - options: ['0.5'] - }, - { - filter: 'silencedetect', - options: { n: '-50dB', d: 5 } - } - ]); -``` - - -### Video options - -The following methods change the video stream(s) in the produced output. - -#### noVideo(): disable video altogether - -**Aliases**: `withNoVideo()`. - -This method disables video output and removes any previously set video option. - -```js -ffmpeg('/path/to/file.avi').noVideo(); -``` - -#### videoCodec(codec): set video codec - -**Aliases**: `withVideoCodec()`. - -```js -ffmpeg('/path/to/file.avi').videoCodec('libx264'); -``` - -Fluent-ffmpeg checks for codec availability before actually running the command, and throws an error when a specified video codec is not available. - -#### videoBitrate(bitrate[, constant=false]): set video bitrate - -**Aliases**: `withVideoBitrate()`. - -Sets the target video bitrate in kbps. The `bitrate` argument may be a number or a string with an optional `k` suffix. The `constant` argument specifies whether a constant bitrate should be enforced (defaults to false). - -Keep in mind that, depending on the codec used, enforcing a constant bitrate often comes at the cost of quality. The best way to have a constant video bitrate without losing too much quality is to use 2-pass encoding (see Fffmpeg documentation). - -```js -ffmpeg('/path/to/file.avi').videoBitrate(1000); -ffmpeg('/path/to/file.avi').videoBitrate('1000'); -ffmpeg('/path/to/file.avi').videoBitrate('1000k'); -ffmpeg('/path/to/file.avi').videoBitrate('1000k', true); -``` - -#### videoFilters(filter...): add custom video filters - -**Aliases**: `videoFilter()`, `withVideoFilter()`, `withVideoFilters()`. - -This method enables adding custom video filters. You may add multiple filters at once by passing either several arguments or an array. See the Ffmpeg documentation for available filters and their syntax. - -Each filter pased to this method can be either a filter string (eg. `fade=in:0:30`) or a filter specification object with the following keys: -* `filter`: filter name -* `options`: optional; either an option string for the filter (eg. `in:0:30`), an options array for unnamed options (eg. `['in', 0, 30]`) or an object mapping option names to values (eg. `{ t: 'in', s: 0, n: 30 }`). When `options` is not specified, the filter will be added without any options. - -```js -ffmpeg('/path/to/file.avi') - .videoFilters('fade=in:0:30') - .videoFilters('pad=640:480:0:40:violet'); - -ffmpeg('/path/to/file.avi') - .videoFilters('fade=in:0:30', 'pad=640:480:0:40:violet'); - -ffmpeg('/path/to/file.avi') - .videoFilters(['fade=in:0:30', 'pad=640:480:0:40:violet']); - -ffmpeg('/path/to/file.avi') - .videoFilters([ - { - filter: 'fade', - options: 'in:0:30' - }, - { - filter: 'pad', - options: '640:480:0:40:violet' - } - ]); - -ffmpeg('/path/to/file.avi') - .videoFilters( - { - filter: 'fade', - options: ['in', 0, 30] - }, - { - filter: 'filter2', - options: { w: 640, h: 480, x: 0, y: 40, color: 'violet' } - } - ); -``` - -#### fps(fps): set output framerate - -**Aliases**: `withOutputFps()`, `withOutputFPS()`, `withFpsOutput()`, `withFPSOutput()`, `withFps()`, `withFPS()`, `outputFPS()`, `outputFps()`, `fpsOutput()`, `FPSOutput()`, `FPS()`. - -```js -ffmpeg('/path/to/file.avi').fps(29.7); -``` - -#### frames(count): specify frame count - -**Aliases**: `takeFrames()`, `withFrames()`. - -Set ffmpeg to only encode a certain number of frames. - -```js -ffmpeg('/path/to/file.avi').frames(240); -``` - - -### Video frame size options - -The following methods enable resizing the output video frame size. They all work together to generate the appropriate video filters. - -#### size(size): set output frame size - -**Aliases**: `videoSize()`, `withSize()`. - -This method sets the output frame size. The `size` argument may have one of the following formats: -* `640x480`: set a fixed output frame size. Unless `autopad()` is called, this may result in the video being stretched or squeezed to fit the requested size. -* `640x?`: set a fixed width and compute height automatically. If `aspect()` is also called, it is used to compute video height; otherwise it is computed so that the input aspect ratio is preserved. -* `?x480`: set a fixed height and compute width automatically. If `aspect()` is also called, it is used to compute video width; otherwise it is computed so that the input aspect ratio is preserved. -* `50%`: rescale both width and height to the given percentage. Aspect ratio is always preserved. - -Note that for compatibility with some codecs, computed dimensions are always rounded down to multiples of 2. - -```js -ffmpeg('/path/to/file.avi').size('640x480'); -ffmpeg('/path/to/file.avi').size('640x?'); -ffmpeg('/path/to/file.avi').size('640x?').aspect('4:3'); -ffmpeg('/path/to/file.avi').size('50%'); -``` - -#### aspect(aspect): set output frame aspect ratio - -**Aliases**: `withAspect()`, `withAspectRatio()`, `setAspect()`, `setAspectRatio()`, `aspectRatio()`. - -This method enforces a specific output aspect ratio. The `aspect` argument may either be a number or a `X:Y` string. - -Note that calls to `aspect()` are ignored when `size()` has been called with a fixed width and height or a percentage, and also when `size()` has not been called at all. - -```js -ffmpeg('/path/to/file.avi').size('640x?').aspect('4:3'); -ffmpeg('/path/to/file.avi').size('640x?').aspect(1.33333); -``` - -#### autopad([color='black']): enable auto-padding the output video - -**Aliases**: `applyAutopadding()`, `applyAutoPadding()`, `applyAutopad()`, `applyAutoPad()`, `withAutopadding()`, `withAutoPadding()`, `withAutopad()`, `withAutoPad()`, `autoPad()`. - -This method enables applying auto-padding to the output video. The `color` parameter specifies which color to use for padding, and must be a color code or name supported by ffmpeg (defaults to 'black'). - -The behaviour of this method depends on calls made to other video size methods: -* when `size()` has been called with a percentage or has not been called, it is ignored; -* when `size()` has been called with `WxH`, it adds padding so that the input aspect ratio is kept; -* when `size()` has been called with either `Wx?` or `?xH`, padding is only added if `aspect()` was called (otherwise the output dimensions are computed from the input aspect ratio and padding is not needed). - -```js -// No size specified, autopad() is ignored -ffmpeg('/path/to/file.avi').autopad(); - -// Adds padding to keep original aspect ratio. -// - with a 640x400 input, 40 pixels of padding are added on both sides -// - with a 600x480 input, 20 pixels of padding are added on top and bottom -// - with a 320x200 input, video is scaled up to 640x400 and 40px of padding -// is added on both sides -// - with a 320x240 input, video is scaled up to 640x480 and and no padding -// is needed -ffmpeg('/path/to/file.avi').size('640x480').autopad(); -ffmpeg('/path/to/file.avi').size('640x480').autopad('white'); -ffmpeg('/path/to/file.avi').size('640x480').autopad('#35A5FF'); - -// Size computed from input, autopad() is ignored -ffmpeg('/path/to/file.avi').size('50%').autopad(); -ffmpeg('/path/to/file.avi').size('640x?').autopad(); -ffmpeg('/path/to/file.avi').size('?x480').autopad(); - -// Calling .size('640x?').aspect('4:3') is similar to calling .size('640x480') -// - with a 640x400 input, 40 pixels of padding are added on both sides -// - with a 600x480 input, 20 pixels of padding are added on top and bottom -// - with a 320x200 input, video is scaled up to 640x400 and 40px of padding -// is added on both sides -// - with a 320x240 input, video is scaled up to 640x480 and and no padding -// is needed -ffmpeg('/path/to/file.avi').size('640x?').aspect('4:3').autopad(); -ffmpeg('/path/to/file.avi').size('640x?').aspect('4:3').autopad('white'); -ffmpeg('/path/to/file.avi').size('640x?').aspect('4:3').autopad('#35A5FF'); - -// Calling .size('?x480').aspect('4:3') is similar to calling .size('640x480') -ffmpeg('/path/to/file.avi').size('?x480').aspect('4:3').autopad(); -ffmpeg('/path/to/file.avi').size('?x480').aspect('4:3').autopad('white'); -ffmpeg('/path/to/file.avi').size('?x480').aspect('4:3').autopad('#35A5FF'); -``` - -For compatibility with previous fluent-ffmpeg versions, this method also accepts an additional boolean first argument, which specifies whether to apply auto-padding. - -```js -ffmpeg('/path/to/file.avi').size('640x480').autopad(true); -ffmpeg('/path/to/file.avi').size('640x480').autopad(true, 'pink'); -``` - -#### keepDAR(): force keeping display aspect ratio - -**Aliases**: `keepPixelAspect()`, `keepDisplayAspect()`, `keepDisplayAspectRatio()`. - -This method is useful when converting an input with non-square pixels to an output format that does not support non-square pixels (eg. most image formats). It rescales the input so that the display aspect ratio is the same. - -```js -ffmpeg('/path/to/file.avi').keepDAR(); -``` - -### Specifying multiple outputs - -#### output(target[, options]): add an output to the command - -**Aliases**: `addOutput()`. - -Adds an output to the command. The `target` argument may be an output filename or a writable stream (but at most one output stream may be used with a single command). - -When `target` is a stream, an additional `options` object may be passed. If it is present, it will be passed ffmpeg output stream `pipe()` method. - -Adding an output switches the "current output" of the command, so that any fluent-ffmpeg method that applies to an output is indeed applied to the last output added. For backwards compatibility reasons, you may as well call those methods _before_ adding the first output (in which case they will apply to the first output when it is added). Methods that apply to an output are all non-input-related methods, except for `complexFilter()`, which is global. - -Also note that when calling `output()`, you should not use the `save()` or `stream()` (formerly `saveToFile()` and `writeToStream()`) methods, as they already add an output. Use the `run()` method to start processing. - -```js -var stream = fs.createWriteStream('outputfile.divx'); - -ffmpeg('/path/to/file.avi') - .output('outputfile.mp4') - .output(stream); - -ffmpeg('/path/to/file.avi') - // You may pass a pipe() options object when using a stream - .output(stream, { end:true }); - -// Output-related methods apply to the last output added -ffmpeg('/path/to/file.avi') - - .output('outputfile.mp4') - .audioCodec('libfaac') - .videoCodec('libx264') - .size('320x200') - - .output(stream) - .preset('divx') - .size('640x480'); - -// Use the run() method to run commands with multiple outputs -ffmpeg('/path/to/file.avi') - .output('outputfile.mp4') - .output(stream) - .on('end', function() { - console.log('Finished processing'); - }) - .run(); -``` - - -### Output options - -#### duration(time): set output duration - -**Aliases**: `withDuration()`, `setDuration()`. - -Forces ffmpeg to stop transcoding after a specific output duration. The `time` parameter may be a number (in seconds) or a timestamp string (with format `[[hh:]mm:]ss[.xxx]`). - -```js -ffmpeg('/path/to/file.avi').duration(134.5); -ffmpeg('/path/to/file.avi').duration('2:14.500'); -``` - -#### seek(time): seek output - -**Aliases**: `seekOutput()`. - -Seeks streams before encoding them into the output. This is different from calling `seekInput()` in that the offset will only apply to one output. This is also slower, as skipped frames will still be decoded (but dropped). - -The `time` argument may be a number (in seconds) or a timestamp string (with format `[[hh:]mm:]ss[.xxx]`). - -```js -ffmpeg('/path/to/file.avi') - .seekInput('1:00') - - .output('from-1m30s.avi') - .seek(30) - - .output('from-1m40s.avi') - .seek('0:40'); -``` - -#### format(format): set output format - -**Aliases**: `withOutputFormat()`, `toFormat()`, `outputFormat()`. - -```js -ffmpeg('/path/to/file.avi').format('flv'); -``` - -#### flvmeta(): update FLV metadata after transcoding - -**Aliases**: `updateFlvMetadata()`. - -Calling this method makes fluent-ffmpeg run `flvmeta` or `flvtool2` on the output file to add FLV metadata and make files streamable. It does not work when outputting to a stream, and is only useful when outputting to FLV format. - -```js -ffmpeg('/path/to/file.avi').flvmeta().format('flv'); -``` - -#### outputOptions(option...): add custom output options - -**Aliases**: `outputOption()`, `addOutputOption()`, `addOutputOptions()`, `withOutputOption()`, `withOutputOptions()`, `addOption()`, `addOptions()`. - -This method allows passing any output-related option to ffmpeg. You can call it with a single argument to pass a single option, optionally with a space-separated parameter: - -```js -/* Single option */ -ffmpeg('/path/to/file.avi').outputOptions('-someOption'); - -/* Single option with parameter */ -ffmpeg('/dev/video0').outputOptions('-r 24'); -``` - -You may also pass multiple options at once by passing an array to the method: - -```js -ffmpeg('/path/to/file.avi').outputOptions([ - '-option1', - '-option2 param2', - '-option3', - '-option4 param4' -]); -``` - -Finally, you may also directly pass command line tokens as separate arguments to the method: - -```js -ffmpeg('/path/to/file.avi').outputOptions( - '-option1', - '-option2', 'param2', - '-option3', - '-option4', 'param4' -); -``` - - -### Miscellaneous options - -#### preset(preset): use fluent-ffmpeg preset - -**Aliases**: `usingPreset()`. - -There are two kinds of presets supported by fluent-ffmpeg. The first one is preset modules; to use those, pass the preset name as the `preset` argument. Preset modules are loaded from the directory specified by the `presets` constructor option (defaults to the `lib/presets` fluent-ffmpeg subdirectory). - -```js -// Uses /lib/presets/divx.js -ffmpeg('/path/to/file.avi').preset('divx'); - -// Uses /my/presets/foo.js -ffmpeg('/path/to/file.avi', { presets: '/my/presets' }).preset('foo'); -``` - -Preset modules must export a `load()` function that takes an FfmpegCommand as an argument. fluent-ffmpeg comes with the following preset modules preinstalled: - -* `divx` -* `flashvideo` -* `podcast` - -Here is the code from the included `divx` preset as an example: - -```js -exports.load = function(ffmpeg) { - ffmpeg - .format('avi') - .videoBitrate('1024k') - .videoCodec('mpeg4') - .size('720x?') - .audioBitrate('128k') - .audioChannels(2) - .audioCodec('libmp3lame') - .outputOptions(['-vtag DIVX']); -}; -``` - -The second kind of preset is preset functions. To use those, pass a function which takes an FfmpegCommand as a parameter. - -```js -function myPreset(command) { - command.format('avi').size('720x?'); -} - -ffmpeg('/path/to/file.avi').preset(myPreset); -``` - -#### complexFilter(filters[, map]): set complex filtergraph - -**Aliases**: `filterGraph()` - -The `complexFilter()` method enables setting a complex filtergraph for a command. It expects a filter specification (or a filter specification array) and an optional output mapping parameter as arguments. - -Filter specifications may be either plain ffmpeg filter strings (eg. `split=3[a][b][c]`) or objects with the following keys: -* `filter`: filter name -* `options`: optional; either an option string for the filter (eg. `in:0:30`), an options array for unnamed options (eg. `['in', 0, 30]`) or an object mapping option names to values (eg. `{ t: 'in', s: 0, n: 30 }`). When `options` is not specified, the filter will be added without any options. -* `inputs`: optional; input stream specifier(s) for the filter. The value may be either a single stream specifier string or an array of stream specifiers. Each specifier can be optionally enclosed in square brackets. When input streams are not specified, ffmpeg will use the first unused streams of the correct type. -* `outputs`: optional; output stream specifier(s) for the filter. The value may be either a single stream specifier string or an array of stream specifiers. Each specifier can be optionally enclosed in square brackets. - -The output mapping parameter specifies which stream(s) to include in the output from the filtergraph. It may be either a single stream specifier string or an array of stream specifiers. Each specifier can be optionally enclosed in square brackets. When this parameter is not present, ffmpeg will default to saving all unused outputs to the output file. - -Note that only one complex filtergraph may be set on a given command. Calling `complexFilter()` again will override any previously set filtergraph, but you can set as many filters as needed in a single call. - -```js -ffmpeg('/path/to/file.avi') - .complexFilter([ - // Rescale input stream into stream 'rescaled' - 'scale=640:480[rescaled]', - - // Duplicate rescaled stream 3 times into streams a, b, and c - { - filter: 'split', options: '3', - inputs: 'rescaled', outputs: ['a', 'b', 'c'] - }, - - // Create stream 'red' by removing green and blue channels from stream 'a' - { - filter: 'lutrgb', options: { g: 0, b: 0 }, - inputs: 'a', outputs: 'red' - }, - - // Create stream 'green' by removing red and blue channels from stream 'b' - { - filter: 'lutrgb', options: { r: 0, b: 0 }, - inputs: 'b', outputs: 'green' - }, - - // Create stream 'blue' by removing red and green channels from stream 'c' - { - filter: 'lutrgb', options: { r: 0, g: 0 }, - inputs: 'c', outputs: 'blue' - }, - - // Pad stream 'red' to 3x width, keeping the video on the left, - // and name output 'padded' - { - filter: 'pad', options: { w: 'iw*3', h: 'ih' }, - inputs: 'red', outputs: 'padded' - }, - - // Overlay 'green' onto 'padded', moving it to the center, - // and name output 'redgreen' - { - filter: 'overlay', options: { x: 'w', y: 0 }, - inputs: ['padded', 'green'], outputs: 'redgreen' - }, - - // Overlay 'blue' onto 'redgreen', moving it to the right - { - filter: 'overlay', options: { x: '2*w', y: 0 }, - inputs: ['redgreen', 'blue'], outputs: 'output' - }, - ], 'output'); -``` - - -### Setting event handlers - -Before actually running a command, you may want to set event listeners on it to be notified when it's done. The following events are available: - -#### 'start': ffmpeg process started - -The `start` event is emitted just after ffmpeg has been spawned. It is emitted with the full command line used as an argument. - -```js -ffmpeg('/path/to/file.avi') - .on('start', function(commandLine) { - console.log('Spawned Ffmpeg with command: ' + commandLine); - }); -``` - -#### 'codecData': input codec data available - -The `codecData` event is emitted when ffmpeg outputs codec information about its input streams. It is emitted with an object argument with the following keys: -* `format`: input format -* `duration`: input duration -* `audio`: audio codec -* `audio_details`: audio encoding details -* `video`: video codec -* `video_details`: video encoding details - -```js -ffmpeg('/path/to/file.avi') - .on('codecData', function(data) { - console.log('Input is ' + data.audio + ' audio ' + - 'with ' + data.video + ' video'); - }); -``` - -#### 'progress': transcoding progress information - -The `progress` event is emitted every time ffmpeg reports progress information. It is emitted with an object argument with the following keys: -* `frames`: total processed frame count -* `currentFps`: framerate at which FFmpeg is currently processing -* `currentKbps`: throughput at which FFmpeg is currently processing -* `targetSize`: current size of the target file in kilobytes -* `timemark`: the timestamp of the current frame in seconds -* `percent`: an estimation of the progress percentage - -Note that `percent` can be (very) inaccurate, as the only progress information fluent-ffmpeg gets from ffmpeg is the total number of frames written (and the corresponding duration). To estimate percentage, fluent-ffmpeg has to guess what the total output duration will be, and uses the first input added to the command to do so. In particular: -* percentage is not available when using an input stream -* percentage may be wrong when using multiple inputs with different durations and the first one is not the longest - -```js -ffmpeg('/path/to/file.avi') - .on('progress', function(progress) { - console.log('Processing: ' + progress.percent + '% done'); - }); -``` - -#### 'stderr': FFmpeg output - -The `stderr` event is emitted every time FFmpeg outputs a line to `stderr`. It is emitted with a string containing the line of stderr (minus trailing new line characters). - -```js -ffmpeg('/path/to/file.avi') - .on('stderr', function(stderrLine) { - console.log('Stderr output: ' + stderrLine); - }); -``` - -#### 'error': transcoding error - -The `error` event is emitted when an error occurs when running ffmpeg or when preparing its execution. It is emitted with an error object as an argument. If the error happened during ffmpeg execution, listeners will also receive two additional arguments containing ffmpegs stdout and stderr. - -If streams are used for input or output, any errors emitted from these streams will be passed through to this event, attached to the `error` as `inputStreamError` and `outputStreamError` for input and output streams respectively. - -**Warning**: you should _always_ set a handler for the `error` event, as node's default behaviour when an `error` event without any listeners is emitted is to output the error to the console and _terminate the program_. - -```js -ffmpeg('/path/to/file.avi') - .on('error', function(err, stdout, stderr) { - console.log('Cannot process video: ' + err.message); - }); -``` - -#### 'end': processing finished - -The `end` event is emitted when processing has finished. Listeners receive ffmpeg standard output and standard error as arguments, except when generating thumbnails (see below), in which case they receive an array of the generated filenames. - -```js -ffmpeg('/path/to/file.avi') - .on('end', function(stdout, stderr) { - console.log('Transcoding succeeded !'); - }); -``` - -`stdout` is empty when the command outputs to a stream. Both `stdout` and `stderr` are limited by the `stdoutLines` option (defaults to 100 lines). - - -### Starting FFmpeg processing - -#### save(filename): save the output to a file - -**Aliases**: `saveToFile()` - -Starts ffmpeg processing and saves the output to a file. - -```js -ffmpeg('/path/to/file.avi') - .videoCodec('libx264') - .audioCodec('libmp3lame') - .size('320x240') - .on('error', function(err) { - console.log('An error occurred: ' + err.message); - }) - .on('end', function() { - console.log('Processing finished !'); - }) - .save('/path/to/output.mp4'); -``` - -Note: the `save()` method is actually syntactic sugar for calling both `output()` and `run()`. - -#### pipe([stream], [options]): pipe the output to a writable stream - -**Aliases**: `stream()`, `writeToStream()`. - -Starts processing and pipes ffmpeg output to a writable stream. The `options` argument, if present, is passed to ffmpeg output stream's `pipe()` method (see nodejs documentation). - -```js -var outStream = fs.createWriteStream('/path/to/output.mp4'); - -ffmpeg('/path/to/file.avi') - .videoCodec('libx264') - .audioCodec('libmp3lame') - .size('320x240') - .on('error', function(err) { - console.log('An error occurred: ' + err.message); - }) - .on('end', function() { - console.log('Processing finished !'); - }) - .pipe(outStream, { end: true }); -``` - -When no `stream` argument is present, the `pipe()` method returns a PassThrough stream, which you can pipe to somewhere else (or just listen to events on). - -**Note**: this is only available with node >= 0.10. - -```js -var command = ffmpeg('/path/to/file.avi') - .videoCodec('libx264') - .audioCodec('libmp3lame') - .size('320x240') - .on('error', function(err) { - console.log('An error occurred: ' + err.message); - }) - .on('end', function() { - console.log('Processing finished !'); - }); - -var ffstream = command.pipe(); -ffstream.on('data', function(chunk) { - console.log('ffmpeg just wrote ' + chunk.length + ' bytes'); -}); -``` - -Note: the `stream()` method is actually syntactic sugar for calling both `output()` and `run()`. - -#### run(): start processing - -**Aliases**: `exec()`, `execute()`. - -This method is mainly useful when producing multiple outputs (otherwise the `save()` or `stream()` methods are more straightforward). It starts processing with the specified outputs. - -**Warning**: do not use `run()` when calling other processing methods (eg. `save()`, `pipe()` or `screenshots()`). - -```js -ffmpeg('/path/to/file.avi') - .output('screenshot.png') - .noAudio() - .seek('3:00') - - .output('small.avi') - .audioCodec('copy') - .size('320x200') - - .output('big.avi') - .audioCodec('copy') - .size('640x480') - - .on('error', function(err) { - console.log('An error occurred: ' + err.message); - }) - .on('end', function() { - console.log('Processing finished !'); - }) - .run(); -``` - -#### mergeToFile(filename, tmpdir): concatenate multiple inputs - -Use the `input` and `mergeToFile` methods on a command to concatenate multiple inputs to a single output file. The `mergeToFile` needs a temporary folder as its second argument. - -```js -ffmpeg('/path/to/part1.avi') - .input('/path/to/part2.avi') - .input('/path/to/part2.avi') - .on('error', function(err) { - console.log('An error occurred: ' + err.message); - }) - .on('end', function() { - console.log('Merging finished !'); - }) - .mergeToFile('/path/to/merged.avi', '/path/to/tempDir'); -``` - -#### screenshots(options[, dirname]): generate thumbnails - -**Aliases**: `thumbnail()`, `thumbnails()`, `screenshot()`, `takeScreenshots()`. - -Use the `screenshots` method to extract one or several thumbnails and save them as PNG files. There are a few caveats with this implementation, though: - -* It will not work on input streams. -* Progress information reported by the `progress` event is not accurate. -* It doesn't interract well with filters. In particular, don't use the `size()` method to resize thumbnails, use the `size` option instead. - -The `options` argument is an object with the following keys: - -* `folder`: output folder for generated image files. Defaults to the current folder. -* `filename`: output filename pattern (see below). Defaults to "tn.png". -* `count`: specifies how many thumbnails to generate. When using this option, thumbnails are generated at regular intervals in the video (for example, when requesting 3 thumbnails, at 25%, 50% and 75% of the video length). `count` is ignored when `timemarks` or `timestamps` is specified. -* `timemarks` or `timestamps`: specifies an array of timestamps in the video where thumbnails should be taken. Each timestamp may be a number (in seconds), a percentage string (eg. "50%") or a timestamp string with format "hh:mm:ss.xxx" (where hours, minutes and milliseconds are both optional). -* `size`: specifies a target size for thumbnails (with the same format as the `.size()` method). **Note:** you should not use the `.size()` method when generating thumbnails. - -The `filename` option specifies a filename pattern for generated files. It may contain the following format tokens: - -* '%s': offset in seconds -* '%w': screenshot width -* '%h': screenshot height -* '%r': screenshot resolution (same as '%wx%h') -* '%f': input filename -* '%b': input basename (filename w/o extension) -* '%i': index of screenshot in timemark array (can be zero-padded by using it like `%000i`) - -If multiple timemarks are passed and no variable format token ('%s' or '%i') is specified in the filename pattern, `_%i` will be added automatically. - -When generating thumbnails, an additional `filenames` event is dispatched with an array of generated filenames as an argument. - -```js -ffmpeg('/path/to/video.avi') - .on('filenames', function(filenames) { - console.log('Will generate ' + filenames.join(', ')) - }) - .on('end', function() { - console.log('Screenshots taken'); - }) - .screenshots({ - // Will take screens at 20%, 40%, 60% and 80% of the video - count: 4, - folder: '/path/to/output' - }); - -ffmpeg('/path/to/video.avi') - .screenshots({ - timestamps: [30.5, '50%', '01:10.123'], - filename: 'thumbnail-at-%s-seconds.png', - folder: '/path/to/output', - size: '320x240' - }); -``` - -### Controlling the FFmpeg process - -#### kill([signal='SIGKILL']): kill any running ffmpeg process - -This method sends `signal` (defaults to 'SIGKILL') to the ffmpeg process. It only has sense when processing has started. Sending a signal that terminates the process will result in the `error` event being emitted. - -```js -var command = ffmpeg('/path/to/video.avi') - .videoCodec('libx264') - .audioCodec('libmp3lame') - .on('start', function() { - // Send SIGSTOP to suspend ffmpeg - command.kill('SIGSTOP'); - - doSomething(function() { - // Send SIGCONT to resume ffmpeg - command.kill('SIGCONT'); - }); - }) - .save('/path/to/output.mp4'); - -// Kill ffmpeg after 60 seconds anyway -setTimeout(function() { - command.on('error', function() { - console.log('Ffmpeg has been killed'); - }); - - command.kill(); -}, 60000); -``` - -#### renice([niceness=0]): change ffmpeg process priority - -This method alters the niceness (priority) value of any running ffmpeg process (if any) and any process spawned in the future. The `niceness` parameter may range from -20 (highest priority) to 20 (lowest priority) and defaults to 0 (which is the default process niceness on most *nix systems). - -**Note**: this method is ineffective on Windows platforms. - -```js -// Set startup niceness -var command = ffmpeg('/path/to/file.avi') - .renice(5) - .save('/path/to/output.mp4'); - -// Command takes too long, raise its priority -setTimeout(function() { - command.renice(-5); -}, 60000); -``` - - -### Reading video metadata - -You can read metadata from any valid ffmpeg input file with the modules `ffprobe` method. - -```js -ffmpeg.ffprobe('/path/to/file.avi', function(err, metadata) { - console.dir(metadata); -}); -``` - -You may also call the ffprobe method on an FfmpegCommand to probe one of its input. You may pass a 0-based input number as a first argument to specify which input to read metadata from, otherwise the method will probe the last added input. - -```js -ffmpeg('/path/to/file1.avi') - .input('/path/to/file2.avi') - .ffprobe(function(err, data) { - console.log('file2 metadata:'); - console.dir(data); - }); - -ffmpeg('/path/to/file1.avi') - .input('/path/to/file2.avi') - .ffprobe(0, function(err, data) { - console.log('file1 metadata:'); - console.dir(data); - }); -``` - -**Warning:** ffprobe may be called with an input stream, but in this case *it will consume data from the stream*, and this data will no longer be available for ffmpeg. Using both ffprobe and a transcoding command on the same input stream will most likely fail unless the stream is a live stream. Only do this if you know what you're doing. - -The returned object is the same that is returned by running the following command from your shell (depending on your ffmpeg version you may have to replace `-of` with `-print_format`) : - -```sh -$ ffprobe -of json -show_streams -show_format /path/to/file.avi -``` - -It will contain information about the container (as a `format` key) and an array of streams (as a `stream` key). The format object and each stream object also contains metadata tags, depending on the format: - -```js -{ - "streams": [ - { - "index": 0, - "codec_name": "h264", - "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10", - "profile": "Constrained Baseline", - "codec_type": "video", - "codec_time_base": "1/48", - "codec_tag_string": "avc1", - "codec_tag": "0x31637661", - "width": 320, - "height": 180, - "has_b_frames": 0, - "sample_aspect_ratio": "1:1", - "display_aspect_ratio": "16:9", - "pix_fmt": "yuv420p", - "level": 13, - "r_frame_rate": "24/1", - "avg_frame_rate": "24/1", - "time_base": "1/24", - "start_pts": 0, - "start_time": "0.000000", - "duration_ts": 14315, - "duration": "596.458333", - "bit_rate": "702655", - "nb_frames": "14315", - "disposition": { - "default": 0, - "dub": 0, - "original": 0, - "comment": 0, - "lyrics": 0, - "karaoke": 0, - "forced": 0, - "hearing_impaired": 0, - "visual_impaired": 0, - "clean_effects": 0, - "attached_pic": 0 - }, - "tags": { - "creation_time": "1970-01-01 00:00:00", - "language": "und", - "handler_name": "\fVideoHandler" - } - }, - { - "index": 1, - "codec_name": "aac", - "codec_long_name": "AAC (Advanced Audio Coding)", - "codec_type": "audio", - "codec_time_base": "1/48000", - "codec_tag_string": "mp4a", - "codec_tag": "0x6134706d", - "sample_fmt": "fltp", - "sample_rate": "48000", - "channels": 2, - "bits_per_sample": 0, - "r_frame_rate": "0/0", - "avg_frame_rate": "0/0", - "time_base": "1/48000", - "start_pts": 0, - "start_time": "0.000000", - "duration_ts": 28619776, - "duration": "596.245333", - "bit_rate": "159997", - "nb_frames": "27949", - "disposition": { - "default": 0, - "dub": 0, - "original": 0, - "comment": 0, - "lyrics": 0, - "karaoke": 0, - "forced": 0, - "hearing_impaired": 0, - "visual_impaired": 0, - "clean_effects": 0, - "attached_pic": 0 - }, - "tags": { - "creation_time": "1970-01-01 00:00:00", - "language": "und", - "handler_name": "\fSoundHandler" - } - } - ], - "format": { - "filename": "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4", - "nb_streams": 2, - "format_name": "mov,mp4,m4a,3gp,3g2,mj2", - "format_long_name": "QuickTime / MOV", - "start_time": "0.000000", - "duration": "596.459000", - "size": "64657027", - "bit_rate": "867211", - "tags": { - "major_brand": "isom", - "minor_version": "512", - "compatible_brands": "mp41", - "creation_time": "1970-01-01 00:00:00", - "title": "Big Buck Bunny", - "artist": "Blender Foundation", - "composer": "Blender Foundation", - "date": "2008", - "encoder": "Lavf52.14.0" - } - } -} -``` - -### Querying ffmpeg capabilities - -fluent-ffmpeg enables you to query your installed ffmpeg version for supported formats, codecs, encoders and filters. - -```js - -var Ffmpeg = require('fluent-ffmpeg'); - -Ffmpeg.getAvailableFormats(function(err, formats) { - console.log('Available formats:'); - console.dir(formats); -}); - -Ffmpeg.getAvailableCodecs(function(err, codecs) { - console.log('Available codecs:'); - console.dir(codecs); -}); - -Ffmpeg.getAvailableEncoders(function(err, encoders) { - console.log('Available encoders:'); - console.dir(encoders); -}); - -Ffmpeg.getAvailableFilters(function(err, filters) { - console.log("Available filters:"); - console.dir(filters); -}); - -// Those methods can also be called on commands -new Ffmpeg({ source: '/path/to/file.avi' }) - .getAvailableCodecs(...); -``` - -These methods pass an object to their callback with keys for each available format, codec or filter. - -The returned object for formats looks like: - -```js -{ - ... - mp4: { - description: 'MP4 (MPEG-4 Part 14)', - canDemux: false, - canMux: true - }, - ... -} -``` - -* `canDemux` indicates whether ffmpeg is able to extract streams from (demux) this format -* `canMux` indicates whether ffmpeg is able to write streams into (mux) this format - -The returned object for codecs looks like: - -```js -{ - ... - mp3: { - type: 'audio', - description: 'MP3 (MPEG audio layer 3)', - canDecode: true, - canEncode: true, - intraFrameOnly: false, - isLossy: true, - isLossless: false - }, - ... -} -``` - -* `type` indicates the codec type, either "audio", "video" or "subtitle" -* `canDecode` tells whether ffmpeg is able to decode streams using this codec -* `canEncode` tells whether ffmpeg is able to encode streams using this codec - -Depending on your ffmpeg version (or if you use avconv instead) other keys may be present, for example: - -* `directRendering` tells if codec can render directly in GPU RAM; useless for transcoding purposes -* `intraFrameOnly` tells if codec can only work with I-frames -* `isLossy` tells if codec can do lossy encoding/decoding -* `isLossless` tells if codec can do lossless encoding/decoding - -With some ffmpeg/avcodec versions, the description includes encoder/decoder mentions in the form "Foo codec (decoders: libdecodefoo) (encoders: libencodefoo)". In this case you will want to use those encoders/decoders instead (the codecs object returned by `getAvailableCodecs` will also include them). - -The returned object for encoders looks like: - -```js -{ - ... - libmp3lame: { - type: 'audio', - description: 'MP3 (MPEG audio layer 3) (codec mp3)', - frameMT: false, - sliceMT: false, - experimental: false, - drawHorizBand: false, - directRendering: false - }, - ... -} -``` - -* `type` indicates the encoder type, either "audio", "video" or "subtitle" -* `experimental` indicates whether the encoder is experimental. When using such a codec, fluent-ffmpeg automatically adds the '-strict experimental' flag. - -The returned object for filters looks like: - -```js -{ - ... - scale: { - description: 'Scale the input video to width:height size and/or convert the image format.', - input: 'video', - multipleInputs: false, - output: 'video', - multipleOutputs: false - }, - ... -} -``` - -* `input` tells the input type this filter operates on, one of "audio", "video" or "none". When "none", the filter likely generates output from nothing -* `multipleInputs` tells whether the filter can accept multiple inputs -* `output` tells the output type this filter generates, one of "audio", "video" or "none". When "none", the filter has no output (sink only) -* `multipleInputs` tells whether the filter can generate multiple outputs - -### Cloning an FfmpegCommand - -You can create clones of an FfmpegCommand instance by calling the `clone()` method. The clone will be an exact copy of the original at the time it has been called (same inputs, same options, same event handlers, etc.). This is mainly useful when you want to apply different processing options on the same input. - -Setting options, adding inputs or event handlers on a clone will not affect the original command. - -```js -// Create a command to convert source.avi to MP4 -var command = ffmpeg('/path/to/source.avi') - .audioCodec('libfaac') - .videoCodec('libx264') - .format('mp4'); - -// Create a clone to save a small resized version -command.clone() - .size('320x200') - .save('/path/to/output-small.mp4'); - -// Create a clone to save a medium resized version -command.clone() - .size('640x400') - .save('/path/to/output-medium.mp4'); - -// Save a converted version with the original size -command.save('/path/to/output-original-size.mp4'); -``` - - -## Contributing - -Contributions in any form are highly encouraged and welcome! Be it new or improved presets, optimized streaming code or just some cleanup. So start forking! - -### Code contributions - -If you want to add new features or change the API, please submit an issue first to make sure no one else is already working on the same thing and discuss the implementation and API details with maintainers and users by creating an issue. When everything is settled down, you can submit a pull request. - -When fixing bugs, you can directly submit a pull request. - -Make sure to add tests for your features and bugfixes and update the documentation (see below) before submitting your code! - -### Documentation contributions - -You can directly submit pull requests for documentation changes. Make sure to regenerate the documentation before submitting (see below). - -### Updating the documentation - -When contributing API changes (new methods for example), be sure to update the README file and JSDoc comments in the code. fluent-ffmpeg comes with a plugin that enables two additional JSDoc tags: - -* `@aliases`: document method aliases - -```js -/** - * ... - * @method FfmpegCommand#myMethod - * @aliases myMethodAlias,myOtherMethodAlias - */ -``` - -* `@category`: set method category - -```js -/** - * ... - * @category Audio - */ -``` - -You can regenerate the JSDoc documentation by running the following command: - -```sh -$ make doc -``` - -To avoid polluting the commit history, make sure to only commit the regenerated JSDoc once and in a specific commit. - -### Running tests - -To run unit tests, first make sure you installed npm dependencies (run `npm install`). +## Installation ```sh -$ make test +$ npm install fluent-ffmpeg ``` - -Make sure your ffmpeg installation is up-to-date to prevent strange assertion errors because of missing codecs/bugfixes. - -## Main contributors - -* [enobrev](http://github.com/enobrev) -* [njoyard](http://github.com/njoyard) -* [sadikzzz](http://github.com/sadikzzz) -* [smremde](http://github.com/smremde) -* [spruce](http://github.com/spruce) -* [tagedieb](http://github.com/tagedieb) -* [tommadema](http://github.com/tommadema) -* [Weltschmerz](http://github.com/Weltschmerz) - -## License - -(The MIT License) - -Copyright (c) 2011 Stefan Schaermeli <schaermu@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. - - -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Ffluent-ffmpeg%2Fnode-fluent-ffmpeg.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Ffluent-ffmpeg%2Fnode-fluent-ffmpeg?ref=badge_large) \ No newline at end of file diff --git a/doc/FfmpegCommand.html b/doc/FfmpegCommand.html deleted file mode 100644 index 7a3e4f89..00000000 --- a/doc/FfmpegCommand.html +++ /dev/null @@ -1,17913 +0,0 @@ - - - - - JSDoc: Class: FfmpegCommand - - - - - - - - - - -
- -

Class: FfmpegCommand

- - - - - -
- -
-

- FfmpegCommand -

- -
- -
-
- - - - -
-

new FfmpegCommand(input, options)

- - -
-
- - -
-

Create an ffmpeg command

-

Can be called with or without the 'new' operator, and the 'input' parameter -may be specified as 'options.source' instead (or passed later with the -addInput method).

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
input - - -String -| - -ReadableStream - - - - - - <optional>
- - - - - -

input file path or readable stream

options - - -Object - - - - - - <optional>
- - - - - -

command options

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDefaultDescription
logger - - -Object - - - - - - <optional>
- - - - - -
- - <no logging> - -

logger object with 'error', 'warning', 'info' and 'debug' methods

niceness - - -Number - - - - - - <optional>
- - - - - -
- - 0 - -

ffmpeg process niceness, ignored on Windows

priority - - -Number - - - - - - <optional>
- - - - - -
- - 0 - -

alias for niceness

presets - - -String - - - - - - <optional>
- - - - - -
- - "fluent-ffmpeg/lib/presets" - -

directory to load presets from

preset - - -String - - - - - - <optional>
- - - - - -
- - "fluent-ffmpeg/lib/presets" - -

alias for presets

stdoutLines - - -String - - - - - - <optional>
- - - - - -
- - 100 - -

maximum lines of ffmpeg output to keep in memory, use 0 for unlimited

timeout - - -Number - - - - - - <optional>
- - - - - -
- - <no timeout> - -

ffmpeg processing timeout in seconds

source - - -String -| - -ReadableStream - - - - - - <optional>
- - - - - -
- - <no input> - -

alias for the input parameter

-
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - -

Audio methods

- -
- -
-

audioBitrate(bitrate)

- - -
-
- - -
-

Specify audio bitrate

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
bitrate - - -String -| - -Number - - - -

audio bitrate in kbps (with an optional 'k' suffix)

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Alias:
- - - withAudioBitrate - - -
- - - -
-

audioChannels(channels)

- - -
-
- - -
-

Specify audio channel count

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
channels - - -Number - - - -

channel count

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Alias:
- - - withAudioChannels - - -
- - - -
-

audioCodec(codec)

- - -
-
- - -
-

Specify audio codec

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
codec - - -String - - - -

audio codec name

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Alias:
- - - withAudioCodec - - -
- - - -
-

audioFilter(filters)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

audioFilters(filters)

- - -
-
- - -
-

Specify custom audio filter(s)

-

Can be called both with one or many filters, or a filter array.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
filters - - -String -| - -Array.<String> -| - -Array.<Object> - - - -

audio filter strings, string array or - filter specification array, each with the following properties:

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
filter - - -String - - - - - - - - - -

filter name

options - - -String -| - -Array.<String> -| - -Object - - - - - - <optional>
- - - - - -

filter option string, array, or object

-
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - -
Examples:
- -
command.audioFilters('filter1');
- -
command.audioFilters('filter1', 'filter2=param1=value1:param2=value2');
- -
command.audioFilters(['filter1', 'filter2']);
- -
command.audioFilters([
-  {
-    filter: 'filter1'
-  },
-  {
-    filter: 'filter2',
-    options: 'param=value:param=value'
-  }
-]);
- -
command.audioFilters(
-  {
-    filter: 'filter1',
-    options: ['value1', 'value2']
-  },
-  {
-    filter: 'filter2',
-    options: { param1: 'value1', param2: 'value2' }
-  }
-);
- - - - -
Aliases:
- - -
    - -
  • withAudioFilter
  • - -
  • withAudioFilters
  • - -
  • audioFilter
  • - -
- - -
- - - -
-

audioFrequency(freq)

- - -
-
- - -
-

Specify audio frequency

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
freq - - -Number - - - -

audio frequency in Hz

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Alias:
- - - withAudioFrequency - - -
- - - -
-

audioQuality(quality)

- - -
-
- - -
-

Specify audio quality

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
quality - - -Number - - - -

audio quality factor

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Alias:
- - - withAudioQuality - - -
- - - -
-

noAudio()

- - -
-
- - -
-

Disable audio in the output

-
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Alias:
- - - withNoAudio - - -
- - - -
-

withAudioBitrate(bitrate)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withAudioChannels(channels)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withAudioCodec(codec)

- - -
-
- - -
- Alias for FfmpegCommand#audioCodec -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withAudioFilter(filters)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withAudioFilters(filters)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withAudioFrequency(freq)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withAudioQuality(quality)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withNoAudio()

- - -
-
- - -
- Alias for FfmpegCommand#noAudio -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- -
- -

Capabilities methods

- -
- -
-

availableCodecs(callback)

- - -
-
- - -
-

Query ffmpeg for available codecs

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -FfmpegCommand~codecCallback - - - -

callback function

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
Alias:
- - - getAvailableCodecs - - -
- - - -
-

availableEncoders(callback)

- - -
-
- - -
-

Query ffmpeg for available encoders

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -FfmpegCommand~encodersCallback - - - -

callback function

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
Alias:
- - - getAvailableEncoders - - -
- - - -
-

availableFilters(callback)

- - -
-
- - -
-

Query ffmpeg for available filters

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -FfmpegCommand~filterCallback - - - -

callback function

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
Alias:
- - - getAvailableFilters - - -
- - - -
-

availableFormats(callback)

- - -
-
- - -
-

Query ffmpeg for available formats

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -FfmpegCommand~formatCallback - - - -

callback function

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
Alias:
- - - getAvailableFormats - - -
- - - -
-

getAvailableCodecs(callback)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

getAvailableEncoders(callback)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

getAvailableFilters(callback)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

getAvailableFormats(callback)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- -
- -

Custom options methods

- -
- -
-

addInputOption(options)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

addInputOptions(options)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

addOption(options)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

addOptions(options)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

addOutputOption(options)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

addOutputOptions(options)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

complexFilter(spec, map)

- - -
-
- - -
-

Specify a complex filtergraph

-

Calling this method will override any previously set filtergraph, but you can set -as many filters as needed in one call.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
spec - - -String -| - -Array - - - - - - - - - -

filtergraph string or array of filter specification - objects, each having the following properties:

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
filter - - -String - - - - - - - - - -

filter name

inputs - - -String -| - -Array - - - - - - <optional>
- - - - - -

(array of) input stream specifier(s) for the filter, - defaults to ffmpeg automatically choosing the first unused matching streams

outputs - - -String -| - -Array - - - - - - <optional>
- - - - - -

(array of) output stream specifier(s) for the filter, - defaults to ffmpeg automatically assigning the output to the output file

options - - -Object -| - -String -| - -Array - - - - - - <optional>
- - - - - -

filter options, can be omitted to not set any options

-
map - - -Array - - - - - - <optional>
- - - - - -

(array of) stream specifier(s) from the graph to include in - ffmpeg output, defaults to ffmpeg automatically choosing the first matching streams.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - -
Examples:
- -

Overlay an image over a video (using a filtergraph string)

- -
  ffmpeg()
-    .input('video.avi')
-    .input('image.png')
-    .complexFilter('[0:v][1:v]overlay[out]', ['out']);
- -

Overlay an image over a video (using a filter array)

- -
  ffmpeg()
-    .input('video.avi')
-    .input('image.png')
-    .complexFilter([{
-      filter: 'overlay',
-      inputs: ['0:v', '1:v'],
-      outputs: ['out']
-    }], ['out']);
- -

Split video into RGB channels and output a 3x1 video with channels side to side

- -
 ffmpeg()
-   .input('video.avi')
-   .complexFilter([
-     // Duplicate video stream 3 times into streams a, b, and c
-     { filter: 'split', options: '3', outputs: ['a', 'b', 'c'] },
-
-     // Create stream 'red' by cancelling green and blue channels from stream 'a'
-     { filter: 'lutrgb', options: { g: 0, b: 0 }, inputs: 'a', outputs: 'red' },
-
-     // Create stream 'green' by cancelling red and blue channels from stream 'b'
-     { filter: 'lutrgb', options: { r: 0, b: 0 }, inputs: 'b', outputs: 'green' },
-
-     // Create stream 'blue' by cancelling red and green channels from stream 'c'
-     { filter: 'lutrgb', options: { r: 0, g: 0 }, inputs: 'c', outputs: 'blue' },
-
-     // Pad stream 'red' to 3x width, keeping the video on the left, and name output 'padded'
-     { filter: 'pad', options: { w: 'iw*3', h: 'ih' }, inputs: 'red', outputs: 'padded' },
-
-     // Overlay 'green' onto 'padded', moving it to the center, and name output 'redgreen'
-     { filter: 'overlay', options: { x: 'w', y: 0 }, inputs: ['padded', 'green'], outputs: 'redgreen'},
-
-     // Overlay 'blue' onto 'redgreen', moving it to the right
-     { filter: 'overlay', options: { x: '2*w', y: 0 }, inputs: ['redgreen', 'blue']},
-   ]);
- - - - -
Alias:
- - - filterGraph - - -
- - - -
-

filterGraph(spec, map)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

inputOption(options)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

inputOptions(options)

- - -
-
- - -
-

Add custom input option(s)

-

When passing a single string or an array, each string containing two -words is split (eg. inputOptions('-option value') is supported) for -compatibility reasons. This is not the case when passing more than -one argument.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
options - - -String - - - - - - - - - - <repeatable>
- -

option string(s) or string array

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - -
Examples:
- -
command.inputOptions('option1');
- -
command.inputOptions('option1', 'option2');
- -
command.inputOptions(['option1', 'option2']);
- - - - -
Aliases:
- - -
    - -
  • addInputOption
  • - -
  • addInputOptions
  • - -
  • withInputOption
  • - -
  • withInputOptions
  • - -
  • inputOption
  • - -
- - -
- - - -
-

outputOption(options)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

outputOptions(options)

- - -
-
- - -
-

Add custom output option(s)

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
options - - -String - - - - - - - - - - <repeatable>
- -

option string(s) or string array

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - -
Examples:
- -
command.outputOptions('option1');
- -
command.outputOptions('option1', 'option2');
- -
command.outputOptions(['option1', 'option2']);
- - - - -
Aliases:
- - -
    - -
  • addOutputOption
  • - -
  • addOutputOptions
  • - -
  • addOption
  • - -
  • addOptions
  • - -
  • withOutputOption
  • - -
  • withOutputOptions
  • - -
  • withOption
  • - -
  • withOptions
  • - -
  • outputOption
  • - -
- - -
- - - -
-

withInputOption(options)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withInputOptions(options)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withOption(options)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withOptions(options)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withOutputOption(options)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withOutputOptions(options)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- -
- -

Input methods

- -
- -
-

addInput(source)

- - -
-
- - -
- Alias for FfmpegCommand#input -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

fpsInput(fps)

- - -
-
- - -
- Alias for FfmpegCommand#inputFps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

fromFormat(format)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

input(source)

- - -
-
- - -
-

Add an input to command

-

Also switches "current input", that is the input that will be affected -by subsequent input-related methods.

-

Note: only one stream input is supported for now.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
source - - -String -| - -Readable - - - -

input file path or readable stream

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Aliases:
- - -
    - -
  • mergeAdd
  • - -
  • addInput
  • - -
- - -
- - - -
-

inputFormat(format)

- - -
-
- - -
-

Specify input format for the last specified input

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
format - - -String - - - -

input format

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Aliases:
- - -
    - -
  • withInputFormat
  • - -
  • fromFormat
  • - -
- - -
- - - -
-

inputFps(fps)

- - -
-
- - -
-

Specify input FPS for the last specified input -(only valid for raw video formats)

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fps - - -Number - - - -

input FPS

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Aliases:
- - -
    - -
  • withInputFps
  • - -
  • withInputFPS
  • - -
  • withFpsInput
  • - -
  • withFPSInput
  • - -
  • inputFPS
  • - -
  • inputFps
  • - -
  • fpsInput
  • - -
- - -
- - - -
-

inputFPS(fps)

- - -
-
- - -
- Alias for FfmpegCommand#inputFps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

inputFps(fps)

- - -
-
- - -
- Alias for FfmpegCommand#inputFps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

loop(duration)

- - -
-
- - -
-

Loop over the last specified input

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
duration - - -String -| - -Number - - - - - - <optional>
- - - - - -

loop duration in seconds or as a '[[hh:]mm:]ss[.xxx]' string

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
- - - -
-

mergeAdd(source)

- - -
-
- - -
- Alias for FfmpegCommand#input -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

native()

- - -
-
- - -
-

Use native framerate for the last specified input

-
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmmegCommand

-
- - - - - - - - -
Aliases:
- - -
    - -
  • nativeFramerate
  • - -
  • withNativeFramerate
  • - -
- - -
- - - -
-

nativeFramerate()

- - -
-
- - -
- Alias for FfmpegCommand#native -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

seek(seek)

- - -
-
- - -
-

Specify output seek time

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
seek - - -String -| - -Number - - - -

seek time in seconds or as a '[hh:[mm:]]ss[.xxx]' string

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Alias:
- - - seekOutput - - -
- - - -
-

seekInput(seek)

- - -
-
- - -
-

Specify input seek time for the last specified input

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
seek - - -String -| - -Number - - - -

seek time in seconds or as a '[hh:[mm:]]ss[.xxx]' string

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Aliases:
- - -
    - -
  • setStartTime
  • - -
  • seekTo
  • - -
- - -
- - - -
-

seekOutput(seek)

- - -
-
- - -
- Alias for FfmpegCommand#seek -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

seekTo(seek)

- - -
-
- - -
- Alias for FfmpegCommand#seekInput -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

setStartTime(seek)

- - -
-
- - -
- Alias for FfmpegCommand#seekInput -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withFpsInput(fps)

- - -
-
- - -
- Alias for FfmpegCommand#inputFps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withFPSInput(fps)

- - -
-
- - -
- Alias for FfmpegCommand#inputFps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withInputFormat(format)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withInputFPS(fps)

- - -
-
- - -
- Alias for FfmpegCommand#inputFps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withInputFps(fps)

- - -
-
- - -
- Alias for FfmpegCommand#inputFps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withNativeFramerate()

- - -
-
- - -
- Alias for FfmpegCommand#native -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- -
- -

Metadata methods

- -
- -
-

ffprobe(index, options, callback)

- - -
-
- - -
-

Run ffprobe on last specified input

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
index - - -Number - - - - - - <optional>
- - - - <nullable>
- - - -

0-based index of input to probe (defaults to last input)

options - - -Array.<String> - - - - - - <optional>
- - - - <nullable>
- - - -

array of output options to return

callback - - -FfmpegCommand~ffprobeCallback - - - - - - - - - -

callback function

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
- -
- -

Miscellaneous methods

- -
- -
-

preset(preset)

- - -
-
- - -
-

Use preset

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
preset - - -String -| - -function - - - -

preset name or preset function

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
Alias:
- - - usingPreset - - -
- - - -
-

usingPreset(preset)

- - -
-
- - -
- Alias for FfmpegCommand#preset -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- -
- -

Other methods

- -
- -
-

clone()

- - -
-
- - -
-

Clone an ffmpeg command

-

This method is useful when you want to process the same input multiple times. -It returns a new FfmpegCommand instance with the exact same options.

-

All options set after the clone() call will only be applied to the instance -it has been called on.

-
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - -
Example:
- -
var command = ffmpeg('/path/to/source.avi')
-    .audioCodec('libfaac')
-    .videoCodec('libx264')
-    .format('mp4');
-
-  command.clone()
-    .size('320x200')
-    .save('/path/to/output-small.mp4');
-
-  command.clone()
-    .size('640x400')
-    .save('/path/to/output-medium.mp4');
-
-  command.save('/path/to/output-original-size.mp4');
- - - - -
- - - -
-

setFfmpegPath(ffmpegPath)

- - -
-
- - -
-

Manually define the ffmpeg binary full path.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
ffmpegPath - - -String - - - -

The full path to the ffmpeg binary.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
- - - -
-

setFfprobePath(ffprobePath)

- - -
-
- - -
-

Manually define the ffprobe binary full path.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
ffprobePath - - -String - - - -

The full path to the ffprobe binary.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
- - - -
-

setFlvtoolPath(flvtool)

- - -
-
- - -
-

Manually define the flvtool2/flvmeta binary full path.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
flvtool - - -String - - - -

The full path to the flvtool2 or flvmeta binary.

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
- -
- -

Output methods

- -
- -
-

addOutput(target, pipeopts)

- - -
-
- - -
- Alias for FfmpegCommand#output -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

duration(duration)

- - -
-
- - -
-

Set output duration

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
duration - - -String -| - -Number - - - -

duration in seconds or as a '[[hh:]mm:]ss[.xxx]' string

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Aliases:
- - -
    - -
  • withDuration
  • - -
  • setDuration
  • - -
- - -
- - - -
-

flvmeta()

- - -
-
- - -
-

Run flvtool2/flvmeta on output

-
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Alias:
- - - updateFlvMetadata - - -
- - - -
-

format(format)

- - -
-
- - -
-

Set output format

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
format - - -String - - - -

output format name

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Aliases:
- - -
    - -
  • toFormat
  • - -
  • withOutputFormat
  • - -
  • outputFormat
  • - -
- - -
- - - -
-

map(spec)

- - -
-
- - -
-

Add stream mapping to output

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
spec - - -String - - - -

stream specification string, with optional square brackets

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
- - - -
-

output(target, pipeopts)

- - -
-
- - -
-

Add output

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDefaultDescription
target - - -String -| - -Writable - - - - - - - - - - - -

target file path or writable stream

pipeopts - - -Object - - - - - - <optional>
- - - - - -
- - {} - -

pipe options (only applies to streams)

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Alias:
- - - addOutput - - -
- - - -
-

outputFormat(format)

- - -
-
- - -
- Alias for FfmpegCommand#format -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

setDuration(duration)

- - -
-
- - -
- Alias for FfmpegCommand#duration -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

toFormat(format)

- - -
-
- - -
- Alias for FfmpegCommand#format -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

updateFlvMetadata()

- - -
-
- - -
- Alias for FfmpegCommand#flvmeta -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withDuration(duration)

- - -
-
- - -
- Alias for FfmpegCommand#duration -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withOutputFormat(format)

- - -
-
- - -
- Alias for FfmpegCommand#format -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- -
- -

Processing methods

- -
- -
-

concat(target, options)

- - -
-
- - -
-

Merge (concatenate) inputs to a single file

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
target - - -String -| - -Writable - - - - - - - - - -

output file or writable stream

options - - -Object - - - - - - <optional>
- - - - - -

pipe options (only used when outputting to a writable stream)

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Aliases:
- - -
    - -
  • concatenate
  • - -
  • mergeToFile
  • - -
- - -
- - - -
-

concatenate(target, options)

- - -
-
- - -
- Alias for FfmpegCommand#concat -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

exec()

- - -
-
- - -
- Alias for FfmpegCommand#run -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

execute()

- - -
-
- - -
- Alias for FfmpegCommand#run -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

kill(signal)

- - -
-
- - -
-

Kill current ffmpeg process, if any

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDefaultDescription
signal - - -String - - - - - - <optional>
- - - - - -
- - SIGKILL - -

signal name

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
- - - -
-

mergeToFile(target, options)

- - -
-
- - -
- Alias for FfmpegCommand#concat -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

pipe(stream, options)

- - -
-
- - -
-

Execute ffmpeg command and save output to a stream

-

If 'stream' is not specified, a PassThrough stream is created and returned. -'options' will be used when piping ffmpeg output to the output stream -(@see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options)

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDefaultDescription
stream - - -stream.Writable - - - - - - <optional>
- - - - - -
- -

output stream

options - - -Object - - - - - - <optional>
- - - - - -
- - {} - -

pipe options

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Output stream

-
- - - - - - - - -
Aliases:
- - -
    - -
  • stream
  • - -
  • writeToStream
  • - -
- - -
- - - -
-

renice(niceness)

- - -
-
- - -
-

Renice current and/or future ffmpeg processes

-

Ignored on Windows platforms.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDefaultDescription
niceness - - -Number - - - - - - <optional>
- - - - - -
- - 0 - -

niceness value between -20 (highest priority) and 20 (lowest priority)

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
- - - -
-

run()

- - -
-
- - -
-

Run ffmpeg command

-
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
Aliases:
- - -
    - -
  • exec
  • - -
  • execute
  • - -
- - -
- - - -
-

save(output)

- - -
-
- - -
-

Execute ffmpeg command and save output to a file

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
output - - -String - - - -

file path

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Alias:
- - - saveToFile - - -
- - - -
-

saveToFile(output)

- - -
-
- - -
- Alias for FfmpegCommand#save -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

screenshot(config, folder)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

screenshots(config, folder)

- - -
-
- - -
-

Generate images from a video

-

Note: this method makes the command emit a 'filenames' event with an array of -the generated image filenames.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDefaultDescription
config - - -Number -| - -Object - - - - - - <optional>
- - - - - -
- - 1 - -

screenshot count or configuration object with - the following keys:

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDefaultDescription
count - - -Number - - - - - - <optional>
- - - - - -
- -

number of screenshots to take; using this option - takes screenshots at regular intervals (eg. count=4 would take screens at 20%, 40%, - 60% and 80% of the video length).

folder - - -String - - - - - - <optional>
- - - - - -
- - '.' - -

output folder

filename - - -String - - - - - - <optional>
- - - - - -
- - 'tn.png' - -

output filename pattern, may contain the following - tokens:

-
    -
  • '%s': offset in seconds
  • -
  • '%w': screenshot width
  • -
  • '%h': screenshot height
  • -
  • '%r': screenshot resolution (same as '%wx%h')
  • -
  • '%f': input filename
  • -
  • '%b': input basename (filename w/o extension)
  • -
  • '%i': index of screenshot in timemark array (can be zero-padded by using it like %000i)
  • -
timemarks - - -Array.<Number> -| - -Array.<String> - - - - - - <optional>
- - - - - -
- -

array of timemarks to take screenshots - at; each timemark may be a number of seconds, a '[[hh:]mm:]ss[.xxx]' string or a - 'XX%' string. Overrides 'count' if present.

timestamps - - -Array.<Number> -| - -Array.<String> - - - - - - <optional>
- - - - - -
- -

alias for 'timemarks'

fastSeek - - -Boolean - - - - - - <optional>
- - - - - -
- -

use fast seek (less accurate)

size - - -String - - - - - - <optional>
- - - - - -
- -

screenshot size, with the same syntax as FfmpegCommand#size

-
folder - - -String - - - - - - <optional>
- - - - - -
- -

output folder (legacy alias for 'config.folder')

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Aliases:
- - -
    - -
  • takeScreenshots
  • - -
  • thumbnail
  • - -
  • thumbnails
  • - -
  • screenshot
  • - -
- - -
- - - -
-

stream(stream, options)

- - -
-
- - -
- Alias for FfmpegCommand#pipe -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

takeScreenshots(config, folder)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

thumbnail(config, folder)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

thumbnails(config, folder)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

writeToStream(stream, options)

- - -
-
- - -
- Alias for FfmpegCommand#pipe -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- -
- -

Video methods

- -
- -
-

fps(fps)

- - -
-
- - -
-

Specify output FPS

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fps - - -Number - - - -

output FPS

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Aliases:
- - -
    - -
  • withOutputFps
  • - -
  • withOutputFPS
  • - -
  • withFpsOutput
  • - -
  • withFPSOutput
  • - -
  • withFps
  • - -
  • withFPS
  • - -
  • outputFPS
  • - -
  • outputFps
  • - -
  • fpsOutput
  • - -
  • FPSOutput
  • - -
  • FPS
  • - -
- - -
- - - -
-

FPS(fps)

- - -
-
- - -
- Alias for FfmpegCommand#fps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

fpsOutput(fps)

- - -
-
- - -
- Alias for FfmpegCommand#fps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

FPSOutput(fps)

- - -
-
- - -
- Alias for FfmpegCommand#fps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

frames(frames)

- - -
-
- - -
-

Only transcode a certain number of frames

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
frames - - -Number - - - -

frame count

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Aliases:
- - -
    - -
  • takeFrames
  • - -
  • withFrames
  • - -
- - -
- - - -
-

noVideo()

- - -
-
- - -
-

Disable video in the output

-
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Alias:
- - - withNoVideo - - -
- - - -
-

outputFps(fps)

- - -
-
- - -
- Alias for FfmpegCommand#fps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

outputFPS(fps)

- - -
-
- - -
- Alias for FfmpegCommand#fps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

takeFrames(frames)

- - -
-
- - -
- Alias for FfmpegCommand#frames -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

videoBitrate(bitrate, constant)

- - -
-
- - -
-

Specify video bitrate

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDefaultDescription
bitrate - - -String -| - -Number - - - - - - - - - - - -

video bitrate in kbps (with an optional 'k' suffix)

constant - - -Boolean - - - - - - <optional>
- - - - - -
- - false - -

enforce constant bitrate

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Alias:
- - - withVideoBitrate - - -
- - - -
-

videoCodec(codec)

- - -
-
- - -
-

Specify video codec

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
codec - - -String - - - -

video codec name

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Alias:
- - - withVideoCodec - - -
- - - -
-

videoFilter(filters)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

videoFilters(filters)

- - -
-
- - -
-

Specify custom video filter(s)

-

Can be called both with one or many filters, or a filter array.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
filters - - -String -| - -Array.<String> -| - -Array.<Object> - - - -

video filter strings, string array or - filter specification array, each with the following properties:

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
filter - - -String - - - - - - - - - -

filter name

options - - -String -| - -Array.<String> -| - -Object - - - - - - <optional>
- - - - - -

filter option string, array, or object

-
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - -
Examples:
- -
command.videoFilters('filter1');
- -
command.videoFilters('filter1', 'filter2=param1=value1:param2=value2');
- -
command.videoFilters(['filter1', 'filter2']);
- -
command.videoFilters([
-  {
-    filter: 'filter1'
-  },
-  {
-    filter: 'filter2',
-    options: 'param=value:param=value'
-  }
-]);
- -
command.videoFilters(
-  {
-    filter: 'filter1',
-    options: ['value1', 'value2']
-  },
-  {
-    filter: 'filter2',
-    options: { param1: 'value1', param2: 'value2' }
-  }
-);
- - - - -
Aliases:
- - -
    - -
  • withVideoFilter
  • - -
  • withVideoFilters
  • - -
  • videoFilter
  • - -
- - -
- - - -
-

withFPS(fps)

- - -
-
- - -
- Alias for FfmpegCommand#fps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withFps(fps)

- - -
-
- - -
- Alias for FfmpegCommand#fps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withFPSOutput(fps)

- - -
-
- - -
- Alias for FfmpegCommand#fps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withFpsOutput(fps)

- - -
-
- - -
- Alias for FfmpegCommand#fps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withFrames(frames)

- - -
-
- - -
- Alias for FfmpegCommand#frames -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withNoVideo()

- - -
-
- - -
- Alias for FfmpegCommand#noVideo -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withOutputFps(fps)

- - -
-
- - -
- Alias for FfmpegCommand#fps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withOutputFPS(fps)

- - -
-
- - -
- Alias for FfmpegCommand#fps -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withVideoBitrate(bitrate, constant)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withVideoCodec(codec)

- - -
-
- - -
- Alias for FfmpegCommand#videoCodec -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withVideoFilter(filters)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withVideoFilters(filters)

- - -
-
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- -
- -

Video size methods

- -
- -
-

applyAutoPad(pad, color)

- - -
-
- - -
- Alias for FfmpegCommand#autopad -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

applyAutopad(pad, color)

- - -
-
- - -
- Alias for FfmpegCommand#autopad -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

applyAutoPadding(pad, color)

- - -
-
- - -
- Alias for FfmpegCommand#autopad -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

applyAutopadding(pad, color)

- - -
-
- - -
- Alias for FfmpegCommand#autopad -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

aspect(aspect)

- - -
-
- - -
-

Set output aspect ratio

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
aspect - - -String -| - -Number - - - -

aspect ratio (number or 'X:Y' string)

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Aliases:
- - -
    - -
  • withAspect
  • - -
  • withAspectRatio
  • - -
  • setAspect
  • - -
  • setAspectRatio
  • - -
  • aspectRatio
  • - -
- - -
- - - -
-

aspectRatio(aspect)

- - -
-
- - -
- Alias for FfmpegCommand#aspect -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

autopad(pad, color)

- - -
-
- - -
-

Enable auto-padding the output

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDefaultDescription
pad - - -Boolean - - - - - - <optional>
- - - - - -
- - true - -

enable/disable auto-padding

color - - -String - - - - - - <optional>
- - - - - -
- - 'black' - -

pad color

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
Aliases:
- - -
    - -
  • applyAutopadding
  • - -
  • applyAutoPadding
  • - -
  • applyAutopad
  • - -
  • applyAutoPad
  • - -
  • withAutopadding
  • - -
  • withAutoPadding
  • - -
  • withAutopad
  • - -
  • withAutoPad
  • - -
  • autoPad
  • - -
- - -
- - - -
-

autoPad(pad, color)

- - -
-
- - -
- Alias for FfmpegCommand#autopad -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

keepDAR()

- - -
-
- - -
-

Keep display aspect ratio

-

This method is useful when converting an input with non-square pixels to an output format -that does not support non-square pixels. It rescales the input so that the display aspect -ratio is the same.

-
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Aliases:
- - -
    - -
  • keepPixelAspect
  • - -
  • keepDisplayAspect
  • - -
  • keepDisplayAspectRatio
  • - -
- - -
- - - -
-

keepDisplayAspect()

- - -
-
- - -
- Alias for FfmpegCommand#keepDAR -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

keepDisplayAspectRatio()

- - -
-
- - -
- Alias for FfmpegCommand#keepDAR -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

keepPixelAspect()

- - -
-
- - -
- Alias for FfmpegCommand#keepDAR -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

setAspect(aspect)

- - -
-
- - -
- Alias for FfmpegCommand#aspect -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

setAspectRatio(aspect)

- - -
-
- - -
- Alias for FfmpegCommand#aspect -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

setSize(size)

- - -
-
- - -
- Alias for FfmpegCommand#size -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

size(size)

- - -
-
- - -
-

Set output size

-

The 'size' parameter can have one of 4 forms:

-
    -
  • 'X%': rescale to xx % of the original size
  • -
  • 'WxH': specify width and height
  • -
  • 'Wx?': specify width and compute height from input aspect ratio
  • -
  • '?xH': specify height and compute width from input aspect ratio
  • -
-

Note: both dimensions will be truncated to multiples of 2.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
size - - -String - - - -

size string, eg. '33%', '320x240', '320x?', '?x240'

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

FfmpegCommand

-
- - - - - - - - -
Aliases:
- - -
    - -
  • withSize
  • - -
  • setSize
  • - -
- - -
- - - -
-

withAspect(aspect)

- - -
-
- - -
- Alias for FfmpegCommand#aspect -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withAspectRatio(aspect)

- - -
-
- - -
- Alias for FfmpegCommand#aspect -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withAutoPad(pad, color)

- - -
-
- - -
- Alias for FfmpegCommand#autopad -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withAutopad(pad, color)

- - -
-
- - -
- Alias for FfmpegCommand#autopad -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withAutopadding(pad, color)

- - -
-
- - -
- Alias for FfmpegCommand#autopad -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withAutoPadding(pad, color)

- - -
-
- - -
- Alias for FfmpegCommand#autopad -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

withSize(size)

- - -
-
- - -
- Alias for FfmpegCommand#size -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- -
- - - -

Type Definitions

- -
- -
-

codecCallback(err, codecs)

- - -
-
- - -
-

A callback passed to FfmpegCommand#availableCodecs.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - -

error object or null if no error happened

codecs - - -Object - - - -

codec object with codec names as keys and the following - properties for each codec (more properties may be available depending on the - ffmpeg version used):

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
description - - -String - - - -

codec description

canDecode - - -Boolean - - - -

whether the codec is able to decode streams

canEncode - - -Boolean - - - -

whether the codec is able to encode streams

-
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

encodersCallback(err, encoders)

- - -
-
- - -
-

A callback passed to FfmpegCommand#availableEncoders.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - -

error object or null if no error happened

encoders - - -Object - - - -

encoders object with encoder names as keys and the following - properties for each encoder:

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
description - - -String - - - -

codec description

type - - -Boolean - - - -

"audio", "video" or "subtitle"

frameMT - - -Boolean - - - -

whether the encoder is able to do frame-level multithreading

sliceMT - - -Boolean - - - -

whether the encoder is able to do slice-level multithreading

experimental - - -Boolean - - - -

whether the encoder is experimental

drawHorizBand - - -Boolean - - - -

whether the encoder supports draw_horiz_band

directRendering - - -Boolean - - - -

whether the encoder supports direct encoding method 1

-
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

ffprobeCallback(err, ffprobeData)

- - -
-
- - -
-

A callback passed to the FfmpegCommand#ffprobe method.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - -

error object or null if no error happened

ffprobeData - - -Object - - - -

ffprobe output data; this object - has the same format as what the following command returns:

-
`ffprobe -print_format json -show_streams -show_format INPUTFILE`
-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
streams - - -Array - - - -

stream information

format - - -Object - - - -

format information

-
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

filterCallback(err, filters)

- - -
-
- - -
-

A callback passed to FfmpegCommand#availableFilters.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - -

error object or null if no error happened

filters - - -Object - - - -

filter object with filter names as keys and the following - properties for each filter:

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
description - - -String - - - -

filter description

input - - -String - - - -

input type, one of 'audio', 'video' and 'none'

multipleInputs - - -Boolean - - - -

whether the filter supports multiple inputs

output - - -String - - - -

output type, one of 'audio', 'video' and 'none'

multipleOutputs - - -Boolean - - - -

whether the filter supports multiple outputs

-
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

formatCallback(err, formats)

- - -
-
- - -
-

A callback passed to FfmpegCommand#availableFormats.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - -

error object or null if no error happened

formats - - -Object - - - -

format object with format names as keys and the following - properties for each format:

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
description - - -String - - - -

format description

canDemux - - -Boolean - - - -

whether the format is able to demux streams from an input file

canMux - - -Boolean - - - -

whether the format is able to mux streams into an output file

-
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
- -
- - - -

Events

- -
- -
-

codecData

- - -
-
- - -
-

Emitted when ffmpeg reports input codec data

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
codecData - - -Object - - - -

codec data object

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
format - - -String - - - -

input format name

audio - - -String - - - -

input audio codec name

audio_details - - -String - - - -

input audio codec parameters

video - - -String - - - -

input video codec name

video_details - - -String - - - -

input video codec parameters

-
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

end

- - -
-
- - -
-

Emitted when a command finishes processing

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
filenames|stdout - - -Array -| - -String -| - -null - - - - - - <optional>
- - - - - -

generated filenames when taking screenshots, ffmpeg stdout when not outputting to a stream, null otherwise

stderr - - -String -| - -null - - - - - - - - - -

ffmpeg stderr

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

error

- - -
-
- - -
-

Emitted when an error happens when preparing or running a command

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
error - - -Error - - - -

error object

stdout - - -String -| - -null - - - -

ffmpeg stdout, unless outputting to a stream

stderr - - -String -| - -null - - - -

ffmpeg stderr

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

progress

- - -
-
- - -
-

Emitted when ffmpeg reports progress information

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
progress - - -Object - - - -

progress object

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
frames - - -Number - - - - - - - - - -

number of frames transcoded

currentFps - - -Number - - - - - - - - - -

current processing speed in frames per second

currentKbps - - -Number - - - - - - - - - -

current output generation speed in kilobytes per second

targetSize - - -Number - - - - - - - - - -

current output file size

timemark - - -String - - - - - - - - - -

current video timemark

percent - - -Number - - - - - - <optional>
- - - - - -

processing progress (may not be available depending on input)

-
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

start

- - -
-
- - -
-

Emitted just after ffmpeg has been spawned.

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
command - - -String - - - -

ffmpeg command line

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

stderr

- - -
-
- - -
-

Emitted when ffmpeg outputs to stderr

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
line - - -String - - - -

stderr output line

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
- -
- -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/doc/audio.js.html b/doc/audio.js.html deleted file mode 100644 index 38646b38..00000000 --- a/doc/audio.js.html +++ /dev/null @@ -1,228 +0,0 @@ - - - - - JSDoc: Source: options/audio.js - - - - - - - - - - -
- -

Source: options/audio.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-var utils = require('../utils');
-
-
-/*
- *! Audio-related methods
- */
-
-module.exports = function(proto) {
-  /**
-   * Disable audio in the output
-   *
-   * @method FfmpegCommand#noAudio
-   * @category Audio
-   * @aliases withNoAudio
-   * @return FfmpegCommand
-   */
-  proto.withNoAudio =
-  proto.noAudio = function() {
-    this._currentOutput.audio.clear();
-    this._currentOutput.audioFilters.clear();
-    this._currentOutput.audio('-an');
-
-    return this;
-  };
-
-
-  /**
-   * Specify audio codec
-   *
-   * @method FfmpegCommand#audioCodec
-   * @category Audio
-   * @aliases withAudioCodec
-   *
-   * @param {String} codec audio codec name
-   * @return FfmpegCommand
-   */
-  proto.withAudioCodec =
-  proto.audioCodec = function(codec) {
-    this._currentOutput.audio('-acodec', codec);
-
-    return this;
-  };
-
-
-  /**
-   * Specify audio bitrate
-   *
-   * @method FfmpegCommand#audioBitrate
-   * @category Audio
-   * @aliases withAudioBitrate
-   *
-   * @param {String|Number} bitrate audio bitrate in kbps (with an optional 'k' suffix)
-   * @return FfmpegCommand
-   */
-  proto.withAudioBitrate =
-  proto.audioBitrate = function(bitrate) {
-    this._currentOutput.audio('-b:a', ('' + bitrate).replace(/k?$/, 'k'));
-    return this;
-  };
-
-
-  /**
-   * Specify audio channel count
-   *
-   * @method FfmpegCommand#audioChannels
-   * @category Audio
-   * @aliases withAudioChannels
-   *
-   * @param {Number} channels channel count
-   * @return FfmpegCommand
-   */
-  proto.withAudioChannels =
-  proto.audioChannels = function(channels) {
-    this._currentOutput.audio('-ac', channels);
-    return this;
-  };
-
-
-  /**
-   * Specify audio frequency
-   *
-   * @method FfmpegCommand#audioFrequency
-   * @category Audio
-   * @aliases withAudioFrequency
-   *
-   * @param {Number} freq audio frequency in Hz
-   * @return FfmpegCommand
-   */
-  proto.withAudioFrequency =
-  proto.audioFrequency = function(freq) {
-    this._currentOutput.audio('-ar', freq);
-    return this;
-  };
-
-
-  /**
-   * Specify audio quality
-   *
-   * @method FfmpegCommand#audioQuality
-   * @category Audio
-   * @aliases withAudioQuality
-   *
-   * @param {Number} quality audio quality factor
-   * @return FfmpegCommand
-   */
-  proto.withAudioQuality =
-  proto.audioQuality = function(quality) {
-    this._currentOutput.audio('-aq', quality);
-    return this;
-  };
-
-
-  /**
-   * Specify custom audio filter(s)
-   *
-   * Can be called both with one or many filters, or a filter array.
-   *
-   * @example
-   * command.audioFilters('filter1');
-   *
-   * @example
-   * command.audioFilters('filter1', 'filter2=param1=value1:param2=value2');
-   *
-   * @example
-   * command.audioFilters(['filter1', 'filter2']);
-   *
-   * @example
-   * command.audioFilters([
-   *   {
-   *     filter: 'filter1'
-   *   },
-   *   {
-   *     filter: 'filter2',
-   *     options: 'param=value:param=value'
-   *   }
-   * ]);
-   *
-   * @example
-   * command.audioFilters(
-   *   {
-   *     filter: 'filter1',
-   *     options: ['value1', 'value2']
-   *   },
-   *   {
-   *     filter: 'filter2',
-   *     options: { param1: 'value1', param2: 'value2' }
-   *   }
-   * );
-   *
-   * @method FfmpegCommand#audioFilters
-   * @aliases withAudioFilter,withAudioFilters,audioFilter
-   * @category Audio
-   *
-   * @param {...String|String[]|Object[]} filters audio filter strings, string array or
-   *   filter specification array, each with the following properties:
-   * @param {String} filters.filter filter name
-   * @param {String|String[]|Object} [filters.options] filter option string, array, or object
-   * @return FfmpegCommand
-   */
-  proto.withAudioFilter =
-  proto.withAudioFilters =
-  proto.audioFilter =
-  proto.audioFilters = function(filters) {
-    if (arguments.length > 1) {
-      filters = [].slice.call(arguments);
-    }
-
-    if (!Array.isArray(filters)) {
-      filters = [filters];
-    }
-
-    this._currentOutput.audioFilters(utils.makeFilterStrings(filters));
-    return this;
-  };
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/doc/capabilities.js.html b/doc/capabilities.js.html deleted file mode 100644 index f6fc484c..00000000 --- a/doc/capabilities.js.html +++ /dev/null @@ -1,715 +0,0 @@ - - - - - JSDoc: Source: capabilities.js - - - - - - - - - - -
- -

Source: capabilities.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-var fs = require('fs');
-var path = require('path');
-var async = require('async');
-var utils = require('./utils');
-
-/*
- *! Capability helpers
- */
-
-var avCodecRegexp = /^\s*([D ])([E ])([VAS])([S ])([D ])([T ]) ([^ ]+) +(.*)$/;
-var ffCodecRegexp = /^\s*([D\.])([E\.])([VAS])([I\.])([L\.])([S\.]) ([^ ]+) +(.*)$/;
-var ffEncodersRegexp = /\(encoders:([^\)]+)\)/;
-var ffDecodersRegexp = /\(decoders:([^\)]+)\)/;
-var encodersRegexp = /^\s*([VAS\.])([F\.])([S\.])([X\.])([B\.])([D\.]) ([^ ]+) +(.*)$/;
-var formatRegexp = /^\s*([D ])([E ]) ([^ ]+) +(.*)$/;
-var lineBreakRegexp = /\r\n|\r|\n/;
-var filterRegexp = /^(?: [T\.][S\.][C\.] )?([^ ]+) +(AA?|VV?|\|)->(AA?|VV?|\|) +(.*)$/;
-
-var cache = {};
-
-module.exports = function(proto) {
-  /**
-   * Manually define the ffmpeg binary full path.
-   *
-   * @method FfmpegCommand#setFfmpegPath
-   *
-   * @param {String} ffmpegPath The full path to the ffmpeg binary.
-   * @return FfmpegCommand
-   */
-  proto.setFfmpegPath = function(ffmpegPath) {
-    cache.ffmpegPath = ffmpegPath;
-    return this;
-  };
-
-  /**
-   * Manually define the ffprobe binary full path.
-   *
-   * @method FfmpegCommand#setFfprobePath
-   *
-   * @param {String} ffprobePath The full path to the ffprobe binary.
-   * @return FfmpegCommand
-   */
-  proto.setFfprobePath = function(ffprobePath) {
-    cache.ffprobePath = ffprobePath;
-    return this;
-  };
-
-  /**
-   * Manually define the flvtool2/flvmeta binary full path.
-   *
-   * @method FfmpegCommand#setFlvtoolPath
-   *
-   * @param {String} flvtool The full path to the flvtool2 or flvmeta binary.
-   * @return FfmpegCommand
-   */
-  proto.setFlvtoolPath = function(flvtool) {
-    cache.flvtoolPath = flvtool;
-    return this;
-  };
-
-  /**
-   * Forget executable paths
-   *
-   * (only used for testing purposes)
-   *
-   * @method FfmpegCommand#_forgetPaths
-   * @private
-   */
-  proto._forgetPaths = function() {
-    delete cache.ffmpegPath;
-    delete cache.ffprobePath;
-    delete cache.flvtoolPath;
-  };
-
-  /**
-   * Check for ffmpeg availability
-   *
-   * If the FFMPEG_PATH environment variable is set, try to use it.
-   * If it is unset or incorrect, try to find ffmpeg in the PATH instead.
-   *
-   * @method FfmpegCommand#_getFfmpegPath
-   * @param {Function} callback callback with signature (err, path)
-   * @private
-   */
-  proto._getFfmpegPath = function(callback) {
-    if ('ffmpegPath' in cache) {
-      return callback(null, cache.ffmpegPath);
-    }
-
-    async.waterfall([
-      // Try FFMPEG_PATH
-      function(cb) {
-        if (process.env.FFMPEG_PATH) {
-          fs.exists(process.env.FFMPEG_PATH, function(exists) {
-            if (exists) {
-              cb(null, process.env.FFMPEG_PATH);
-            } else {
-              cb(null, '');
-            }
-          });
-        } else {
-          cb(null, '');
-        }
-      },
-
-      // Search in the PATH
-      function(ffmpeg, cb) {
-        if (ffmpeg.length) {
-          return cb(null, ffmpeg);
-        }
-
-        utils.which('ffmpeg', function(err, ffmpeg) {
-          cb(err, ffmpeg);
-        });
-      }
-    ], function(err, ffmpeg) {
-      if (err) {
-        callback(err);
-      } else {
-        callback(null, cache.ffmpegPath = (ffmpeg || ''));
-      }
-    });
-  };
-
-
-  /**
-   * Check for ffprobe availability
-   *
-   * If the FFPROBE_PATH environment variable is set, try to use it.
-   * If it is unset or incorrect, try to find ffprobe in the PATH instead.
-   * If this still fails, try to find ffprobe in the same directory as ffmpeg.
-   *
-   * @method FfmpegCommand#_getFfprobePath
-   * @param {Function} callback callback with signature (err, path)
-   * @private
-   */
-  proto._getFfprobePath = function(callback) {
-    var self = this;
-
-    if ('ffprobePath' in cache) {
-      return callback(null, cache.ffprobePath);
-    }
-
-    async.waterfall([
-      // Try FFPROBE_PATH
-      function(cb) {
-        if (process.env.FFPROBE_PATH) {
-          fs.exists(process.env.FFPROBE_PATH, function(exists) {
-            cb(null, exists ? process.env.FFPROBE_PATH : '');
-          });
-        } else {
-          cb(null, '');
-        }
-      },
-
-      // Search in the PATH
-      function(ffprobe, cb) {
-        if (ffprobe.length) {
-          return cb(null, ffprobe);
-        }
-
-        utils.which('ffprobe', function(err, ffprobe) {
-          cb(err, ffprobe);
-        });
-      },
-
-      // Search in the same directory as ffmpeg
-      function(ffprobe, cb) {
-        if (ffprobe.length) {
-          return cb(null, ffprobe);
-        }
-
-        self._getFfmpegPath(function(err, ffmpeg) {
-          if (err) {
-            cb(err);
-          } else if (ffmpeg.length) {
-            var name = utils.isWindows ? 'ffprobe.exe' : 'ffprobe';
-            var ffprobe = path.join(path.dirname(ffmpeg), name);
-            fs.exists(ffprobe, function(exists) {
-              cb(null, exists ? ffprobe : '');
-            });
-          } else {
-            cb(null, '');
-          }
-        });
-      }
-    ], function(err, ffprobe) {
-      if (err) {
-        callback(err);
-      } else {
-        callback(null, cache.ffprobePath = (ffprobe || ''));
-      }
-    });
-  };
-
-
-  /**
-   * Check for flvtool2/flvmeta availability
-   *
-   * If the FLVTOOL2_PATH or FLVMETA_PATH environment variable are set, try to use them.
-   * If both are either unset or incorrect, try to find flvtool2 or flvmeta in the PATH instead.
-   *
-   * @method FfmpegCommand#_getFlvtoolPath
-   * @param {Function} callback callback with signature (err, path)
-   * @private
-   */
-   proto._getFlvtoolPath = function(callback) {
-    if ('flvtoolPath' in cache) {
-      return callback(null, cache.flvtoolPath);
-    }
-
-    async.waterfall([
-      // Try FLVMETA_PATH
-      function(cb) {
-        if (process.env.FLVMETA_PATH) {
-          fs.exists(process.env.FLVMETA_PATH, function(exists) {
-            cb(null, exists ? process.env.FLVMETA_PATH : '');
-          });
-        } else {
-          cb(null, '');
-        }
-      },
-
-      // Try FLVTOOL2_PATH
-      function(flvtool, cb) {
-        if (flvtool.length) {
-          return cb(null, flvtool);
-        }
-
-        if (process.env.FLVTOOL2_PATH) {
-          fs.exists(process.env.FLVTOOL2_PATH, function(exists) {
-            cb(null, exists ? process.env.FLVTOOL2_PATH : '');
-          });
-        } else {
-          cb(null, '');
-        }
-      },
-
-      // Search for flvmeta in the PATH
-      function(flvtool, cb) {
-        if (flvtool.length) {
-          return cb(null, flvtool);
-        }
-
-        utils.which('flvmeta', function(err, flvmeta) {
-          cb(err, flvmeta);
-        });
-      },
-
-      // Search for flvtool2 in the PATH
-      function(flvtool, cb) {
-        if (flvtool.length) {
-          return cb(null, flvtool);
-        }
-
-        utils.which('flvtool2', function(err, flvtool2) {
-          cb(err, flvtool2);
-        });
-      },
-    ], function(err, flvtool) {
-      if (err) {
-        callback(err);
-      } else {
-        callback(null, cache.flvtoolPath = (flvtool || ''));
-      }
-    });
-  };
-
-
-  /**
-   * A callback passed to {@link FfmpegCommand#availableFilters}.
-   *
-   * @callback FfmpegCommand~filterCallback
-   * @param {Error|null} err error object or null if no error happened
-   * @param {Object} filters filter object with filter names as keys and the following
-   *   properties for each filter:
-   * @param {String} filters.description filter description
-   * @param {String} filters.input input type, one of 'audio', 'video' and 'none'
-   * @param {Boolean} filters.multipleInputs whether the filter supports multiple inputs
-   * @param {String} filters.output output type, one of 'audio', 'video' and 'none'
-   * @param {Boolean} filters.multipleOutputs whether the filter supports multiple outputs
-   */
-
-  /**
-   * Query ffmpeg for available filters
-   *
-   * @method FfmpegCommand#availableFilters
-   * @category Capabilities
-   * @aliases getAvailableFilters
-   *
-   * @param {FfmpegCommand~filterCallback} callback callback function
-   */
-  proto.availableFilters =
-  proto.getAvailableFilters = function(callback) {
-    if ('filters' in cache) {
-      return callback(null, cache.filters);
-    }
-
-    this._spawnFfmpeg(['-filters'], { captureStdout: true, stdoutLines: 0 }, function (err, stdoutRing) {
-      if (err) {
-        return callback(err);
-      }
-
-      var stdout = stdoutRing.get();
-      var lines = stdout.split('\n');
-      var data = {};
-      var types = { A: 'audio', V: 'video', '|': 'none' };
-
-      lines.forEach(function(line) {
-        var match = line.match(filterRegexp);
-        if (match) {
-          data[match[1]] = {
-            description: match[4],
-            input: types[match[2].charAt(0)],
-            multipleInputs: match[2].length > 1,
-            output: types[match[3].charAt(0)],
-            multipleOutputs: match[3].length > 1
-          };
-        }
-      });
-
-      callback(null, cache.filters = data);
-    });
-  };
-
-
-  /**
-   * A callback passed to {@link FfmpegCommand#availableCodecs}.
-   *
-   * @callback FfmpegCommand~codecCallback
-   * @param {Error|null} err error object or null if no error happened
-   * @param {Object} codecs codec object with codec names as keys and the following
-   *   properties for each codec (more properties may be available depending on the
-   *   ffmpeg version used):
-   * @param {String} codecs.description codec description
-   * @param {Boolean} codecs.canDecode whether the codec is able to decode streams
-   * @param {Boolean} codecs.canEncode whether the codec is able to encode streams
-   */
-
-  /**
-   * Query ffmpeg for available codecs
-   *
-   * @method FfmpegCommand#availableCodecs
-   * @category Capabilities
-   * @aliases getAvailableCodecs
-   *
-   * @param {FfmpegCommand~codecCallback} callback callback function
-   */
-  proto.availableCodecs =
-  proto.getAvailableCodecs = function(callback) {
-    if ('codecs' in cache) {
-      return callback(null, cache.codecs);
-    }
-
-    this._spawnFfmpeg(['-codecs'], { captureStdout: true, stdoutLines: 0 }, function(err, stdoutRing) {
-      if (err) {
-        return callback(err);
-      }
-
-      var stdout = stdoutRing.get();
-      var lines = stdout.split(lineBreakRegexp);
-      var data = {};
-
-      lines.forEach(function(line) {
-        var match = line.match(avCodecRegexp);
-        if (match && match[7] !== '=') {
-          data[match[7]] = {
-            type: { 'V': 'video', 'A': 'audio', 'S': 'subtitle' }[match[3]],
-            description: match[8],
-            canDecode: match[1] === 'D',
-            canEncode: match[2] === 'E',
-            drawHorizBand: match[4] === 'S',
-            directRendering: match[5] === 'D',
-            weirdFrameTruncation: match[6] === 'T'
-          };
-        }
-
-        match = line.match(ffCodecRegexp);
-        if (match && match[7] !== '=') {
-          var codecData = data[match[7]] = {
-            type: { 'V': 'video', 'A': 'audio', 'S': 'subtitle' }[match[3]],
-            description: match[8],
-            canDecode: match[1] === 'D',
-            canEncode: match[2] === 'E',
-            intraFrameOnly: match[4] === 'I',
-            isLossy: match[5] === 'L',
-            isLossless: match[6] === 'S'
-          };
-
-          var encoders = codecData.description.match(ffEncodersRegexp);
-          encoders = encoders ? encoders[1].trim().split(' ') : [];
-
-          var decoders = codecData.description.match(ffDecodersRegexp);
-          decoders = decoders ? decoders[1].trim().split(' ') : [];
-
-          if (encoders.length || decoders.length) {
-            var coderData = {};
-            utils.copy(codecData, coderData);
-            delete coderData.canEncode;
-            delete coderData.canDecode;
-
-            encoders.forEach(function(name) {
-              data[name] = {};
-              utils.copy(coderData, data[name]);
-              data[name].canEncode = true;
-            });
-
-            decoders.forEach(function(name) {
-              if (name in data) {
-                data[name].canDecode = true;
-              } else {
-                data[name] = {};
-                utils.copy(coderData, data[name]);
-                data[name].canDecode = true;
-              }
-            });
-          }
-        }
-      });
-
-      callback(null, cache.codecs = data);
-    });
-  };
-
-
-  /**
-   * A callback passed to {@link FfmpegCommand#availableEncoders}.
-   *
-   * @callback FfmpegCommand~encodersCallback
-   * @param {Error|null} err error object or null if no error happened
-   * @param {Object} encoders encoders object with encoder names as keys and the following
-   *   properties for each encoder:
-   * @param {String} encoders.description codec description
-   * @param {Boolean} encoders.type "audio", "video" or "subtitle"
-   * @param {Boolean} encoders.frameMT whether the encoder is able to do frame-level multithreading
-   * @param {Boolean} encoders.sliceMT whether the encoder is able to do slice-level multithreading
-   * @param {Boolean} encoders.experimental whether the encoder is experimental
-   * @param {Boolean} encoders.drawHorizBand whether the encoder supports draw_horiz_band
-   * @param {Boolean} encoders.directRendering whether the encoder supports direct encoding method 1
-   */
-
-  /**
-   * Query ffmpeg for available encoders
-   *
-   * @method FfmpegCommand#availableEncoders
-   * @category Capabilities
-   * @aliases getAvailableEncoders
-   *
-   * @param {FfmpegCommand~encodersCallback} callback callback function
-   */
-  proto.availableEncoders =
-  proto.getAvailableEncoders = function(callback) {
-    if ('encoders' in cache) {
-      return callback(null, cache.encoders);
-    }
-
-    this._spawnFfmpeg(['-encoders'], { captureStdout: true, stdoutLines: 0 }, function(err, stdoutRing) {
-      if (err) {
-        return callback(err);
-      }
-
-      var stdout = stdoutRing.get();
-      var lines = stdout.split(lineBreakRegexp);
-      var data = {};
-
-      lines.forEach(function(line) {
-        var match = line.match(encodersRegexp);
-        if (match && match[7] !== '=') {
-          data[match[7]] = {
-            type: { 'V': 'video', 'A': 'audio', 'S': 'subtitle' }[match[1]],
-            description: match[8],
-            frameMT: match[2] === 'F',
-            sliceMT: match[3] === 'S',
-            experimental: match[4] === 'X',
-            drawHorizBand: match[5] === 'B',
-            directRendering: match[6] === 'D'
-          };
-        }
-      });
-
-      callback(null, cache.encoders = data);
-    });
-  };
-
-
-  /**
-   * A callback passed to {@link FfmpegCommand#availableFormats}.
-   *
-   * @callback FfmpegCommand~formatCallback
-   * @param {Error|null} err error object or null if no error happened
-   * @param {Object} formats format object with format names as keys and the following
-   *   properties for each format:
-   * @param {String} formats.description format description
-   * @param {Boolean} formats.canDemux whether the format is able to demux streams from an input file
-   * @param {Boolean} formats.canMux whether the format is able to mux streams into an output file
-   */
-
-  /**
-   * Query ffmpeg for available formats
-   *
-   * @method FfmpegCommand#availableFormats
-   * @category Capabilities
-   * @aliases getAvailableFormats
-   *
-   * @param {FfmpegCommand~formatCallback} callback callback function
-   */
-  proto.availableFormats =
-  proto.getAvailableFormats = function(callback) {
-    if ('formats' in cache) {
-      return callback(null, cache.formats);
-    }
-
-    // Run ffmpeg -formats
-    this._spawnFfmpeg(['-formats'], { captureStdout: true, stdoutLines: 0 }, function (err, stdoutRing) {
-      if (err) {
-        return callback(err);
-      }
-
-      // Parse output
-      var stdout = stdoutRing.get();
-      var lines = stdout.split(lineBreakRegexp);
-      var data = {};
-
-      lines.forEach(function(line) {
-        var match = line.match(formatRegexp);
-        if (match) {
-          match[3].split(',').forEach(function(format) {
-            if (!(format in data)) {
-              data[format] = {
-                description: match[4],
-                canDemux: false,
-                canMux: false
-              };
-            }
-
-            if (match[1] === 'D') {
-              data[format].canDemux = true;
-            }
-            if (match[2] === 'E') {
-              data[format].canMux = true;
-            }
-          });
-        }
-      });
-
-      callback(null, cache.formats = data);
-    });
-  };
-
-
-  /**
-   * Check capabilities before executing a command
-   *
-   * Checks whether all used codecs and formats are indeed available
-   *
-   * @method FfmpegCommand#_checkCapabilities
-   * @param {Function} callback callback with signature (err)
-   * @private
-   */
-  proto._checkCapabilities = function(callback) {
-    var self = this;
-    async.waterfall([
-      // Get available formats
-      function(cb) {
-        self.availableFormats(cb);
-      },
-
-      // Check whether specified formats are available
-      function(formats, cb) {
-        var unavailable;
-
-        // Output format(s)
-        unavailable = self._outputs
-          .reduce(function(fmts, output) {
-            var format = output.options.find('-f', 1);
-            if (format) {
-              if (!(format[0] in formats) || !(formats[format[0]].canMux)) {
-                fmts.push(format);
-              }
-            }
-
-            return fmts;
-          }, []);
-
-        if (unavailable.length === 1) {
-          return cb(new Error('Output format ' + unavailable[0] + ' is not available'));
-        } else if (unavailable.length > 1) {
-          return cb(new Error('Output formats ' + unavailable.join(', ') + ' are not available'));
-        }
-
-        // Input format(s)
-        unavailable = self._inputs
-          .reduce(function(fmts, input) {
-            var format = input.options.find('-f', 1);
-            if (format) {
-              if (!(format[0] in formats) || !(formats[format[0]].canDemux)) {
-                fmts.push(format[0]);
-              }
-            }
-
-            return fmts;
-          }, []);
-
-        if (unavailable.length === 1) {
-          return cb(new Error('Input format ' + unavailable[0] + ' is not available'));
-        } else if (unavailable.length > 1) {
-          return cb(new Error('Input formats ' + unavailable.join(', ') + ' are not available'));
-        }
-
-        cb();
-      },
-
-      // Get available codecs
-      function(cb) {
-        self.availableEncoders(cb);
-      },
-
-      // Check whether specified codecs are available and add strict experimental options if needed
-      function(encoders, cb) {
-        var unavailable;
-
-        // Audio codec(s)
-        unavailable = self._outputs.reduce(function(cdcs, output) {
-          var acodec = output.audio.find('-acodec', 1);
-          if (acodec && acodec[0] !== 'copy') {
-            if (!(acodec[0] in encoders) || encoders[acodec[0]].type !== 'audio') {
-              cdcs.push(acodec[0]);
-            }
-          }
-
-          return cdcs;
-        }, []);
-
-        if (unavailable.length === 1) {
-          return cb(new Error('Audio codec ' + unavailable[0] + ' is not available'));
-        } else if (unavailable.length > 1) {
-          return cb(new Error('Audio codecs ' + unavailable.join(', ') + ' are not available'));
-        }
-
-        // Video codec(s)
-        unavailable = self._outputs.reduce(function(cdcs, output) {
-          var vcodec = output.video.find('-vcodec', 1);
-          if (vcodec && vcodec[0] !== 'copy') {
-            if (!(vcodec[0] in encoders) || encoders[vcodec[0]].type !== 'video') {
-              cdcs.push(vcodec[0]);
-            }
-          }
-
-          return cdcs;
-        }, []);
-
-        if (unavailable.length === 1) {
-          return cb(new Error('Video codec ' + unavailable[0] + ' is not available'));
-        } else if (unavailable.length > 1) {
-          return cb(new Error('Video codecs ' + unavailable.join(', ') + ' are not available'));
-        }
-
-        cb();
-      }
-    ], callback);
-  };
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/doc/custom.js.html b/doc/custom.js.html deleted file mode 100644 index af7098c0..00000000 --- a/doc/custom.js.html +++ /dev/null @@ -1,262 +0,0 @@ - - - - - JSDoc: Source: options/custom.js - - - - - - - - - - -
- -

Source: options/custom.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-var utils = require('../utils');
-
-
-/*
- *! Custom options methods
- */
-
-module.exports = function(proto) {
-  /**
-   * Add custom input option(s)
-   *
-   * When passing a single string or an array, each string containing two
-   * words is split (eg. inputOptions('-option value') is supported) for
-   * compatibility reasons.  This is not the case when passing more than
-   * one argument.
-   *
-   * @example
-   * command.inputOptions('option1');
-   *
-   * @example
-   * command.inputOptions('option1', 'option2');
-   *
-   * @example
-   * command.inputOptions(['option1', 'option2']);
-   *
-   * @method FfmpegCommand#inputOptions
-   * @category Custom options
-   * @aliases addInputOption,addInputOptions,withInputOption,withInputOptions,inputOption
-   *
-   * @param {...String} options option string(s) or string array
-   * @return FfmpegCommand
-   */
-  proto.addInputOption =
-  proto.addInputOptions =
-  proto.withInputOption =
-  proto.withInputOptions =
-  proto.inputOption =
-  proto.inputOptions = function(options) {
-    if (!this._currentInput) {
-      throw new Error('No input specified');
-    }
-
-    var doSplit = true;
-
-    if (arguments.length > 1) {
-      options = [].slice.call(arguments);
-      doSplit = false;
-    }
-
-    if (!Array.isArray(options)) {
-      options = [options];
-    }
-
-    this._currentInput.options(options.reduce(function(options, option) {
-      var split = option.split(' ');
-
-      if (doSplit && split.length === 2) {
-        options.push(split[0], split[1]);
-      } else {
-        options.push(option);
-      }
-
-      return options;
-    }, []));
-    return this;
-  };
-
-
-  /**
-   * Add custom output option(s)
-   *
-   * @example
-   * command.outputOptions('option1');
-   *
-   * @example
-   * command.outputOptions('option1', 'option2');
-   *
-   * @example
-   * command.outputOptions(['option1', 'option2']);
-   *
-   * @method FfmpegCommand#outputOptions
-   * @category Custom options
-   * @aliases addOutputOption,addOutputOptions,addOption,addOptions,withOutputOption,withOutputOptions,withOption,withOptions,outputOption
-   *
-   * @param {...String} options option string(s) or string array
-   * @return FfmpegCommand
-   */
-  proto.addOutputOption =
-  proto.addOutputOptions =
-  proto.addOption =
-  proto.addOptions =
-  proto.withOutputOption =
-  proto.withOutputOptions =
-  proto.withOption =
-  proto.withOptions =
-  proto.outputOption =
-  proto.outputOptions = function(options) {
-    var doSplit = true;
-
-    if (arguments.length > 1) {
-      options = [].slice.call(arguments);
-      doSplit = false;
-    }
-
-    if (!Array.isArray(options)) {
-      options = [options];
-    }
-
-    this._currentOutput.options(options.reduce(function(options, option) {
-      var split = option.split(' ');
-
-      if (doSplit && split.length === 2) {
-        options.push(split[0], split[1]);
-      } else {
-        options.push(option);
-      }
-
-      return options;
-    }, []));
-    return this;
-  };
-
-
-  /**
-   * Specify a complex filtergraph
-   *
-   * Calling this method will override any previously set filtergraph, but you can set
-   * as many filters as needed in one call.
-   *
-   * @example <caption>Overlay an image over a video (using a filtergraph string)</caption>
-   *   ffmpeg()
-   *     .input('video.avi')
-   *     .input('image.png')
-   *     .complexFilter('[0:v][1:v]overlay[out]', ['out']);
-   *
-   * @example <caption>Overlay an image over a video (using a filter array)</caption>
-   *   ffmpeg()
-   *     .input('video.avi')
-   *     .input('image.png')
-   *     .complexFilter([{
-   *       filter: 'overlay',
-   *       inputs: ['0:v', '1:v'],
-   *       outputs: ['out']
-   *     }], ['out']);
-   *
-   * @example <caption>Split video into RGB channels and output a 3x1 video with channels side to side</caption>
-   *  ffmpeg()
-   *    .input('video.avi')
-   *    .complexFilter([
-   *      // Duplicate video stream 3 times into streams a, b, and c
-   *      { filter: 'split', options: '3', outputs: ['a', 'b', 'c'] },
-   *
-   *      // Create stream 'red' by cancelling green and blue channels from stream 'a'
-   *      { filter: 'lutrgb', options: { g: 0, b: 0 }, inputs: 'a', outputs: 'red' },
-   *
-   *      // Create stream 'green' by cancelling red and blue channels from stream 'b'
-   *      { filter: 'lutrgb', options: { r: 0, b: 0 }, inputs: 'b', outputs: 'green' },
-   *
-   *      // Create stream 'blue' by cancelling red and green channels from stream 'c'
-   *      { filter: 'lutrgb', options: { r: 0, g: 0 }, inputs: 'c', outputs: 'blue' },
-   *
-   *      // Pad stream 'red' to 3x width, keeping the video on the left, and name output 'padded'
-   *      { filter: 'pad', options: { w: 'iw*3', h: 'ih' }, inputs: 'red', outputs: 'padded' },
-   *
-   *      // Overlay 'green' onto 'padded', moving it to the center, and name output 'redgreen'
-   *      { filter: 'overlay', options: { x: 'w', y: 0 }, inputs: ['padded', 'green'], outputs: 'redgreen'},
-   *
-   *      // Overlay 'blue' onto 'redgreen', moving it to the right
-   *      { filter: 'overlay', options: { x: '2*w', y: 0 }, inputs: ['redgreen', 'blue']},
-   *    ]);
-   *
-   * @method FfmpegCommand#complexFilter
-   * @category Custom options
-   * @aliases filterGraph
-   *
-   * @param {String|Array} spec filtergraph string or array of filter specification
-   *   objects, each having the following properties:
-   * @param {String} spec.filter filter name
-   * @param {String|Array} [spec.inputs] (array of) input stream specifier(s) for the filter,
-   *   defaults to ffmpeg automatically choosing the first unused matching streams
-   * @param {String|Array} [spec.outputs] (array of) output stream specifier(s) for the filter,
-   *   defaults to ffmpeg automatically assigning the output to the output file
-   * @param {Object|String|Array} [spec.options] filter options, can be omitted to not set any options
-   * @param {Array} [map] (array of) stream specifier(s) from the graph to include in
-   *   ffmpeg output, defaults to ffmpeg automatically choosing the first matching streams.
-   * @return FfmpegCommand
-   */
-  proto.filterGraph =
-  proto.complexFilter = function(spec, map) {
-    this._complexFilters.clear();
-
-    if (!Array.isArray(spec)) {
-      spec = [spec];
-    }
-
-    this._complexFilters('-filter_complex', utils.makeFilterStrings(spec).join(';'));
-
-    if (Array.isArray(map)) {
-      var self = this;
-      map.forEach(function(streamSpec) {
-        self._complexFilters('-map', streamSpec.replace(utils.streamRegexp, '[$1]'));
-      });
-    } else if (typeof map === 'string') {
-      this._complexFilters('-map', map.replace(utils.streamRegexp, '[$1]'));
-    }
-
-    return this;
-  };
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/doc/ffprobe.js.html b/doc/ffprobe.js.html deleted file mode 100644 index 0c604040..00000000 --- a/doc/ffprobe.js.html +++ /dev/null @@ -1,311 +0,0 @@ - - - - - JSDoc: Source: ffprobe.js - - - - - - - - - - -
- -

Source: ffprobe.js

- - - - - -
-
-
/*jshint node:true, laxcomma:true*/
-'use strict';
-
-var spawn = require('child_process').spawn;
-
-
-function legacyTag(key) { return key.match(/^TAG:/); }
-function legacyDisposition(key) { return key.match(/^DISPOSITION:/); }
-
-function parseFfprobeOutput(out) {
-  var lines = out.split(/\r\n|\r|\n/);
-
-  lines = lines.filter(function (line) {
-    return line.length > 0;
-  });
-
-  var data = {
-    streams: [],
-    format: {},
-    chapters: []
-  };
-
-  function parseBlock(name) {
-    var data = {};
-
-    var line = lines.shift();
-    while (typeof line !== 'undefined') {
-      if (line.toLowerCase() == '[/'+name+']') {
-        return data;
-      } else if (line.match(/^\[/)) {
-        line = lines.shift();
-        continue;
-      }
-
-      var kv = line.match(/^([^=]+)=(.*)$/);
-      if (kv) {
-        if (!(kv[1].match(/^TAG:/)) && kv[2].match(/^[0-9]+(\.[0-9]+)?$/)) {
-          data[kv[1]] = Number(kv[2]);
-        } else {
-          data[kv[1]] = kv[2];
-        }
-      }
-
-      line = lines.shift();
-    }
-
-    return data;
-  }
-
-  var line = lines.shift();
-  while (typeof line !== 'undefined') {
-    if (line.match(/^\[stream/i)) {
-      var stream = parseBlock('stream');
-      data.streams.push(stream);
-    } else if (line.match(/^\[chapter/i)) {
-      var chapter = parseBlock('chapter');
-      data.chapters.push(chapter);
-    } else if (line.toLowerCase() === '[format]') {
-      data.format = parseBlock('format');
-    }
-
-    line = lines.shift();
-  }
-
-  return data;
-}
-
-
-
-module.exports = function(proto) {
-  /**
-   * A callback passed to the {@link FfmpegCommand#ffprobe} method.
-   *
-   * @callback FfmpegCommand~ffprobeCallback
-   *
-   * @param {Error|null} err error object or null if no error happened
-   * @param {Object} ffprobeData ffprobe output data; this object
-   *   has the same format as what the following command returns:
-   *
-   *     `ffprobe -print_format json -show_streams -show_format INPUTFILE`
-   * @param {Array} ffprobeData.streams stream information
-   * @param {Object} ffprobeData.format format information
-   */
-
-  /**
-   * Run ffprobe on last specified input
-   *
-   * @method FfmpegCommand#ffprobe
-   * @category Metadata
-   *
-   * @param {?Number} [index] 0-based index of input to probe (defaults to last input)
-   * @param {?String[]} [options] array of output options to return
-   * @param {FfmpegCommand~ffprobeCallback} callback callback function
-   *
-   */
-  proto.ffprobe = function() {
-    var input, index = null, options = [], callback;
-
-    // the last argument should be the callback
-    var callback = arguments[arguments.length - 1];
-
-    var ended = false
-    function handleCallback(err, data) {
-      if (!ended) {
-        ended = true;
-        callback(err, data);
-      }
-    };
-
-    // map the arguments to the correct variable names
-    switch (arguments.length) {
-      case 3:
-        index = arguments[0];
-        options = arguments[1];
-        break;
-      case 2:
-        if (typeof arguments[0] === 'number') {
-          index = arguments[0];
-        } else if (Array.isArray(arguments[0])) {
-          options = arguments[0];
-        }
-        break;
-    }
-
-
-    if (index === null) {
-      if (!this._currentInput) {
-        return handleCallback(new Error('No input specified'));
-      }
-
-      input = this._currentInput;
-    } else {
-      input = this._inputs[index];
-
-      if (!input) {
-        return handleCallback(new Error('Invalid input index'));
-      }
-    }
-
-    // Find ffprobe
-    this._getFfprobePath(function(err, path) {
-      if (err) {
-        return handleCallback(err);
-      } else if (!path) {
-        return handleCallback(new Error('Cannot find ffprobe'));
-      }
-
-      var stdout = '';
-      var stdoutClosed = false;
-      var stderr = '';
-      var stderrClosed = false;
-
-      // Spawn ffprobe
-      var src = input.isStream ? 'pipe:0' : input.source;
-      var ffprobe = spawn(path, ['-show_streams', '-show_format'].concat(options, src));
-
-      if (input.isStream) {
-        // Skip errors on stdin. These get thrown when ffprobe is complete and
-        // there seems to be no way hook in and close stdin before it throws.
-        ffprobe.stdin.on('error', function(err) {
-          if (['ECONNRESET', 'EPIPE'].indexOf(err.code) >= 0) { return; }
-          handleCallback(err);
-        });
-
-        // Once ffprobe's input stream closes, we need no more data from the
-        // input
-        ffprobe.stdin.on('close', function() {
-            input.source.pause();
-            input.source.unpipe(ffprobe.stdin);
-        });
-
-        input.source.pipe(ffprobe.stdin);
-      }
-
-      ffprobe.on('error', callback);
-
-      // Ensure we wait for captured streams to end before calling callback
-      var exitError = null;
-      function handleExit(err) {
-        if (err) {
-          exitError = err;
-        }
-
-        if (processExited && stdoutClosed && stderrClosed) {
-          if (exitError) {
-            if (stderr) {
-              exitError.message += '\n' + stderr;
-            }
-
-            return handleCallback(exitError);
-          }
-
-          // Process output
-          var data = parseFfprobeOutput(stdout);
-
-          // Handle legacy output with "TAG:x" and "DISPOSITION:x" keys
-          [data.format].concat(data.streams).forEach(function(target) {
-            if (target) {
-              var legacyTagKeys = Object.keys(target).filter(legacyTag);
-
-              if (legacyTagKeys.length) {
-                target.tags = target.tags || {};
-
-                legacyTagKeys.forEach(function(tagKey) {
-                  target.tags[tagKey.substr(4)] = target[tagKey];
-                  delete target[tagKey];
-                });
-              }
-
-              var legacyDispositionKeys = Object.keys(target).filter(legacyDisposition);
-
-              if (legacyDispositionKeys.length) {
-                target.disposition = target.disposition || {};
-
-                legacyDispositionKeys.forEach(function(dispositionKey) {
-                  target.disposition[dispositionKey.substr(12)] = target[dispositionKey];
-                  delete target[dispositionKey];
-                });
-              }
-            }
-          });
-
-          handleCallback(null, data);
-        }
-      }
-
-      // Handle ffprobe exit
-      var processExited = false;
-      ffprobe.on('exit', function(code, signal) {
-        processExited = true;
-
-        if (code) {
-          handleExit(new Error('ffprobe exited with code ' + code));
-        } else if (signal) {
-          handleExit(new Error('ffprobe was killed with signal ' + signal));
-        } else {
-          handleExit();
-        }
-      });
-
-      // Handle stdout/stderr streams
-      ffprobe.stdout.on('data', function(data) {
-        stdout += data;
-      });
-
-      ffprobe.stdout.on('close', function() {
-        stdoutClosed = true;
-        handleExit();
-      });
-
-      ffprobe.stderr.on('data', function(data) {
-        stderr += data;
-      });
-
-      ffprobe.stderr.on('close', function() {
-        stderrClosed = true;
-        handleExit();
-      });
-    });
-  };
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/doc/fluent-ffmpeg.js.html b/doc/fluent-ffmpeg.js.html deleted file mode 100644 index 2387bf05..00000000 --- a/doc/fluent-ffmpeg.js.html +++ /dev/null @@ -1,271 +0,0 @@ - - - - - JSDoc: Source: fluent-ffmpeg.js - - - - - - - - - - -
- -

Source: fluent-ffmpeg.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-var path = require('path');
-var util = require('util');
-var EventEmitter = require('events').EventEmitter;
-
-var utils = require('./utils');
-var ARGLISTS = ['_global', '_audio', '_audioFilters', '_video', '_videoFilters', '_sizeFilters', '_complexFilters'];
-
-
-/**
- * Create an ffmpeg command
- *
- * Can be called with or without the 'new' operator, and the 'input' parameter
- * may be specified as 'options.source' instead (or passed later with the
- * addInput method).
- *
- * @constructor
- * @param {String|ReadableStream} [input] input file path or readable stream
- * @param {Object} [options] command options
- * @param {Object} [options.logger=<no logging>] logger object with 'error', 'warning', 'info' and 'debug' methods
- * @param {Number} [options.niceness=0] ffmpeg process niceness, ignored on Windows
- * @param {Number} [options.priority=0] alias for `niceness`
- * @param {String} [options.presets="fluent-ffmpeg/lib/presets"] directory to load presets from
- * @param {String} [options.preset="fluent-ffmpeg/lib/presets"] alias for `presets`
- * @param {String} [options.stdoutLines=100] maximum lines of ffmpeg output to keep in memory, use 0 for unlimited
- * @param {Number} [options.timeout=<no timeout>] ffmpeg processing timeout in seconds
- * @param {String|ReadableStream} [options.source=<no input>] alias for the `input` parameter
- */
-function FfmpegCommand(input, options) {
-  // Make 'new' optional
-  if (!(this instanceof FfmpegCommand)) {
-    return new FfmpegCommand(input, options);
-  }
-
-  EventEmitter.call(this);
-
-  if (typeof input === 'object' && !('readable' in input)) {
-    // Options object passed directly
-    options = input;
-  } else {
-    // Input passed first
-    options = options || {};
-    options.source = input;
-  }
-
-  // Add input if present
-  this._inputs = [];
-  if (options.source) {
-    this.input(options.source);
-  }
-
-  // Add target-less output for backwards compatibility
-  this._outputs = [];
-  this.output();
-
-  // Create argument lists
-  var self = this;
-  ['_global', '_complexFilters'].forEach(function(prop) {
-    self[prop] = utils.args();
-  });
-
-  // Set default option values
-  options.stdoutLines = 'stdoutLines' in options ? options.stdoutLines : 100;
-  options.presets = options.presets || options.preset || path.join(__dirname, 'presets');
-  options.niceness = options.niceness || options.priority || 0;
-
-  // Save options
-  this.options = options;
-
-  // Setup logger
-  this.logger = options.logger || {
-    debug: function() {},
-    info: function() {},
-    warn: function() {},
-    error: function() {}
-  };
-}
-util.inherits(FfmpegCommand, EventEmitter);
-module.exports = FfmpegCommand;
-
-
-/**
- * Clone an ffmpeg command
- *
- * This method is useful when you want to process the same input multiple times.
- * It returns a new FfmpegCommand instance with the exact same options.
- *
- * All options set _after_ the clone() call will only be applied to the instance
- * it has been called on.
- *
- * @example
- *   var command = ffmpeg('/path/to/source.avi')
- *     .audioCodec('libfaac')
- *     .videoCodec('libx264')
- *     .format('mp4');
- *
- *   command.clone()
- *     .size('320x200')
- *     .save('/path/to/output-small.mp4');
- *
- *   command.clone()
- *     .size('640x400')
- *     .save('/path/to/output-medium.mp4');
- *
- *   command.save('/path/to/output-original-size.mp4');
- *
- * @method FfmpegCommand#clone
- * @return FfmpegCommand
- */
-FfmpegCommand.prototype.clone = function() {
-  var clone = new FfmpegCommand();
-  var self = this;
-
-  // Clone options and logger
-  clone.options = this.options;
-  clone.logger = this.logger;
-
-  // Clone inputs
-  clone._inputs = this._inputs.map(function(input) {
-    return {
-      source: input.source,
-      options: input.options.clone()
-    };
-  });
-
-  // Create first output
-  if ('target' in this._outputs[0]) {
-    // We have outputs set, don't clone them and create first output
-    clone._outputs = [];
-    clone.output();
-  } else {
-    // No outputs set, clone first output options
-    clone._outputs = [
-      clone._currentOutput = {
-        flags: {}
-      }
-    ];
-
-    ['audio', 'audioFilters', 'video', 'videoFilters', 'sizeFilters', 'options'].forEach(function(key) {
-      clone._currentOutput[key] = self._currentOutput[key].clone();
-    });
-
-    if (this._currentOutput.sizeData) {
-      clone._currentOutput.sizeData = {};
-      utils.copy(this._currentOutput.sizeData, clone._currentOutput.sizeData);
-    }
-
-    utils.copy(this._currentOutput.flags, clone._currentOutput.flags);
-  }
-
-  // Clone argument lists
-  ['_global', '_complexFilters'].forEach(function(prop) {
-    clone[prop] = self[prop].clone();
-  });
-
-  return clone;
-};
-
-
-/* Add methods from options submodules */
-
-require('./options/inputs')(FfmpegCommand.prototype);
-require('./options/audio')(FfmpegCommand.prototype);
-require('./options/video')(FfmpegCommand.prototype);
-require('./options/videosize')(FfmpegCommand.prototype);
-require('./options/output')(FfmpegCommand.prototype);
-require('./options/custom')(FfmpegCommand.prototype);
-require('./options/misc')(FfmpegCommand.prototype);
-
-
-/* Add processor methods */
-
-require('./processor')(FfmpegCommand.prototype);
-
-
-/* Add capabilities methods */
-
-require('./capabilities')(FfmpegCommand.prototype);
-
-FfmpegCommand.setFfmpegPath = function(path) {
-  (new FfmpegCommand()).setFfmpegPath(path);
-};
-
-FfmpegCommand.setFfprobePath = function(path) {
-  (new FfmpegCommand()).setFfprobePath(path);
-};
-
-FfmpegCommand.setFlvtoolPath = function(path) {
-  (new FfmpegCommand()).setFlvtoolPath(path);
-};
-
-FfmpegCommand.availableFilters =
-FfmpegCommand.getAvailableFilters = function(callback) {
-  (new FfmpegCommand()).availableFilters(callback);
-};
-
-FfmpegCommand.availableCodecs =
-FfmpegCommand.getAvailableCodecs = function(callback) {
-  (new FfmpegCommand()).availableCodecs(callback);
-};
-
-FfmpegCommand.availableFormats =
-FfmpegCommand.getAvailableFormats = function(callback) {
-  (new FfmpegCommand()).availableFormats(callback);
-};
-
-
-/* Add ffprobe methods */
-
-require('./ffprobe')(FfmpegCommand.prototype);
-
-FfmpegCommand.ffprobe = function(file) {
-  var instance = new FfmpegCommand(file);
-  instance.ffprobe.apply(instance, Array.prototype.slice.call(arguments, 1));
-};
-
-/* Add processing recipes */
-
-require('./recipes')(FfmpegCommand.prototype);
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/doc/global.html b/doc/global.html deleted file mode 100644 index 9362b4e0..00000000 --- a/doc/global.html +++ /dev/null @@ -1,932 +0,0 @@ - - - - - JSDoc: Global - - - - - - - - - - -
- -

Global

- - - - - -
- -
-

- -

- -
- -
-
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-

<private> createSizeFilters(command, key, value)

- - -
-
- - -
-

Recompute size filters

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
command - - -FfmpegCommand - - - -
key - - -String - - - -

newly-added parameter name ('size', 'aspect' or 'pad')

value - - -String - - - -

newly-added parameter value

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

filter string array

-
- - - - - - -
- - - -
-

<private> getScalePadFilters(width, height, aspect, color)

- - -
-
- - -
-

Return filters to pad video to width*height,

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
width - - -Number - - - -

output width

height - - -Number - - - -

output height

aspect - - -Number - - - -

video aspect ratio (without padding)

color - - -Number - - - -

padding color

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

scale/pad filters

-
- - - - - - -
- - - -
-

<private> parseProgressLine(line)

- - -
-
- - -
-

Parse progress line from ffmpeg stderr

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
line - - -String - - - -

progress line

- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

progress object

-
- - - - - - -
- - - -
-

<private> process(command, target, pipeOptions)

- - -
-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
command - - -FfmpegCommand - - - - - - - - - -
target - - -String -| - -Writable - - - - - - - - - -
pipeOptions - - -Object - - - - - - <optional>
- - - - - -
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-

<private> runFfprobe(command)

- - -
-
- - -
-

Run ffprobe asynchronously and store data in command

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
command - - -FfmpegCommand - - - -
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- -
- - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/doc/index.html b/doc/index.html deleted file mode 100644 index 57a024c9..00000000 --- a/doc/index.html +++ /dev/null @@ -1,973 +0,0 @@ - - - - - JSDoc: Index - - - - - - - - - - -
- -

Index

- - - - - - - -

- - - - - - - - - - - - - - -
-

Fluent ffmpeg-API for node.js

This library abstracts the complex command-line usage of ffmpeg into a fluent, easy to use node.js module. In order to be able to use this module, make sure you have ffmpeg installed on your system (including all necessary encoding libraries like libmp3lame or libx264).

-
-

This is the documentation for fluent-ffmpeg 2.x. -You can still access the code and documentation for fluent-ffmpeg 1.7 here.

-
-

Installation

Via npm:

-
$ npm install fluent-ffmpeg

Or as a submodule:

-
$ git submodule add git://github.com/schaermu/node-fluent-ffmpeg.git vendor/fluent-ffmpeg

Usage

You will find a lot of usage examples (including a real-time streaming example using flowplayer and express!) in the examples folder.

-

Prerequisites

ffmpeg and ffprobe

fluent-ffmpeg requires ffmpeg >= 0.9 to work. It may work with previous versions but several features won't be available (and the library is not tested with lower versions anylonger).

-

If the FFMPEG_PATH environment variable is set, fluent-ffmpeg will use it as the full path to the ffmpeg executable. Otherwise, it will attempt to call ffmpeg directly (so it should be in your PATH). You must also have ffprobe installed (it comes with ffmpeg in most distributions). Similarly, fluent-ffmpeg will use the FFPROBE_PATH environment variable if it is set, otherwise it will attempt to call it in the PATH.

-

Most features should work when using avconv and avprobe instead of ffmpeg and ffprobe, but they are not officially supported at the moment.

-

Windows users: most probably ffmpeg and ffprobe will not be in your %PATH, so you must set %FFMPEG_PATH and %FFPROBE_PATH.

-

Debian/Ubuntu users: the official repositories have the ffmpeg/ffprobe executable in the libav-tools package, and they are actually rebranded avconv/avprobe executables (avconv is a fork of ffmpeg). They should be mostly compatible, but should you encounter any issue, you may want to use the real ffmpeg instead. You can either compile it from source or find a pre-built .deb package at https://ffmpeg.org/download.html (For Ubuntu, the ppa:jon-severinsson/ffmpeg PPA provides recent builds).

-

flvtool2 or flvmeta

If you intend to encode FLV videos, you must have either flvtool2 or flvmeta installed and in your PATH or fluent-ffmpeg won't be able to produce streamable output files. If you set either the FLVTOOL2_PATH or FLVMETA_PATH, fluent-ffmpeg will try to use it instead of searching in the PATH.

-

Setting binary paths manually

Alternatively, you may set the ffmpeg, ffprobe and flvtool2/flvmeta binary paths manually by using the following API commands:

-
    -
  • Ffmpeg.setFfmpegPath(path) Argument path is a string with the full path to the ffmpeg binary.
  • -
  • Ffmpeg.setFfprobePath(path) Argument path is a string with the full path to the ffprobe binary.
  • -
  • Ffmpeg.setFlvtoolPath(path) Argument path is a string with the full path to the flvtool2 or flvmeta binary.
  • -
-

Creating an FFmpeg command

The fluent-ffmpeg module returns a constructor that you can use to instanciate FFmpeg commands.

-
var FfmpegCommand = require('fluent-ffmpeg');
-var command = new FfmpegCommand();

You can also use the constructor without the new operator.

-
var ffmpeg = require('fluent-ffmpeg');
-var command = ffmpeg();

You may pass an input file name or readable stream, a configuration object, or both to the constructor.

-
var command = ffmpeg('/path/to/file.avi');
-var command = ffmpeg(fs.createReadStream('/path/to/file.avi'));
-var command = ffmpeg({ option: "value", ... });
-var 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)
  • -
  • preset or presets: directory to load module presets from (defaults to the lib/presets directory in fluent-ffmpeg tree)
  • -
  • niceness or priority: ffmpeg niceness value, between -20 and 20; ignored on Windows platforms (defaults to 0)
  • -
  • logger: logger object with debug(), info(), warn() and error() 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)
  • -
-

Specifying inputs

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');

Input options

The following methods enable passing input-related options to ffmpeg. Each of these methods apply on the last input added (including the one passed to the constructor, if any). You must add an input before calling those, or an error will be thrown.

-

inputFormat(format): specify input format

Aliases: fromFormat(), withInputFormat().

-

This is only useful for raw inputs, as ffmpeg can determine the input format automatically.

-
ffmpeg()
-  .input('/dev/video0')
-  .inputFormat('mov')
-  .input('/path/to/file.avi')
-  .inputFormat('avi');

Fluent-ffmpeg checks for format availability before actually running the command, and throws an error when a specified input format is not available.

-

inputFPS(fps): specify input framerate

Aliases: withInputFps(), withInputFPS(), withFpsInput(), withFPSInput(), inputFps(), fpsInput(), FPSInput().

-

This is only valid for raw inputs, as ffmpeg can determine the input framerate automatically.

-
ffmpeg('/dev/video0').inputFPS(29.7);

native(): read input at native framerate

Aliases: nativeFramerate(), withNativeFramerate().

-
ffmpeg('/path/to/file.avi').native();

seekInput(time): set input start time

Alias: setStartTime().

-

Seeks an input and only start decoding at given time offset. The time argument may be a number (in seconds) or a timestamp string (with format [[hh:]mm:]ss[.xxx]).

-
ffmpeg('/path/to/file.avi').seekInput(134.5);
-ffmpeg('/path/to/file.avi').seekInput('2:14.500');

loop([duration]): loop over input

ffmpeg('/path/to/file.avi').loop();
-ffmpeg('/path/to/file.avi').loop(134.5);
-ffmpeg('/path/to/file.avi').loop('2:14.500');

inputOptions(option...): add custom input options

Aliases: inputOption(), addInputOption(), addInputOptions(), withInputOption(), withInputOptions().

-

This method allows passing any input-related option to ffmpeg. You can call it with a single argument to pass a single option, optionnaly with a space-separated parameter:

-
/* Single option */
-ffmpeg('/path/to/file.avi').inputOptions('-someOption');
-
-/* Single option with parameter */
-ffmpeg('/dev/video0').inputOptions('-r 24');

You may also pass multiple options at once by passing an array to the method:

-
ffmpeg('/path/to/file.avi').inputOptions([
-  '-option1',
-  '-option2 param2',
-  '-option3',
-  '-option4 param4'
-]);

Finally, you may also directly pass command line tokens as separate arguments to the method:

-
ffmpeg('/path/to/file.avi').inputOptions(
-  '-option1',
-  '-option2', 'param2',
-  '-option3',
-  '-option4', 'param4'
-);

Audio options

The following methods change the audio stream(s) in the produced output.

-

noAudio(): disable audio altogether

Aliases: withNoAudio().

-

Disables audio in the output and remove any previously set audio option.

-
ffmpeg('/path/to/file.avi').noAudio();

audioCodec(codec): set audio codec

Aliases: withAudioCodec().

-
ffmpeg('/path/to/file.avi').audioCodec('libmp3lame');

Fluent-ffmpeg checks for codec availability before actually running the command, and throws an error when a specified audio codec is not available.

-

audioBitrate(bitrate): set audio bitrate

Aliases: withAudioBitrate().

-

Sets the audio bitrate in kbps. The bitrate parameter may be a number or a string with an optional k suffix. This method is used to enforce a constant bitrate; use audioQuality() to encode using a variable bitrate.

-
ffmpeg('/path/to/file.avi').audioBitrate(128);
-ffmpeg('/path/to/file.avi').audioBitrate('128');
-ffmpeg('/path/to/file.avi').audioBitrate('128k');

audioChannels(count): set audio channel count

Aliases: withAudioChannels().

-
ffmpeg('/path/to/file.avi').audioChannels(2);

audioFrequency(freq): set audio frequency

Aliases: withAudioFrequency().

-

The freq parameter specifies the audio frequency in Hz.

-
ffmpeg('/path/to/file.avi').audioFrequency(22050);

audioQuality(quality): set audio quality

Aliases: withAudioQuality().

-

This method fixes a quality factor for the audio codec (VBR encoding). The quality scale depends on the actual codec used.

-
ffmpeg('/path/to/file.avi')
-  .audioCodec('libmp3lame')
-  .audioQuality(0);

audioFilters(filter...): add custom audio filters

Aliases: audioFilter(), withAudioFilter(), withAudioFilters().

-

This method enables adding custom audio filters. You may add multiple filters at once by passing either several arguments or an array. See the Ffmpeg documentation for available filters and their syntax.

-

Each filter pased to this method can be either a filter string (eg. volume=0.5) or a filter specification object with the following keys:

-
    -
  • filter: filter name
  • -
  • options: optional; either an option string for the filter (eg. n=-50dB:d=5), an options array for unnamed options (eg. ['-50dB', 5]) or an object mapping option names to values (eg. { n: '-50dB', d: 5 }). When options is not specified, the filter will be added without any options.
  • -
-
ffmpeg('/path/to/file.avi')
-  .audioFilters('volume=0.5')
-  .audioFilters('silencedetect=n=-50dB:d=5');
-
-ffmpeg('/path/to/file.avi')
-  .audioFilters('volume=0.5', 'silencedetect=n=-50dB:d=5');
-
-ffmpeg('/path/to/file.avi')
-  .audioFilters(['volume=0.5', 'silencedetect=n=-50dB:d=5']);
-
-ffmpeg('/path/to/file.avi')
-  .audioFilters([
-    {
-      filter: 'volume',
-      options: '0.5'
-    },
-    {
-      filter: 'silencedetect',
-      options: 'n=-50dB:d=5'
-    }
-  ]);
-
-ffmpeg('/path/to/file.avi')
-  .audioFilters(
-    {
-      filter: 'volume',
-      options: ['0.5']
-    },
-    {
-      filter: 'silencedetect',
-      options: { n: '-50dB', d: 5 }
-    }
-  ]);

Video options

The following methods change the video stream(s) in the produced output.

-

noVideo(): disable video altogether

Aliases: withNoVideo().

-

This method disables video output and removes any previously set video option.

-
ffmpeg('/path/to/file.avi').noVideo();

videoCodec(codec): set video codec

Aliases: withVideoCodec().

-
ffmpeg('/path/to/file.avi').videoCodec('libx264');

Fluent-ffmpeg checks for codec availability before actually running the command, and throws an error when a specified video codec is not available.

-

videoBitrate(bitrate[, constant=false]): set video bitrate

Aliases: withVideoBitrate().

-

Sets the target video bitrate in kbps. The bitrate argument may be a number or a string with an optional k suffix. The constant argument specifies whether a constant bitrate should be enforced (defaults to false).

-

Keep in mind that, depending on the codec used, enforcing a constant bitrate often comes at the cost of quality. The best way to have a constant video bitrate without losing too much quality is to use 2-pass encoding (see Fffmpeg documentation).

-
ffmpeg('/path/to/file.avi').videoBitrate(1000);
-ffmpeg('/path/to/file.avi').videoBitrate('1000');
-ffmpeg('/path/to/file.avi').videoBitrate('1000k');
-ffmpeg('/path/to/file.avi').videoBitrate('1000k', true);

videoFilters(filter...): add custom video filters

Aliases: videoFilter(), withVideoFilter(), withVideoFilters().

-

This method enables adding custom video filters. You may add multiple filters at once by passing either several arguments or an array. See the Ffmpeg documentation for available filters and their syntax.

-

Each filter pased to this method can be either a filter string (eg. fade=in:0:30) or a filter specification object with the following keys:

-
    -
  • filter: filter name
  • -
  • options: optional; either an option string for the filter (eg. in:0:30), an options array for unnamed options (eg. ['in', 0, 30]) or an object mapping option names to values (eg. { t: 'in', s: 0, n: 30 }). When options is not specified, the filter will be added without any options.
  • -
-
ffmpeg('/path/to/file.avi')
-  .videoFilters('fade=in:0:30')
-  .videoFilters('pad=640:480:0:40:violet');
-
-ffmpeg('/path/to/file.avi')
-  .videoFilters('fade=in:0:30', 'pad=640:480:0:40:violet');
-
-ffmpeg('/path/to/file.avi')
-  .videoFilters(['fade=in:0:30', 'pad=640:480:0:40:violet']);
-
-ffmpeg('/path/to/file.avi')
-  .videoFilters([
-    {
-      filter: 'fade',
-      options: 'in:0:30'
-    },
-    {
-      filter: 'pad',
-      options: '640:480:0:40:violet'
-    }
-  ]);
-
-ffmpeg('/path/to/file.avi')
-    .videoFilters(
-    {
-      filter: 'fade',
-      options: ['in', 0, 30]
-    },
-    {
-      filter: 'filter2',
-      options: { w: 640, h: 480, x: 0, y: 40, color: 'violet' }
-    }
-  );

fps(fps): set output framerate

Aliases: withOutputFps(), withOutputFPS(), withFpsOutput(), withFPSOutput(), withFps(), withFPS(), outputFPS(), outputFps(), fpsOutput(), FPSOutput(), FPS().

-
ffmpeg('/path/to/file.avi').fps(29.7);

frames(count): specify frame count

Aliases: takeFrames(), withFrames().

-

Set ffmpeg to only encode a certain number of frames.

-
ffmpeg('/path/to/file.avi').frames(240);

Video frame size options

The following methods enable resizing the output video frame size. They all work together to generate the appropriate video filters.

-

size(size): set output frame size

Aliases: videoSize(), withSize().

-

This method sets the output frame size. The size argument may have one of the following formats:

-
    -
  • 640x480: set a fixed output frame size. Unless autopad() is called, this may result in the video being stretched or squeezed to fit the requested size.
  • -
  • 640x?: set a fixed width and compute height automatically. If aspect() is also called, it is used to compute video height; otherwise it is computed so that the input aspect ratio is preserved.
  • -
  • ?x480: set a fixed height and compute width automatically. If aspect() is also called, it is used to compute video width; otherwise it is computed so that the input aspect ratio is preserved.
  • -
  • 50%: rescale both width and height to the given percentage. Aspect ratio is always preserved.
  • -
-

Note that for compatibility with some codecs, computed dimensions are always rounded down to multiples of 2.

-
ffmpeg('/path/to/file.avi').size('640x480');
-ffmpeg('/path/to/file.avi').size('640x?');
-ffmpeg('/path/to/file.avi').size('640x?').aspect('4:3');
-ffmpeg('/path/to/file.avi').size('50%');

aspect(aspect): set output frame aspect ratio

Aliases: withAspect(), withAspectRatio(), setAspect(), setAspectRatio(), aspectRatio().

-

This method enforces a specific output aspect ratio. The aspect argument may either be a number or a X:Y string.

-

Note that calls to aspect() are ignored when size() has been called with a fixed width and height or a percentage, and also when size() has not been called at all.

-
ffmpeg('/path/to/file.avi').size('640x?').aspect('4:3');
-ffmpeg('/path/to/file.avi').size('640x?').aspect(1.33333);

autopad([color='black']): enable auto-padding the output video

Aliases: applyAutopadding(), applyAutoPadding(), applyAutopad(), applyAutoPad(), withAutopadding(), withAutoPadding(), withAutopad(), withAutoPad(), autoPad().

-

This method enables applying auto-padding to the output video. The color parameter specifies which color to use for padding, and must be a color code or name supported by ffmpeg (defaults to 'black').

-

The behaviour of this method depends on calls made to other video size methods:

-
    -
  • when size() has been called with a percentage or has not been called, it is ignored;
  • -
  • when size() has been called with WxH, it adds padding so that the input aspect ratio is kept;
  • -
  • when size() has been called with either Wx? or ?xH, padding is only added if aspect() was called (otherwise the output dimensions are computed from the input aspect ratio and padding is not needed).
  • -
-
// No size specified, autopad() is ignored
-ffmpeg('/path/to/file.avi').autopad();
-
-// Adds padding to keep original aspect ratio.
-// - with a 640x400 input, 40 pixels of padding are added on both sides
-// - with a 600x480 input, 20 pixels of padding are added on top and bottom
-// - with a 320x200 input, video is scaled up to 640x400 and 40px of padding
-//   is added on both sides
-// - with a 320x240 input, video is scaled up to 640x480 and and no padding
-//   is needed
-ffmpeg('/path/to/file.avi').size('640x480').autopad();
-ffmpeg('/path/to/file.avi').size('640x480').autopad('white');
-ffmpeg('/path/to/file.avi').size('640x480').autopad('#35A5FF');
-
-// Size computed from input, autopad() is ignored
-ffmpeg('/path/to/file.avi').size('50%').autopad();
-ffmpeg('/path/to/file.avi').size('640x?').autopad();
-ffmpeg('/path/to/file.avi').size('?x480').autopad();
-
-// Calling .size('640x?').aspect('4:3') is similar to calling .size('640x480')
-// - with a 640x400 input, 40 pixels of padding are added on both sides
-// - with a 600x480 input, 20 pixels of padding are added on top and bottom
-// - with a 320x200 input, video is scaled up to 640x400 and 40px of padding
-//   is added on both sides
-// - with a 320x240 input, video is scaled up to 640x480 and and no padding
-//   is needed
-ffmpeg('/path/to/file.avi').size('640x?').aspect('4:3').autopad();
-ffmpeg('/path/to/file.avi').size('640x?').aspect('4:3').autopad('white');
-ffmpeg('/path/to/file.avi').size('640x?').aspect('4:3').autopad('#35A5FF');
-
-// Calling .size('?x480').aspect('4:3') is similar to calling .size('640x480')
-ffmpeg('/path/to/file.avi').size('?x480').aspect('4:3').autopad();
-ffmpeg('/path/to/file.avi').size('?x480').aspect('4:3').autopad('white');
-ffmpeg('/path/to/file.avi').size('?x480').aspect('4:3').autopad('#35A5FF');

For compatibility with previous fluent-ffmpeg versions, this method also accepts an additional boolean first argument, which specifies whether to apply auto-padding.

-
ffmpeg('/path/to/file.avi').size('640x480').autopad(true);
-ffmpeg('/path/to/file.avi').size('640x480').autopad(true, 'pink');

keepDAR(): force keeping display aspect ratio

Aliases: keepPixelAspect(), keepDisplayAspect(), keepDisplayAspectRatio().

-

This method is useful when converting an input with non-square pixels to an output format that does not support non-square pixels (eg. most image formats). It rescales the input so that the display aspect ratio is the same.

-
ffmpeg('/path/to/file.avi').keepDAR();

Specifying multiple outputs

output(target[, options]): add an output to the command

Aliases: addOutput().

-

Adds an output to the command. The target argument may be an output filename or a writable stream (but at most one output stream may be used with a single command).

-

When target is a stream, an additional options object may be passed. If it is present, it will be passed ffmpeg output stream pipe() method.

-

Adding an output switches the "current output" of the command, so that any fluent-ffmpeg method that applies to an output is indeed applied to the last output added. For backwards compatibility reasons, you may as well call those methods before adding the first output (in which case they will apply to the first output when it is added). Methods that apply to an output are all non-input-related methods, except for complexFilter(), which is global.

-

Also note that when calling output(), you should not use the save() or stream() (formerly saveToFile() and writeToStream()) methods, as they already add an output. Use the run() method to start processing.

-
var stream  = fs.createWriteStream('outputfile.divx');
-
-ffmpeg('/path/to/file.avi')
-  .output('outputfile.mp4')
-  .output(stream);
-
-ffmpeg('/path/to/file.avi')
-  // You may pass a pipe() options object when using a stream
-  .output(stream, { end:true });
-
-// Output-related methods apply to the last output added
-ffmpeg('/path/to/file.avi')
-
-  .output('outputfile.mp4')
-  .audioCodec('libfaac')
-  .videoCodec('libx264')
-  .size('320x200')
-
-  .output(stream)
-  .preset('divx')
-  .size('640x480');
-
-// Use the run() method to run commands with multiple outputs
-ffmpeg('/path/to/file.avi')
-  .output('outputfile.mp4')
-  .output(stream)
-  .on('end', function() {
-    console.log('Finished processing');
-  })
-  .run();

Output options

duration(time): set output duration

Aliases: withDuration(), setDuration().

-

Forces ffmpeg to stop transcoding after a specific output duration. The time parameter may be a number (in seconds) or a timestamp string (with format [[hh:]mm:]ss[.xxx]).

-
ffmpeg('/path/to/file.avi').duration(134.5);
-ffmpeg('/path/to/file.avi').duration('2:14.500');

seek(time): seek output

Aliases: seekOutput().

-

Seeks streams before encoding them into the output. This is different from calling seekInput() in that the offset will only apply to one output. This is also slower, as skipped frames will still be decoded (but dropped).

-

The time argument may be a number (in seconds) or a timestamp string (with format [[hh:]mm:]ss[.xxx]).

-
ffmpeg('/path/to/file.avi')
-  .seekInput('1:00')
-
-  .output('from-1m30s.avi')
-  .seek(30)
-
-  .output('from-1m40s.avi')
-  .seek('0:40');

format(format): set output format

Aliases: withOutputFormat(), toFormat(), outputFormat().

-
ffmpeg('/path/to/file.avi').format('flv');

flvmeta(): update FLV metadata after transcoding

Aliases: updateFlvMetadata().

-

Calling this method makes fluent-ffmpeg run flvmeta or flvtool2 on the output file to add FLV metadata and make files streamable. It does not work when outputting to a stream, and is only useful when outputting to FLV format.

-
ffmpeg('/path/to/file.avi').flvmeta().format('flv');

outputOptions(option...): add custom output options

Aliases: outputOption(), addOutputOption(), addOutputOptions(), withOutputOption(), withOutputOptions(), addOption(), addOptions().

-

This method allows passing any output-related option to ffmpeg. You can call it with a single argument to pass a single option, optionnaly with a space-separated parameter:

-
/* Single option */
-ffmpeg('/path/to/file.avi').outputOptions('-someOption');
-
-/* Single option with parameter */
-ffmpeg('/dev/video0').outputOptions('-r 24');

You may also pass multiple options at once by passing an array to the method:

-
ffmpeg('/path/to/file.avi').outputOptions([
-  '-option1',
-  '-option2 param2',
-  '-option3',
-  '-option4 param4'
-]);

Finally, you may also directly pass command line tokens as separate arguments to the method:

-
ffmpeg('/path/to/file.avi').outputOptions(
-  '-option1',
-  '-option2', 'param2',
-  '-option3',
-  '-option4', 'param4'
-);

Miscellaneous options

preset(preset): use fluent-ffmpeg preset

Aliases: usingPreset().

-

There are two kinds of presets supported by fluent-ffmpeg. The first one is preset modules; to use those, pass the preset name as the preset argument. Preset modules are loaded from the directory specified by the presets constructor option (defaults to the lib/presets fluent-ffmpeg subdirectory).

-
// Uses <path-to-fluent-ffmpeg>/lib/presets/divx.js
-ffmpeg('/path/to/file.avi').preset('divx');
-
-// Uses /my/presets/foo.js
-ffmpeg('/path/to/file.avi', { presets: '/my/presets' }).preset('foo');

Preset modules must export a load() function that takes an FfmpegCommand as an argument. fluent-ffmpeg comes with the following preset modules preinstalled:

-
    -
  • divx
  • -
  • flashvideo
  • -
  • podcast
  • -
-

Here is the code from the included divx preset as an example:

-
exports.load = function(ffmpeg) {
-  ffmpeg
-    .format('avi')
-    .videoBitrate('1024k')
-    .videoCodec('mpeg4')
-    .size('720x?')
-    .audioBitrate('128k')
-    .audioChannels(2)
-    .audioCodec('libmp3lame')
-    .outputOptions(['-vtag DIVX']);
-};

The second kind of preset is preset functions. To use those, pass a function which takes an FfmpegCommand as a parameter.

-
function myPreset(command) {
-  command.format('avi').size('720x?');
-}
-
-ffmpeg('/path/to/file.avi').preset(myPreset);

complexFilter(filters[, map]): set complex filtergraph

Aliases: filterGraph()

-

The complexFilter() method enables setting a complex filtergraph for a command. It expects a filter specification (or a filter specification array) and an optional output mapping parameter as arguments.

-

Filter specifications may be either plain ffmpeg filter strings (eg. split=3[a][b][c]) or objects with the following keys:

-
    -
  • filter: filter name
  • -
  • options: optional; either an option string for the filter (eg. in:0:30), an options array for unnamed options (eg. ['in', 0, 30]) or an object mapping option names to values (eg. { t: 'in', s: 0, n: 30 }). When options is not specified, the filter will be added without any options.
  • -
  • inputs: optional; input stream specifier(s) for the filter. The value may be either a single stream specifier string or an array of stream specifiers. Each specifier can be optionally enclosed in square brackets. When input streams are not specified, ffmpeg will use the first unused streams of the correct type.
  • -
  • outputs: optional; output stream specifier(s) for the filter. The value may be either a single stream specifier string or an array of stream specifiers. Each specifier can be optionally enclosed in square brackets.
  • -
-

The output mapping parameter specifies which stream(s) to include in the output from the filtergraph. It may be either a single stream specifier string or an array of stream specifiers. Each specifier can be optionally enclosed in square brackets. When this parameter is not present, ffmpeg will default to saving all unused outputs to the output file.

-

Note that only one complex filtergraph may be set on a given command. Calling complexFilter() again will override any previously set filtergraph, but you can set as many filters as needed in a single call.

-
ffmpeg('/path/to/file.avi')
-  .complexFilter([
-    // Rescale input stream into stream 'rescaled'
-    'scale=640:480[rescaled]',
-
-    // Duplicate rescaled stream 3 times into streams a, b, and c
-    {
-      filter: 'split', options: '3',
-      inputs: 'rescaled', outputs: ['a', 'b', 'c']
-    },
-
-    // Create stream 'red' by removing green and blue channels from stream 'a'
-    {
-      filter: 'lutrgb', options: { g: 0, b: 0 },
-      inputs: 'a', outputs: 'red'
-    },
-
-    // Create stream 'green' by removing red and blue channels from stream 'b'
-    {
-      filter: 'lutrgb', options: { r: 0, b: 0 },
-      inputs: 'b', outputs: 'green'
-    },
-
-    // Create stream 'blue' by removing red and green channels from stream 'c'
-    {
-      filter: 'lutrgb', options: { r: 0, g: 0 },
-      inputs: 'c', outputs: 'blue'
-    },
-
-    // Pad stream 'red' to 3x width, keeping the video on the left,
-    // and name output 'padded'
-    {
-      filter: 'pad', options: { w: 'iw*3', h: 'ih' },
-      inputs: 'red', outputs: 'padded'
-    },
-
-    // Overlay 'green' onto 'padded', moving it to the center,
-    // and name output 'redgreen'
-    {
-      filter: 'overlay', options: { x: 'w', y: 0 },
-      inputs: ['padded', 'green'], outputs: 'redgreen'
-    },
-
-    // Overlay 'blue' onto 'redgreen', moving it to the right
-    {
-      filter: 'overlay', options: { x: '2*w', y: 0 },
-      inputs: ['redgreen', 'blue'], outputs: 'output'
-    },
-  ], 'output');

Setting event handlers

Before actually running a command, you may want to set event listeners on it to be notified when it's done. The following events are available:

-

'start': ffmpeg process started

The start event is emitted just after ffmpeg has been spawned. It is emitted with the full command line used as an argument.

-
ffmpeg('/path/to/file.avi')
-  .on('start', function(commandLine) {
-    console.log('Spawned Ffmpeg with command: ' + commandLine);
-  });

'codecData': input codec data available

The codecData event is emitted when ffmpeg outputs codec information about its input streams. It is emitted with an object argument with the following keys:

-
    -
  • format: input format
  • -
  • duration: input duration
  • -
  • audio: audio codec
  • -
  • audio_details: audio encoding details
  • -
  • video: video codec
  • -
  • video_details: video encoding details
  • -
-
ffmpeg('/path/to/file.avi')
-  .on('codecData', function(data) {
-    console.log('Input is ' + data.audio + ' audio ' +
-      'with ' + data.video + ' video');
-  });

'progress': transcoding progress information

The progress event is emitted every time ffmpeg reports progress information. It is emitted with an object argument with the following keys:

-
    -
  • frames: total processed frame count
  • -
  • currentFps: framerate at which FFmpeg is currently processing
  • -
  • currentKbps: throughput at which FFmpeg is currently processing
  • -
  • targetSize: current size of the target file in kilobytes
  • -
  • timemark: the timestamp of the current frame in seconds
  • -
  • percent: an estimation of the progress percentage
  • -
-

Note that percent can be (very) inaccurate, as the only progress information fluent-ffmpeg gets from ffmpeg is the total number of frames written (and the corresponding duration). To estimate percentage, fluent-ffmpeg has to guess what the total output duration will be, and uses the first input added to the command to do so. In particular:

-
    -
  • percentage is not available when using an input stream
  • -
  • percentage may be wrong when using multiple inputs with different durations and the first one is not the longest
  • -
-
ffmpeg('/path/to/file.avi')
-  .on('progress', function(progress) {
-    console.log('Processing: ' + progress.percent + '% done');
-  });

'stderr': FFmpeg output

The stderr event is emitted every time FFmpeg outputs a line to stderr. It is emitted with a string containing the line of stderr (minus trailing new line characters).

-
ffmpeg('/path/to/file.avi')
-  .on('stderr', function(stderrLine) {
-    console.log('Stderr output: ' + stderrLine);
-  });

'error': transcoding error

The error event is emitted when an error occurs when running ffmpeg or when preparing its execution. It is emitted with an error object as an argument. If the error happened during ffmpeg execution, listeners will also receive two additional arguments containing ffmpegs stdout and stderr.

-

Warning: you should always set a handler for the error event, as node's default behaviour when an error event without any listeners is emitted is to output the error to the console and terminate the program.

-
ffmpeg('/path/to/file.avi')
-  .on('error', function(err, stdout, stderr) {
-    console.log('Cannot process video: ' + err.message);
-  });

'end': processing finished

The end event is emitted when processing has finished. Listeners receive ffmpeg standard output and standard error as arguments, except when generating thumbnails (see below), in which case they receive an array of the generated filenames.

-
ffmpeg('/path/to/file.avi')
-  .on('end', function(stdout, stderr) {
-    console.log('Transcoding succeeded !');
-  });

stdout is empty when the command outputs to a stream. Both stdout and stderr are limited by the stdoutLines option (defaults to 100 lines).

-

Starting FFmpeg processing

save(filename): save the output to a file

Aliases: saveToFile()

-

Starts ffmpeg processing and saves the output to a file.

-
ffmpeg('/path/to/file.avi')
-  .videoCodec('libx264')
-  .audioCodec('libmp3lame')
-  .size('320x240')
-  .on('error', function(err) {
-    console.log('An error occurred: ' + err.message);
-  })
-  .on('end', function() {
-    console.log('Processing finished !');
-  })
-  .save('/path/to/output.mp4');

Note: the save() method is actually syntactic sugar for calling both output() and run().

-

pipe([stream], [options]): pipe the output to a writable stream

Aliases: stream(), writeToStream().

-

Starts processing and pipes ffmpeg output to a writable stream. The options argument, if present, is passed to ffmpeg output stream's pipe() method (see nodejs documentation).

-
var outStream = fs.createWriteStream('/path/to/output.mp4');
-
-ffmpeg('/path/to/file.avi')
-  .videoCodec('libx264')
-  .audioCodec('libmp3lame')
-  .size('320x240')
-  .on('error', function(err) {
-    console.log('An error occurred: ' + err.message);
-  })
-  .on('end', function() {
-    console.log('Processing finished !');
-  })
-  .pipe(outStream, { end: true });

When no stream argument is present, the pipe() method returns a PassThrough stream, which you can pipe to somewhere else (or just listen to events on).

-

Note: this is only available with node >= 0.10.

-
var command = ffmpeg('/path/to/file.avi')
-  .videoCodec('libx264')
-  .audioCodec('libmp3lame')
-  .size('320x240')
-  .on('error', function(err) {
-    console.log('An error occurred: ' + err.message);
-  })
-  .on('end', function() {
-    console.log('Processing finished !');
-  });
-
-var ffstream = command.pipe();
-ffstream.on('data', function(chunk) {
-  console.log('ffmpeg just wrote ' + chunk.length + ' bytes');
-});

Note: the stream() method is actually syntactic sugar for calling both output() and run().

-

run(): start processing

Aliases: exec(), execute().

-

This method is mainly useful when producing multiple outputs (otherwise the save() or stream() methods are more straightforward). It starts processing with the specified outputs.

-

Warning: do not use run() when calling other processing methods (eg. save(), pipe() or screenshots()).

-
ffmpeg('/path/to/file.avi')
-  .output('screenshot.png')
-  .noAudio()
-  .seek('3:00')
-
-  .output('small.avi')
-  .audioCodec('copy')
-  .size('320x200')
-
-  .output('big.avi')
-  .audioCodec('copy')
-  .size('640x480')
-
-  .on('error', function(err) {
-    console.log('An error occurred: ' + err.message);
-  })
-  .on('end', function() {
-    console.log('Processing finished !');
-  })
-  .run();

mergeToFile(filename, tmpdir): concatenate multiple inputs

Use the input and mergeToFile methods on a command to concatenate multiple inputs to a single output file. The mergeToFile needs a temporary folder as its second argument.

-
ffmpeg('/path/to/part1.avi')
-  .input('/path/to/part2.avi')
-  .input('/path/to/part2.avi')
-  .on('error', function(err) {
-    console.log('An error occurred: ' + err.message);
-  })
-  .on('end', function() {
-    console.log('Merging finished !');
-  })
-  .mergeToFile('/path/to/merged.avi', '/path/to/tempDir');

screenshots(options[, dirname]): generate thumbnails

Aliases: thumbnail(), thumbnails(), screenshot(), takeScreenshots().

-

Use the screenshots method to extract one or several thumbnails and save them as PNG files. There are a few caveats with this implementation, though:

-
    -
  • It will not work on input streams.
  • -
  • Progress information reported by the progress event is not accurate.
  • -
  • It doesn't interract well with filters. In particular, don't use the size() method to resize thumbnails, use the size option instead.
  • -
-

The options argument is an object with the following keys:

-
    -
  • folder: output folder for generated image files. Defaults to the current folder.
  • -
  • filename: output filename pattern (see below). Defaults to "tn.png".
  • -
  • count: specifies how many thumbnails to generate. When using this option, thumbnails are generated at regular intervals in the video (for example, when requesting 3 thumbnails, at 25%, 50% and 75% of the video length). count is ignored when timemarks or timestamps is specified.
  • -
  • timemarks or timestamps: specifies an array of timestamps in the video where thumbnails should be taken. Each timestamp may be a number (in seconds), a percentage string (eg. "50%") or a timestamp string with format "hh:mm:ss.xxx" (where hours, minutes and milliseconds are both optional).
  • -
  • size: specifies a target size for thumbnails (with the same format as the .size() method). Note: you should not use the .size() method when generating thumbnails.
  • -
-

The filename option specifies a filename pattern for generated files. It may contain the following format tokens:

-
    -
  • '%s': offset in seconds
  • -
  • '%w': screenshot width
  • -
  • '%h': screenshot height
  • -
  • '%r': screenshot resolution (same as '%wx%h')
  • -
  • '%f': input filename
  • -
  • '%b': input basename (filename w/o extension)
  • -
  • '%i': index of screenshot in timemark array (can be zero-padded by using it like %000i)
  • -
-

If multiple timemarks are passed and no variable format token ('%s' or '%i') is specified in the filename pattern, _%i will be added automatically.

-

When generating thumbnails, an additional filenames event is dispatched with an array of generated filenames as an argument.

-
ffmpeg('/path/to/video.avi')
-  .on('filenames', function(filenames) {
-    console.log('Will generate ' + filenames.join(', '))
-  })
-  .on('end', function() {
-    console.log('Screenshots taken');
-  })
-  .screenshots({
-    // Will take screens at 20%, 40%, 60% and 80% of the video
-    count: 4,
-    folder: '/path/to/output'
-  });
-
-ffmpeg('/path/to/video.avi')
-  .screenshots({
-    timestamps: [30.5, '50%', '01:10.123'],
-    filename: 'thumbnail-at-%s-seconds.png',
-    folder: '/path/to/output',
-    size: '320x240'
-  });

Controlling the FFmpeg process

kill([signal='SIGKILL']): kill any running ffmpeg process

This method sends signal (defaults to 'SIGKILL') to the ffmpeg process. It only has sense when processing has started. Sending a signal that terminates the process will result in the error event being emitted.

-
var command = ffmpeg('/path/to/video.avi')
-  .videoCodec('libx264')
-  .audioCodec('libmp3lame')
-  .on('start', function() {
-    // Send SIGSTOP to suspend ffmpeg
-    command.kill('SIGSTOP');
-
-    doSomething(function() {
-      // Send SIGCONT to resume ffmpeg
-      command.kill('SIGCONT');
-    });
-  })
-  .save('/path/to/output.mp4');
-
-// Kill ffmpeg after 60 seconds anyway
-setTimeout(function() {
-  command.on('error', function() {
-    console.log('Ffmpeg has been killed');
-  });
-
-  command.kill();
-}, 60000);

renice([niceness=0]): change ffmpeg process priority

This method alters the niceness (priority) value of any running ffmpeg process (if any) and any process spawned in the future. The niceness parameter may range from -20 (highest priority) to 20 (lowest priority) and defaults to 0 (which is the default process niceness on most *nix systems).

-

Note: this method is ineffective on Windows platforms.

-
// Set startup niceness
-var command = ffmpeg('/path/to/file.avi')
-  .renice(5)
-  .save('/path/to/output.mp4');
-
-// Command takes too long, raise its priority
-setTimeout(function() {
-  command.renice(-5);
-}, 60000);

Reading video metadata

You can read metadata from any valid ffmpeg input file with the modules ffprobe method.

-
ffmpeg.ffprobe('/path/to/file.avi', function(err, metadata) {
-    console.dir(metadata);
-});

You may also call the ffprobe method on an FfmpegCommand to probe one of its input. You may pass a 0-based input number as a first argument to specify which input to read metadata from, otherwise the method will probe the last added input.

-
ffmpeg('/path/to/file1.avi')
-  .input('/path/to/file2.avi')
-  .ffprobe(function(err, data) {
-    console.log('file2 metadata:');
-    console.dir(data);
-  });
-
-ffmpeg('/path/to/file1.avi')
-  .input('/path/to/file2.avi')
-  .ffprobe(0, function(err, data) {
-    console.log('file1 metadata:');
-    console.dir(data);
-  });

Warning: ffprobe may be called with an input stream, but in this case it will consume data from the stream, and this data will no longer be available for ffmpeg. Using both ffprobe and a transcoding command on the same input stream will most likely fail unless the stream is a live stream. Only do this if you know what you're doing.

-

The returned object is the same that is returned by running the following command from your shell (depending on your ffmpeg version you may have to replace -of with -print_format) :

-
$ ffprobe -of json -show_streams -show_format /path/to/file.avi

It will contain information about the container (as a format key) and an array of streams (as a stream key). The format object and each stream object also contains metadata tags, depending on the format:

-
{
-  "streams": [
-    {
-      "index": 0,
-      "codec_name": "h264",
-      "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
-      "profile": "Constrained Baseline",
-      "codec_type": "video",
-      "codec_time_base": "1/48",
-      "codec_tag_string": "avc1",
-      "codec_tag": "0x31637661",
-      "width": 320,
-      "height": 180,
-      "has_b_frames": 0,
-      "sample_aspect_ratio": "1:1",
-      "display_aspect_ratio": "16:9",
-      "pix_fmt": "yuv420p",
-      "level": 13,
-      "r_frame_rate": "24/1",
-      "avg_frame_rate": "24/1",
-      "time_base": "1/24",
-      "start_pts": 0,
-      "start_time": "0.000000",
-      "duration_ts": 14315,
-      "duration": "596.458333",
-      "bit_rate": "702655",
-      "nb_frames": "14315",
-      "disposition": {
-        "default": 0,
-        "dub": 0,
-        "original": 0,
-        "comment": 0,
-        "lyrics": 0,
-        "karaoke": 0,
-        "forced": 0,
-        "hearing_impaired": 0,
-        "visual_impaired": 0,
-        "clean_effects": 0,
-        "attached_pic": 0
-      },
-      "tags": {
-        "creation_time": "1970-01-01 00:00:00",
-        "language": "und",
-        "handler_name": "\fVideoHandler"
-      }
-    },
-    {
-      "index": 1,
-      "codec_name": "aac",
-      "codec_long_name": "AAC (Advanced Audio Coding)",
-      "codec_type": "audio",
-      "codec_time_base": "1/48000",
-      "codec_tag_string": "mp4a",
-      "codec_tag": "0x6134706d",
-      "sample_fmt": "fltp",
-      "sample_rate": "48000",
-      "channels": 2,
-      "bits_per_sample": 0,
-      "r_frame_rate": "0/0",
-      "avg_frame_rate": "0/0",
-      "time_base": "1/48000",
-      "start_pts": 0,
-      "start_time": "0.000000",
-      "duration_ts": 28619776,
-      "duration": "596.245333",
-      "bit_rate": "159997",
-      "nb_frames": "27949",
-      "disposition": {
-        "default": 0,
-        "dub": 0,
-        "original": 0,
-        "comment": 0,
-        "lyrics": 0,
-        "karaoke": 0,
-        "forced": 0,
-        "hearing_impaired": 0,
-        "visual_impaired": 0,
-        "clean_effects": 0,
-        "attached_pic": 0
-      },
-      "tags": {
-        "creation_time": "1970-01-01 00:00:00",
-        "language": "und",
-        "handler_name": "\fSoundHandler"
-      }
-    }
-  ],
-  "format": {
-    "filename": "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4",
-    "nb_streams": 2,
-    "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
-    "format_long_name": "QuickTime / MOV",
-    "start_time": "0.000000",
-    "duration": "596.459000",
-    "size": "64657027",
-    "bit_rate": "867211",
-    "tags": {
-      "major_brand": "isom",
-      "minor_version": "512",
-      "compatible_brands": "mp41",
-      "creation_time": "1970-01-01 00:00:00",
-      "title": "Big Buck Bunny",
-      "artist": "Blender Foundation",
-      "composer": "Blender Foundation",
-      "date": "2008",
-      "encoder": "Lavf52.14.0"
-    }
-  }
-}

Querying ffmpeg capabilities

fluent-ffmpeg enables you to query your installed ffmpeg version for supported formats, codecs, encoders and filters.

-

-var Ffmpeg = require('fluent-ffmpeg');
-
-Ffmpeg.getAvailableFormats(function(err, formats) {
-  console.log('Available formats:');
-  console.dir(formats);
-});
-
-Ffmpeg.getAvailableCodecs(function(err, codecs) {
-  console.log('Available codecs:');
-  console.dir(codecs);
-});
-
-Ffmpeg.getAvailableEncoders(function(err, encoders) {
-  console.log('Available encoders:');
-  console.dir(encoders);
-});
-
-Ffmpeg.getAvailableFilters(function(err, filters) {
-  console.log("Available filters:");
-  console.dir(filters);
-});
-
-// Those methods can also be called on commands
-new Ffmpeg({ source: '/path/to/file.avi' })
-  .getAvailableCodecs(...);

These methods pass an object to their callback with keys for each available format, codec or filter.

-

The returned object for formats looks like:

-
{
-  ...
-  mp4: {
-    description: 'MP4 (MPEG-4 Part 14)',
-    canDemux: false,
-    canMux: true
-  },
-  ...
-}
    -
  • canDemux indicates whether ffmpeg is able to extract streams from (demux) this format
  • -
  • canMux indicates whether ffmpeg is able to write streams into (mux) this format
  • -
-

The returned object for codecs looks like:

-
{
-  ...
-  mp3: {
-    type: 'audio',
-    description: 'MP3 (MPEG audio layer 3)',
-    canDecode: true,
-    canEncode: true,
-    intraFrameOnly: false,
-    isLossy: true,
-    isLossless: false
-  },
-  ...
-}
    -
  • type indicates the codec type, either "audio", "video" or "subtitle"
  • -
  • canDecode tells whether ffmpeg is able to decode streams using this codec
  • -
  • canEncode tells whether ffmpeg is able to encode streams using this codec
  • -
-

Depending on your ffmpeg version (or if you use avconv instead) other keys may be present, for example:

-
    -
  • directRendering tells if codec can render directly in GPU RAM; useless for transcoding purposes
  • -
  • intraFrameOnly tells if codec can only work with I-frames
  • -
  • isLossy tells if codec can do lossy encoding/decoding
  • -
  • isLossless tells if codec can do lossless encoding/decoding
  • -
-

With some ffmpeg/avcodec versions, the description includes encoder/decoder mentions in the form "Foo codec (decoders: libdecodefoo) (encoders: libencodefoo)". In this case you will want to use those encoders/decoders instead (the codecs object returned by getAvailableCodecs will also include them).

-

The returned object for encoders looks like:

-
{
-  ...
-  libmp3lame: {
-    type: 'audio',
-    description: 'MP3 (MPEG audio layer 3) (codec mp3)',
-    frameMT: false,
-    sliceMT: false,
-    experimental: false,
-    drawHorizBand: false,
-    directRendering: false
-  },
-  ...
-}
    -
  • type indicates the encoder type, either "audio", "video" or "subtitle"
  • -
  • experimental indicates whether the encoder is experimental. When using such a codec, fluent-ffmpeg automatically adds the '-strict experimental' flag.
  • -
-

The returned object for filters looks like:

-
{
-  ...
-  scale: {
-    description: 'Scale the input video to width:height size and/or convert the image format.',
-    input: 'video',
-    multipleInputs: false,
-    output: 'video',
-    multipleOutputs: false
-  },
-  ...
-}
    -
  • input tells the input type this filter operates on, one of "audio", "video" or "none". When "none", the filter likely generates output from nothing
  • -
  • multipleInputs tells whether the filter can accept multiple inputs
  • -
  • output tells the output type this filter generates, one of "audio", "video" or "none". When "none", the filter has no output (sink only)
  • -
  • multipleInputs tells whether the filter can generate multiple outputs
  • -
-

Cloning an FfmpegCommand

You can create clones of an FfmpegCommand instance by calling the clone() method. The clone will be an exact copy of the original at the time it has been called (same inputs, same options, same event handlers, etc.). This is mainly useful when you want to apply different processing options on the same input.

-

Setting options, adding inputs or event handlers on a clone will not affect the original command.

-
// Create a command to convert source.avi to MP4
-var command = ffmpeg('/path/to/source.avi')
-  .audioCodec('libfaac')
-  .videoCodec('libx264')
-  .format('mp4');
-
-// Create a clone to save a small resized version
-command.clone()
-  .size('320x200')
-  .save('/path/to/output-small.mp4');
-
-// Create a clone to save a medium resized version
-command.clone()
-  .size('640x400')
-  .save('/path/to/output-medium.mp4');
-
-// Save a converted version with the original size
-command.save('/path/to/output-original-size.mp4');

Contributing

Contributions in any form are highly encouraged and welcome! Be it new or improved presets, optimized streaming code or just some cleanup. So start forking!

-

Code contributions

If you want to add new features or change the API, please submit an issue first to make sure no one else is already working on the same thing and discuss the implementation and API details with maintainers and users by creating an issue. When everything is settled down, you can submit a pull request.

-

When fixing bugs, you can directly submit a pull request.

-

Make sure to add tests for your features and bugfixes and update the documentation (see below) before submitting your code!

-

Documentation contributions

You can directly submit pull requests for documentation changes. Make sure to regenerate the documentation before submitting (see below).

-

Updating the documentation

When contributing API changes (new methods for example), be sure to update the README file and JSDoc comments in the code. fluent-ffmpeg comes with a plugin that enables two additional JSDoc tags:

-
    -
  • @aliases: document method aliases
  • -
-
/**
- * ...
- * @method FfmpegCommand#myMethod
- * @aliases myMethodAlias,myOtherMethodAlias
- */
    -
  • @category: set method category
  • -
-
/**
- * ...
- * @category Audio
- */

You can regenerate the JSDoc documentation by running the following command:

-
$ make doc

To avoid polluting the commit history, make sure to only commit the regenerated JSDoc once and in a specific commit.

-

Running tests

To run unit tests, first make sure you installed npm dependencies (run npm install).

-
$ make test

If you want to re-generate the test coverage report (filed under test/coverage.html), run

-
$ make test-cov

Make sure your ffmpeg installation is up-to-date to prevent strange assertion errors because of missing codecs/bugfixes.

-

Main contributors

-

License

(The MIT License)

-

Copyright (c) 2011 Stefan Schaermeli <schaermu@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.

-
- - - - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/doc/inputs.js.html b/doc/inputs.js.html deleted file mode 100644 index e5d2cf76..00000000 --- a/doc/inputs.js.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - - JSDoc: Source: options/inputs.js - - - - - - - - - - -
- -

Source: options/inputs.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-var utils = require('../utils');
-
-/*
- *! Input-related methods
- */
-
-module.exports = function(proto) {
-  /**
-   * Add an input to command
-   *
-   * Also switches "current input", that is the input that will be affected
-   * by subsequent input-related methods.
-   *
-   * Note: only one stream input is supported for now.
-   *
-   * @method FfmpegCommand#input
-   * @category Input
-   * @aliases mergeAdd,addInput
-   *
-   * @param {String|Readable} source input file path or readable stream
-   * @return FfmpegCommand
-   */
-  proto.mergeAdd =
-  proto.addInput =
-  proto.input = function(source) {
-    var isFile = false;
-
-    if (typeof source !== 'string') {
-      if (!('readable' in source) || !(source.readable)) {
-        throw new Error('Invalid input');
-      }
-
-      var hasInputStream = this._inputs.some(function(input) {
-        return typeof input.source !== 'string';
-      });
-
-      if (hasInputStream) {
-        throw new Error('Only one input stream is supported');
-      }
-
-      source.pause();
-    } else {
-      var protocol = source.match(/^([a-z]{2,}):/i);
-      isFile = !protocol || protocol[0] === 'file';
-    }
-
-    this._inputs.push(this._currentInput = {
-      source: source,
-      isFile: isFile,
-      options: utils.args()
-    });
-
-    return this;
-  };
-
-
-  /**
-   * Specify input format for the last specified input
-   *
-   * @method FfmpegCommand#inputFormat
-   * @category Input
-   * @aliases withInputFormat,fromFormat
-   *
-   * @param {String} format input format
-   * @return FfmpegCommand
-   */
-  proto.withInputFormat =
-  proto.inputFormat =
-  proto.fromFormat = function(format) {
-    if (!this._currentInput) {
-      throw new Error('No input specified');
-    }
-
-    this._currentInput.options('-f', format);
-    return this;
-  };
-
-
-  /**
-   * Specify input FPS for the last specified input
-   * (only valid for raw video formats)
-   *
-   * @method FfmpegCommand#inputFps
-   * @category Input
-   * @aliases withInputFps,withInputFPS,withFpsInput,withFPSInput,inputFPS,inputFps,fpsInput
-   *
-   * @param {Number} fps input FPS
-   * @return FfmpegCommand
-   */
-  proto.withInputFps =
-  proto.withInputFPS =
-  proto.withFpsInput =
-  proto.withFPSInput =
-  proto.inputFPS =
-  proto.inputFps =
-  proto.fpsInput =
-  proto.FPSInput = function(fps) {
-    if (!this._currentInput) {
-      throw new Error('No input specified');
-    }
-
-    this._currentInput.options('-r', fps);
-    return this;
-  };
-
-
-  /**
-   * Use native framerate for the last specified input
-   *
-   * @method FfmpegCommand#native
-   * @category Input
-   * @aliases nativeFramerate,withNativeFramerate
-   *
-   * @return FfmmegCommand
-   */
-  proto.nativeFramerate =
-  proto.withNativeFramerate =
-  proto.native = function() {
-    if (!this._currentInput) {
-      throw new Error('No input specified');
-    }
-
-    this._currentInput.options('-re');
-    return this;
-  };
-
-
-  /**
-   * Specify input seek time for the last specified input
-   *
-   * @method FfmpegCommand#seekInput
-   * @category Input
-   * @aliases setStartTime,seekTo
-   *
-   * @param {String|Number} seek seek time in seconds or as a '[hh:[mm:]]ss[.xxx]' string
-   * @return FfmpegCommand
-   */
-  proto.setStartTime =
-  proto.seekInput = function(seek) {
-    if (!this._currentInput) {
-      throw new Error('No input specified');
-    }
-
-    this._currentInput.options('-ss', seek);
-
-    return this;
-  };
-
-
-  /**
-   * Loop over the last specified input
-   *
-   * @method FfmpegCommand#loop
-   * @category Input
-   *
-   * @param {String|Number} [duration] loop duration in seconds or as a '[[hh:]mm:]ss[.xxx]' string
-   * @return FfmpegCommand
-   */
-  proto.loop = function(duration) {
-    if (!this._currentInput) {
-      throw new Error('No input specified');
-    }
-
-    this._currentInput.options('-loop', '1');
-
-    if (typeof duration !== 'undefined') {
-      this.duration(duration);
-    }
-
-    return this;
-  };
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/doc/misc.js.html b/doc/misc.js.html deleted file mode 100644 index 6d0b7a30..00000000 --- a/doc/misc.js.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - JSDoc: Source: options/misc.js - - - - - - - - - - -
- -

Source: options/misc.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-var path = require('path');
-
-/*
- *! Miscellaneous methods
- */
-
-module.exports = function(proto) {
-  /**
-   * Use preset
-   *
-   * @method FfmpegCommand#preset
-   * @category Miscellaneous
-   * @aliases usingPreset
-   *
-   * @param {String|Function} preset preset name or preset function
-   */
-  proto.usingPreset =
-  proto.preset = function(preset) {
-    if (typeof preset === 'function') {
-      preset(this);
-    } else {
-      try {
-        var modulePath = path.join(this.options.presets, preset);
-        var module = require(modulePath);
-
-        if (typeof module.load === 'function') {
-          module.load(this);
-        } else {
-          throw new Error('preset ' + modulePath + ' has no load() function');
-        }
-      } catch (err) {
-        throw new Error('preset ' + modulePath + ' could not be loaded: ' + err.message);
-      }
-    }
-
-    return this;
-  };
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/doc/options_audio.js.html b/doc/options_audio.js.html deleted file mode 100644 index 7a1681d7..00000000 --- a/doc/options_audio.js.html +++ /dev/null @@ -1,228 +0,0 @@ - - - - - JSDoc: Source: options/audio.js - - - - - - - - - - -
- -

Source: options/audio.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-var utils = require('../utils');
-
-
-/*
- *! Audio-related methods
- */
-
-module.exports = function(proto) {
-  /**
-   * Disable audio in the output
-   *
-   * @method FfmpegCommand#noAudio
-   * @category Audio
-   * @aliases withNoAudio
-   * @return FfmpegCommand
-   */
-  proto.withNoAudio =
-  proto.noAudio = function() {
-    this._currentOutput.audio.clear();
-    this._currentOutput.audioFilters.clear();
-    this._currentOutput.audio('-an');
-
-    return this;
-  };
-
-
-  /**
-   * Specify audio codec
-   *
-   * @method FfmpegCommand#audioCodec
-   * @category Audio
-   * @aliases withAudioCodec
-   *
-   * @param {String} codec audio codec name
-   * @return FfmpegCommand
-   */
-  proto.withAudioCodec =
-  proto.audioCodec = function(codec) {
-    this._currentOutput.audio('-acodec', codec);
-
-    return this;
-  };
-
-
-  /**
-   * Specify audio bitrate
-   *
-   * @method FfmpegCommand#audioBitrate
-   * @category Audio
-   * @aliases withAudioBitrate
-   *
-   * @param {String|Number} bitrate audio bitrate in kbps (with an optional 'k' suffix)
-   * @return FfmpegCommand
-   */
-  proto.withAudioBitrate =
-  proto.audioBitrate = function(bitrate) {
-    this._currentOutput.audio('-b:a', ('' + bitrate).replace(/k?$/, 'k'));
-    return this;
-  };
-
-
-  /**
-   * Specify audio channel count
-   *
-   * @method FfmpegCommand#audioChannels
-   * @category Audio
-   * @aliases withAudioChannels
-   *
-   * @param {Number} channels channel count
-   * @return FfmpegCommand
-   */
-  proto.withAudioChannels =
-  proto.audioChannels = function(channels) {
-    this._currentOutput.audio('-ac', channels);
-    return this;
-  };
-
-
-  /**
-   * Specify audio frequency
-   *
-   * @method FfmpegCommand#audioFrequency
-   * @category Audio
-   * @aliases withAudioFrequency
-   *
-   * @param {Number} freq audio frequency in Hz
-   * @return FfmpegCommand
-   */
-  proto.withAudioFrequency =
-  proto.audioFrequency = function(freq) {
-    this._currentOutput.audio('-ar', freq);
-    return this;
-  };
-
-
-  /**
-   * Specify audio quality
-   *
-   * @method FfmpegCommand#audioQuality
-   * @category Audio
-   * @aliases withAudioQuality
-   *
-   * @param {Number} quality audio quality factor
-   * @return FfmpegCommand
-   */
-  proto.withAudioQuality =
-  proto.audioQuality = function(quality) {
-    this._currentOutput.audio('-aq', quality);
-    return this;
-  };
-
-
-  /**
-   * Specify custom audio filter(s)
-   *
-   * Can be called both with one or many filters, or a filter array.
-   *
-   * @example
-   * command.audioFilters('filter1');
-   *
-   * @example
-   * command.audioFilters('filter1', 'filter2=param1=value1:param2=value2');
-   *
-   * @example
-   * command.audioFilters(['filter1', 'filter2']);
-   *
-   * @example
-   * command.audioFilters([
-   *   {
-   *     filter: 'filter1'
-   *   },
-   *   {
-   *     filter: 'filter2',
-   *     options: 'param=value:param=value'
-   *   }
-   * ]);
-   *
-   * @example
-   * command.audioFilters(
-   *   {
-   *     filter: 'filter1',
-   *     options: ['value1', 'value2']
-   *   },
-   *   {
-   *     filter: 'filter2',
-   *     options: { param1: 'value1', param2: 'value2' }
-   *   }
-   * );
-   *
-   * @method FfmpegCommand#audioFilters
-   * @aliases withAudioFilter,withAudioFilters,audioFilter
-   * @category Audio
-   *
-   * @param {...String|String[]|Object[]} filters audio filter strings, string array or
-   *   filter specification array, each with the following properties:
-   * @param {String} filters.filter filter name
-   * @param {String|String[]|Object} [filters.options] filter option string, array, or object
-   * @return FfmpegCommand
-   */
-  proto.withAudioFilter =
-  proto.withAudioFilters =
-  proto.audioFilter =
-  proto.audioFilters = function(filters) {
-    if (arguments.length > 1) {
-      filters = [].slice.call(arguments);
-    }
-
-    if (!Array.isArray(filters)) {
-      filters = [filters];
-    }
-
-    this._currentOutput.audioFilters(utils.makeFilterStrings(filters));
-    return this;
-  };
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/doc/options_custom.js.html b/doc/options_custom.js.html deleted file mode 100644 index b903fe0a..00000000 --- a/doc/options_custom.js.html +++ /dev/null @@ -1,262 +0,0 @@ - - - - - JSDoc: Source: options/custom.js - - - - - - - - - - -
- -

Source: options/custom.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-var utils = require('../utils');
-
-
-/*
- *! Custom options methods
- */
-
-module.exports = function(proto) {
-  /**
-   * Add custom input option(s)
-   *
-   * When passing a single string or an array, each string containing two
-   * words is split (eg. inputOptions('-option value') is supported) for
-   * compatibility reasons.  This is not the case when passing more than
-   * one argument.
-   *
-   * @example
-   * command.inputOptions('option1');
-   *
-   * @example
-   * command.inputOptions('option1', 'option2');
-   *
-   * @example
-   * command.inputOptions(['option1', 'option2']);
-   *
-   * @method FfmpegCommand#inputOptions
-   * @category Custom options
-   * @aliases addInputOption,addInputOptions,withInputOption,withInputOptions,inputOption
-   *
-   * @param {...String} options option string(s) or string array
-   * @return FfmpegCommand
-   */
-  proto.addInputOption =
-  proto.addInputOptions =
-  proto.withInputOption =
-  proto.withInputOptions =
-  proto.inputOption =
-  proto.inputOptions = function(options) {
-    if (!this._currentInput) {
-      throw new Error('No input specified');
-    }
-
-    var doSplit = true;
-
-    if (arguments.length > 1) {
-      options = [].slice.call(arguments);
-      doSplit = false;
-    }
-
-    if (!Array.isArray(options)) {
-      options = [options];
-    }
-
-    this._currentInput.options(options.reduce(function(options, option) {
-      var split = String(option).split(' ');
-
-      if (doSplit && split.length === 2) {
-        options.push(split[0], split[1]);
-      } else {
-        options.push(option);
-      }
-
-      return options;
-    }, []));
-    return this;
-  };
-
-
-  /**
-   * Add custom output option(s)
-   *
-   * @example
-   * command.outputOptions('option1');
-   *
-   * @example
-   * command.outputOptions('option1', 'option2');
-   *
-   * @example
-   * command.outputOptions(['option1', 'option2']);
-   *
-   * @method FfmpegCommand#outputOptions
-   * @category Custom options
-   * @aliases addOutputOption,addOutputOptions,addOption,addOptions,withOutputOption,withOutputOptions,withOption,withOptions,outputOption
-   *
-   * @param {...String} options option string(s) or string array
-   * @return FfmpegCommand
-   */
-  proto.addOutputOption =
-  proto.addOutputOptions =
-  proto.addOption =
-  proto.addOptions =
-  proto.withOutputOption =
-  proto.withOutputOptions =
-  proto.withOption =
-  proto.withOptions =
-  proto.outputOption =
-  proto.outputOptions = function(options) {
-    var doSplit = true;
-
-    if (arguments.length > 1) {
-      options = [].slice.call(arguments);
-      doSplit = false;
-    }
-
-    if (!Array.isArray(options)) {
-      options = [options];
-    }
-
-    this._currentOutput.options(options.reduce(function(options, option) {
-      var split = String(option).split(' ');
-
-      if (doSplit && split.length === 2) {
-        options.push(split[0], split[1]);
-      } else {
-        options.push(option);
-      }
-
-      return options;
-    }, []));
-    return this;
-  };
-
-
-  /**
-   * Specify a complex filtergraph
-   *
-   * Calling this method will override any previously set filtergraph, but you can set
-   * as many filters as needed in one call.
-   *
-   * @example <caption>Overlay an image over a video (using a filtergraph string)</caption>
-   *   ffmpeg()
-   *     .input('video.avi')
-   *     .input('image.png')
-   *     .complexFilter('[0:v][1:v]overlay[out]', ['out']);
-   *
-   * @example <caption>Overlay an image over a video (using a filter array)</caption>
-   *   ffmpeg()
-   *     .input('video.avi')
-   *     .input('image.png')
-   *     .complexFilter([{
-   *       filter: 'overlay',
-   *       inputs: ['0:v', '1:v'],
-   *       outputs: ['out']
-   *     }], ['out']);
-   *
-   * @example <caption>Split video into RGB channels and output a 3x1 video with channels side to side</caption>
-   *  ffmpeg()
-   *    .input('video.avi')
-   *    .complexFilter([
-   *      // Duplicate video stream 3 times into streams a, b, and c
-   *      { filter: 'split', options: '3', outputs: ['a', 'b', 'c'] },
-   *
-   *      // Create stream 'red' by cancelling green and blue channels from stream 'a'
-   *      { filter: 'lutrgb', options: { g: 0, b: 0 }, inputs: 'a', outputs: 'red' },
-   *
-   *      // Create stream 'green' by cancelling red and blue channels from stream 'b'
-   *      { filter: 'lutrgb', options: { r: 0, b: 0 }, inputs: 'b', outputs: 'green' },
-   *
-   *      // Create stream 'blue' by cancelling red and green channels from stream 'c'
-   *      { filter: 'lutrgb', options: { r: 0, g: 0 }, inputs: 'c', outputs: 'blue' },
-   *
-   *      // Pad stream 'red' to 3x width, keeping the video on the left, and name output 'padded'
-   *      { filter: 'pad', options: { w: 'iw*3', h: 'ih' }, inputs: 'red', outputs: 'padded' },
-   *
-   *      // Overlay 'green' onto 'padded', moving it to the center, and name output 'redgreen'
-   *      { filter: 'overlay', options: { x: 'w', y: 0 }, inputs: ['padded', 'green'], outputs: 'redgreen'},
-   *
-   *      // Overlay 'blue' onto 'redgreen', moving it to the right
-   *      { filter: 'overlay', options: { x: '2*w', y: 0 }, inputs: ['redgreen', 'blue']},
-   *    ]);
-   *
-   * @method FfmpegCommand#complexFilter
-   * @category Custom options
-   * @aliases filterGraph
-   *
-   * @param {String|Array} spec filtergraph string or array of filter specification
-   *   objects, each having the following properties:
-   * @param {String} spec.filter filter name
-   * @param {String|Array} [spec.inputs] (array of) input stream specifier(s) for the filter,
-   *   defaults to ffmpeg automatically choosing the first unused matching streams
-   * @param {String|Array} [spec.outputs] (array of) output stream specifier(s) for the filter,
-   *   defaults to ffmpeg automatically assigning the output to the output file
-   * @param {Object|String|Array} [spec.options] filter options, can be omitted to not set any options
-   * @param {Array} [map] (array of) stream specifier(s) from the graph to include in
-   *   ffmpeg output, defaults to ffmpeg automatically choosing the first matching streams.
-   * @return FfmpegCommand
-   */
-  proto.filterGraph =
-  proto.complexFilter = function(spec, map) {
-    this._complexFilters.clear();
-
-    if (!Array.isArray(spec)) {
-      spec = [spec];
-    }
-
-    this._complexFilters('-filter_complex', utils.makeFilterStrings(spec).join(';'));
-
-    if (Array.isArray(map)) {
-      var self = this;
-      map.forEach(function(streamSpec) {
-        self._complexFilters('-map', streamSpec.replace(utils.streamRegexp, '[$1]'));
-      });
-    } else if (typeof map === 'string') {
-      this._complexFilters('-map', map.replace(utils.streamRegexp, '[$1]'));
-    }
-
-    return this;
-  };
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/doc/options_inputs.js.html b/doc/options_inputs.js.html deleted file mode 100644 index a3a64b81..00000000 --- a/doc/options_inputs.js.html +++ /dev/null @@ -1,228 +0,0 @@ - - - - - JSDoc: Source: options/inputs.js - - - - - - - - - - -
- -

Source: options/inputs.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-var utils = require('../utils');
-
-/*
- *! Input-related methods
- */
-
-module.exports = function(proto) {
-  /**
-   * Add an input to command
-   *
-   * Also switches "current input", that is the input that will be affected
-   * by subsequent input-related methods.
-   *
-   * Note: only one stream input is supported for now.
-   *
-   * @method FfmpegCommand#input
-   * @category Input
-   * @aliases mergeAdd,addInput
-   *
-   * @param {String|Readable} source input file path or readable stream
-   * @return FfmpegCommand
-   */
-  proto.mergeAdd =
-  proto.addInput =
-  proto.input = function(source) {
-    var isFile = false;
-    var isStream = false;
-
-    if (typeof source !== 'string') {
-      if (!('readable' in source) || !(source.readable)) {
-        throw new Error('Invalid input');
-      }
-
-      var hasInputStream = this._inputs.some(function(input) {
-        return input.isStream;
-      });
-
-      if (hasInputStream) {
-        throw new Error('Only one input stream is supported');
-      }
-
-      isStream = true;
-      source.pause();
-    } else {
-      var protocol = source.match(/^([a-z]{2,}):/i);
-      isFile = !protocol || protocol[0] === 'file';
-    }
-
-    this._inputs.push(this._currentInput = {
-      source: source,
-      isFile: isFile,
-      isStream: isStream,
-      options: utils.args()
-    });
-
-    return this;
-  };
-
-
-  /**
-   * Specify input format for the last specified input
-   *
-   * @method FfmpegCommand#inputFormat
-   * @category Input
-   * @aliases withInputFormat,fromFormat
-   *
-   * @param {String} format input format
-   * @return FfmpegCommand
-   */
-  proto.withInputFormat =
-  proto.inputFormat =
-  proto.fromFormat = function(format) {
-    if (!this._currentInput) {
-      throw new Error('No input specified');
-    }
-
-    this._currentInput.options('-f', format);
-    return this;
-  };
-
-
-  /**
-   * Specify input FPS for the last specified input
-   * (only valid for raw video formats)
-   *
-   * @method FfmpegCommand#inputFps
-   * @category Input
-   * @aliases withInputFps,withInputFPS,withFpsInput,withFPSInput,inputFPS,inputFps,fpsInput
-   *
-   * @param {Number} fps input FPS
-   * @return FfmpegCommand
-   */
-  proto.withInputFps =
-  proto.withInputFPS =
-  proto.withFpsInput =
-  proto.withFPSInput =
-  proto.inputFPS =
-  proto.inputFps =
-  proto.fpsInput =
-  proto.FPSInput = function(fps) {
-    if (!this._currentInput) {
-      throw new Error('No input specified');
-    }
-
-    this._currentInput.options('-r', fps);
-    return this;
-  };
-
-
-  /**
-   * Use native framerate for the last specified input
-   *
-   * @method FfmpegCommand#native
-   * @category Input
-   * @aliases nativeFramerate,withNativeFramerate
-   *
-   * @return FfmmegCommand
-   */
-  proto.nativeFramerate =
-  proto.withNativeFramerate =
-  proto.native = function() {
-    if (!this._currentInput) {
-      throw new Error('No input specified');
-    }
-
-    this._currentInput.options('-re');
-    return this;
-  };
-
-
-  /**
-   * Specify input seek time for the last specified input
-   *
-   * @method FfmpegCommand#seekInput
-   * @category Input
-   * @aliases setStartTime,seekTo
-   *
-   * @param {String|Number} seek seek time in seconds or as a '[hh:[mm:]]ss[.xxx]' string
-   * @return FfmpegCommand
-   */
-  proto.setStartTime =
-  proto.seekInput = function(seek) {
-    if (!this._currentInput) {
-      throw new Error('No input specified');
-    }
-
-    this._currentInput.options('-ss', seek);
-
-    return this;
-  };
-
-
-  /**
-   * Loop over the last specified input
-   *
-   * @method FfmpegCommand#loop
-   * @category Input
-   *
-   * @param {String|Number} [duration] loop duration in seconds or as a '[[hh:]mm:]ss[.xxx]' string
-   * @return FfmpegCommand
-   */
-  proto.loop = function(duration) {
-    if (!this._currentInput) {
-      throw new Error('No input specified');
-    }
-
-    this._currentInput.options('-loop', '1');
-
-    if (typeof duration !== 'undefined') {
-      this.duration(duration);
-    }
-
-    return this;
-  };
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/doc/options_misc.js.html b/doc/options_misc.js.html deleted file mode 100644 index b1396aa5..00000000 --- a/doc/options_misc.js.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - JSDoc: Source: options/misc.js - - - - - - - - - - -
- -

Source: options/misc.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-var path = require('path');
-
-/*
- *! Miscellaneous methods
- */
-
-module.exports = function(proto) {
-  /**
-   * Use preset
-   *
-   * @method FfmpegCommand#preset
-   * @category Miscellaneous
-   * @aliases usingPreset
-   *
-   * @param {String|Function} preset preset name or preset function
-   */
-  proto.usingPreset =
-  proto.preset = function(preset) {
-    if (typeof preset === 'function') {
-      preset(this);
-    } else {
-      try {
-        var modulePath = path.join(this.options.presets, preset);
-        var module = require(modulePath);
-
-        if (typeof module.load === 'function') {
-          module.load(this);
-        } else {
-          throw new Error('preset ' + modulePath + ' has no load() function');
-        }
-      } catch (err) {
-        throw new Error('preset ' + modulePath + ' could not be loaded: ' + err.message);
-      }
-    }
-
-    return this;
-  };
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/doc/options_output.js.html b/doc/options_output.js.html deleted file mode 100644 index 1b078854..00000000 --- a/doc/options_output.js.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - JSDoc: Source: options/output.js - - - - - - - - - - -
- -

Source: options/output.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-var utils = require('../utils');
-
-
-/*
- *! Output-related methods
- */
-
-module.exports = function(proto) {
-  /**
-   * Add output
-   *
-   * @method FfmpegCommand#output
-   * @category Output
-   * @aliases addOutput
-   *
-   * @param {String|Writable} target target file path or writable stream
-   * @param {Object} [pipeopts={}] pipe options (only applies to streams)
-   * @return FfmpegCommand
-   */
-  proto.addOutput =
-  proto.output = function(target, pipeopts) {
-    var isFile = false;
-
-    if (!target && this._currentOutput) {
-      // No target is only allowed when called from constructor
-      throw new Error('Invalid output');
-    }
-
-    if (target && typeof target !== 'string') {
-      if (!('writable' in target) || !(target.writable)) {
-        throw new Error('Invalid output');
-      }
-    } else if (typeof target === 'string') {
-      var protocol = target.match(/^([a-z]{2,}):/i);
-      isFile = !protocol || protocol[0] === 'file';
-    }
-
-    if (target && !('target' in this._currentOutput)) {
-      // For backwards compatibility, set target for first output
-      this._currentOutput.target = target;
-      this._currentOutput.isFile = isFile;
-      this._currentOutput.pipeopts = pipeopts || {};
-    } else {
-      if (target && typeof target !== 'string') {
-        var hasOutputStream = this._outputs.some(function(output) {
-          return typeof output.target !== 'string';
-        });
-
-        if (hasOutputStream) {
-          throw new Error('Only one output stream is supported');
-        }
-      }
-
-      this._outputs.push(this._currentOutput = {
-        target: target,
-        isFile: isFile,
-        flags: {},
-        pipeopts: pipeopts || {}
-      });
-
-      var self = this;
-      ['audio', 'audioFilters', 'video', 'videoFilters', 'sizeFilters', 'options'].forEach(function(key) {
-        self._currentOutput[key] = utils.args();
-      });
-
-      if (!target) {
-        // Call from constructor: remove target key
-        delete this._currentOutput.target;
-      }
-    }
-
-    return this;
-  };
-
-
-  /**
-   * Specify output seek time
-   *
-   * @method FfmpegCommand#seek
-   * @category Input
-   * @aliases seekOutput
-   *
-   * @param {String|Number} seek seek time in seconds or as a '[hh:[mm:]]ss[.xxx]' string
-   * @return FfmpegCommand
-   */
-  proto.seekOutput =
-  proto.seek = function(seek) {
-    this._currentOutput.options('-ss', seek);
-    return this;
-  };
-
-
-  /**
-   * Set output duration
-   *
-   * @method FfmpegCommand#duration
-   * @category Output
-   * @aliases withDuration,setDuration
-   *
-   * @param {String|Number} duration duration in seconds or as a '[[hh:]mm:]ss[.xxx]' string
-   * @return FfmpegCommand
-   */
-  proto.withDuration =
-  proto.setDuration =
-  proto.duration = function(duration) {
-    this._currentOutput.options('-t', duration);
-    return this;
-  };
-
-
-  /**
-   * Set output format
-   *
-   * @method FfmpegCommand#format
-   * @category Output
-   * @aliases toFormat,withOutputFormat,outputFormat
-   *
-   * @param {String} format output format name
-   * @return FfmpegCommand
-   */
-  proto.toFormat =
-  proto.withOutputFormat =
-  proto.outputFormat =
-  proto.format = function(format) {
-    this._currentOutput.options('-f', format);
-    return this;
-  };
-
-
-  /**
-   * Add stream mapping to output
-   *
-   * @method FfmpegCommand#map
-   * @category Output
-   *
-   * @param {String} spec stream specification string, with optional square brackets
-   * @return FfmpegCommand
-   */
-  proto.map = function(spec) {
-    this._currentOutput.options('-map', spec.replace(utils.streamRegexp, '[$1]'));
-    return this;
-  };
-
-
-  /**
-   * Run flvtool2/flvmeta on output
-   *
-   * @method FfmpegCommand#flvmeta
-   * @category Output
-   * @aliases updateFlvMetadata
-   *
-   * @return FfmpegCommand
-   */
-  proto.updateFlvMetadata =
-  proto.flvmeta = function() {
-    this._currentOutput.flags.flvmeta = true;
-    return this;
-  };
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/doc/options_video.js.html b/doc/options_video.js.html deleted file mode 100644 index 0b229f61..00000000 --- a/doc/options_video.js.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - - JSDoc: Source: options/video.js - - - - - - - - - - -
- -

Source: options/video.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-var utils = require('../utils');
-
-
-/*
- *! Video-related methods
- */
-
-module.exports = function(proto) {
-  /**
-   * Disable video in the output
-   *
-   * @method FfmpegCommand#noVideo
-   * @category Video
-   * @aliases withNoVideo
-   *
-   * @return FfmpegCommand
-   */
-  proto.withNoVideo =
-  proto.noVideo = function() {
-    this._currentOutput.video.clear();
-    this._currentOutput.videoFilters.clear();
-    this._currentOutput.video('-vn');
-
-    return this;
-  };
-
-
-  /**
-   * Specify video codec
-   *
-   * @method FfmpegCommand#videoCodec
-   * @category Video
-   * @aliases withVideoCodec
-   *
-   * @param {String} codec video codec name
-   * @return FfmpegCommand
-   */
-  proto.withVideoCodec =
-  proto.videoCodec = function(codec) {
-    this._currentOutput.video('-vcodec', codec);
-    return this;
-  };
-
-
-  /**
-   * Specify video bitrate
-   *
-   * @method FfmpegCommand#videoBitrate
-   * @category Video
-   * @aliases withVideoBitrate
-   *
-   * @param {String|Number} bitrate video bitrate in kbps (with an optional 'k' suffix)
-   * @param {Boolean} [constant=false] enforce constant bitrate
-   * @return FfmpegCommand
-   */
-  proto.withVideoBitrate =
-  proto.videoBitrate = function(bitrate, constant) {
-    bitrate = ('' + bitrate).replace(/k?$/, 'k');
-
-    this._currentOutput.video('-b:v', bitrate);
-    if (constant) {
-      this._currentOutput.video(
-        '-maxrate', bitrate,
-        '-minrate', bitrate,
-        '-bufsize', '3M'
-      );
-    }
-
-    return this;
-  };
-
-
-  /**
-   * Specify custom video filter(s)
-   *
-   * Can be called both with one or many filters, or a filter array.
-   *
-   * @example
-   * command.videoFilters('filter1');
-   *
-   * @example
-   * command.videoFilters('filter1', 'filter2=param1=value1:param2=value2');
-   *
-   * @example
-   * command.videoFilters(['filter1', 'filter2']);
-   *
-   * @example
-   * command.videoFilters([
-   *   {
-   *     filter: 'filter1'
-   *   },
-   *   {
-   *     filter: 'filter2',
-   *     options: 'param=value:param=value'
-   *   }
-   * ]);
-   *
-   * @example
-   * command.videoFilters(
-   *   {
-   *     filter: 'filter1',
-   *     options: ['value1', 'value2']
-   *   },
-   *   {
-   *     filter: 'filter2',
-   *     options: { param1: 'value1', param2: 'value2' }
-   *   }
-   * );
-   *
-   * @method FfmpegCommand#videoFilters
-   * @category Video
-   * @aliases withVideoFilter,withVideoFilters,videoFilter
-   *
-   * @param {...String|String[]|Object[]} filters video filter strings, string array or
-   *   filter specification array, each with the following properties:
-   * @param {String} filters.filter filter name
-   * @param {String|String[]|Object} [filters.options] filter option string, array, or object
-   * @return FfmpegCommand
-   */
-  proto.withVideoFilter =
-  proto.withVideoFilters =
-  proto.videoFilter =
-  proto.videoFilters = function(filters) {
-    if (arguments.length > 1) {
-      filters = [].slice.call(arguments);
-    }
-
-    if (!Array.isArray(filters)) {
-      filters = [filters];
-    }
-
-    this._currentOutput.videoFilters(utils.makeFilterStrings(filters));
-
-    return this;
-  };
-
-
-  /**
-   * Specify output FPS
-   *
-   * @method FfmpegCommand#fps
-   * @category Video
-   * @aliases withOutputFps,withOutputFPS,withFpsOutput,withFPSOutput,withFps,withFPS,outputFPS,outputFps,fpsOutput,FPSOutput,FPS
-   *
-   * @param {Number} fps output FPS
-   * @return FfmpegCommand
-   */
-  proto.withOutputFps =
-  proto.withOutputFPS =
-  proto.withFpsOutput =
-  proto.withFPSOutput =
-  proto.withFps =
-  proto.withFPS =
-  proto.outputFPS =
-  proto.outputFps =
-  proto.fpsOutput =
-  proto.FPSOutput =
-  proto.fps =
-  proto.FPS = function(fps) {
-    this._currentOutput.video('-r', fps);
-    return this;
-  };
-
-
-  /**
-   * Only transcode a certain number of frames
-   *
-   * @method FfmpegCommand#frames
-   * @category Video
-   * @aliases takeFrames,withFrames
-   *
-   * @param {Number} frames frame count
-   * @return FfmpegCommand
-   */
-  proto.takeFrames =
-  proto.withFrames =
-  proto.frames = function(frames) {
-    this._currentOutput.video('-vframes', frames);
-    return this;
-  };
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/doc/options_videosize.js.html b/doc/options_videosize.js.html deleted file mode 100644 index 82210d1e..00000000 --- a/doc/options_videosize.js.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - JSDoc: Source: options/videosize.js - - - - - - - - - - -
- -

Source: options/videosize.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-/*
- *! Size helpers
- */
-
-
-/**
- * Return filters to pad video to width*height,
- *
- * @param {Number} width output width
- * @param {Number} height output height
- * @param {Number} aspect video aspect ratio (without padding)
- * @param {Number} color padding color
- * @return scale/pad filters
- * @private
- */
-function getScalePadFilters(width, height, aspect, color) {
-  /*
-    let a be the input aspect ratio, A be the requested aspect ratio
-
-    if a > A, padding is done on top and bottom
-    if a < A, padding is done on left and right
-   */
-
-  return [
-    /*
-      In both cases, we first have to scale the input to match the requested size.
-      When using computed width/height, we truncate them to multiples of 2
-     */
-    {
-      filter: 'scale',
-      options: {
-        w: 'if(gt(a,' + aspect + '),' + width + ',trunc(' + height + '*a/2)*2)',
-        h: 'if(lt(a,' + aspect + '),' + height + ',trunc(' + width + '/a/2)*2)'
-      }
-    },
-
-    /*
-      Then we pad the scaled input to match the target size
-      (here iw and ih refer to the padding input, i.e the scaled output)
-     */
-
-    {
-      filter: 'pad',
-      options: {
-        w: width,
-        h: height,
-        x: 'if(gt(a,' + aspect + '),0,(' + width + '-iw)/2)',
-        y: 'if(lt(a,' + aspect + '),0,(' + height + '-ih)/2)',
-        color: color
-      }
-    }
-  ];
-}
-
-
-/**
- * Recompute size filters
- *
- * @param {Object} output
- * @param {String} key newly-added parameter name ('size', 'aspect' or 'pad')
- * @param {String} value newly-added parameter value
- * @return filter string array
- * @private
- */
-function createSizeFilters(output, key, value) {
-  // Store parameters
-  var data = output.sizeData = output.sizeData || {};
-  data[key] = value;
-
-  if (!('size' in data)) {
-    // No size requested, keep original size
-    return [];
-  }
-
-  // Try to match the different size string formats
-  var fixedSize = data.size.match(/([0-9]+)x([0-9]+)/);
-  var fixedWidth = data.size.match(/([0-9]+)x\?/);
-  var fixedHeight = data.size.match(/\?x([0-9]+)/);
-  var percentRatio = data.size.match(/\b([0-9]{1,3})%/);
-  var width, height, aspect;
-
-  if (percentRatio) {
-    var ratio = Number(percentRatio[1]) / 100;
-    return [{
-      filter: 'scale',
-      options: {
-        w: 'trunc(iw*' + ratio + '/2)*2',
-        h: 'trunc(ih*' + ratio + '/2)*2'
-      }
-    }];
-  } else if (fixedSize) {
-    // Round target size to multiples of 2
-    width = Math.round(Number(fixedSize[1]) / 2) * 2;
-    height = Math.round(Number(fixedSize[2]) / 2) * 2;
-
-    aspect = width / height;
-
-    if (data.pad) {
-      return getScalePadFilters(width, height, aspect, data.pad);
-    } else {
-      // No autopad requested, rescale to target size
-      return [{ filter: 'scale', options: { w: width, h: height }}];
-    }
-  } else if (fixedWidth || fixedHeight) {
-    if ('aspect' in data) {
-      // Specified aspect ratio
-      width = fixedWidth ? fixedWidth[1] : Math.round(Number(fixedHeight[1]) * data.aspect);
-      height = fixedHeight ? fixedHeight[1] : Math.round(Number(fixedWidth[1]) / data.aspect);
-
-      // Round to multiples of 2
-      width = Math.round(width / 2) * 2;
-      height = Math.round(height / 2) * 2;
-
-      if (data.pad) {
-        return getScalePadFilters(width, height, data.aspect, data.pad);
-      } else {
-        // No autopad requested, rescale to target size
-        return [{ filter: 'scale', options: { w: width, h: height }}];
-      }
-    } else {
-      // Keep input aspect ratio
-
-      if (fixedWidth) {
-        return [{
-          filter: 'scale',
-          options: {
-            w: Math.round(Number(fixedWidth[1]) / 2) * 2,
-            h: 'trunc(ow/a/2)*2'
-          }
-        }];
-      } else {
-        return [{
-          filter: 'scale',
-          options: {
-            w: 'trunc(oh*a/2)*2',
-            h: Math.round(Number(fixedHeight[1]) / 2) * 2
-          }
-        }];
-      }
-    }
-  } else {
-    throw new Error('Invalid size specified: ' + data.size);
-  }
-}
-
-
-/*
- *! Video size-related methods
- */
-
-module.exports = function(proto) {
-  /**
-   * Keep display aspect ratio
-   *
-   * This method is useful when converting an input with non-square pixels to an output format
-   * that does not support non-square pixels.  It rescales the input so that the display aspect
-   * ratio is the same.
-   *
-   * @method FfmpegCommand#keepDAR
-   * @category Video size
-   * @aliases keepPixelAspect,keepDisplayAspect,keepDisplayAspectRatio
-   *
-   * @return FfmpegCommand
-   */
-  proto.keepPixelAspect = // Only for compatibility, this is not about keeping _pixel_ aspect ratio
-  proto.keepDisplayAspect =
-  proto.keepDisplayAspectRatio =
-  proto.keepDAR = function() {
-    return this.videoFilters([
-      {
-        filter: 'scale',
-        options: {
-          w: 'if(gt(sar,1),iw*sar,iw)',
-          h: 'if(lt(sar,1),ih/sar,ih)'
-        }
-      },
-      {
-        filter: 'setsar',
-        options: '1'
-      }
-    ]);
-  };
-
-
-  /**
-   * Set output size
-   *
-   * The 'size' parameter can have one of 4 forms:
-   * - 'X%': rescale to xx % of the original size
-   * - 'WxH': specify width and height
-   * - 'Wx?': specify width and compute height from input aspect ratio
-   * - '?xH': specify height and compute width from input aspect ratio
-   *
-   * Note: both dimensions will be truncated to multiples of 2.
-   *
-   * @method FfmpegCommand#size
-   * @category Video size
-   * @aliases withSize,setSize
-   *
-   * @param {String} size size string, eg. '33%', '320x240', '320x?', '?x240'
-   * @return FfmpegCommand
-   */
-  proto.withSize =
-  proto.setSize =
-  proto.size = function(size) {
-    var filters = createSizeFilters(this._currentOutput, 'size', size);
-
-    this._currentOutput.sizeFilters.clear();
-    this._currentOutput.sizeFilters(filters);
-
-    return this;
-  };
-
-
-  /**
-   * Set output aspect ratio
-   *
-   * @method FfmpegCommand#aspect
-   * @category Video size
-   * @aliases withAspect,withAspectRatio,setAspect,setAspectRatio,aspectRatio
-   *
-   * @param {String|Number} aspect aspect ratio (number or 'X:Y' string)
-   * @return FfmpegCommand
-   */
-  proto.withAspect =
-  proto.withAspectRatio =
-  proto.setAspect =
-  proto.setAspectRatio =
-  proto.aspect =
-  proto.aspectRatio = function(aspect) {
-    var a = Number(aspect);
-    if (isNaN(a)) {
-      var match = aspect.match(/^(\d+):(\d+)$/);
-      if (match) {
-        a = Number(match[1]) / Number(match[2]);
-      } else {
-        throw new Error('Invalid aspect ratio: ' + aspect);
-      }
-    }
-
-    var filters = createSizeFilters(this._currentOutput, 'aspect', a);
-
-    this._currentOutput.sizeFilters.clear();
-    this._currentOutput.sizeFilters(filters);
-
-    return this;
-  };
-
-
-  /**
-   * Enable auto-padding the output
-   *
-   * @method FfmpegCommand#autopad
-   * @category Video size
-   * @aliases applyAutopadding,applyAutoPadding,applyAutopad,applyAutoPad,withAutopadding,withAutoPadding,withAutopad,withAutoPad,autoPad
-   *
-   * @param {Boolean} [pad=true] enable/disable auto-padding
-   * @param {String} [color='black'] pad color
-   */
-  proto.applyAutopadding =
-  proto.applyAutoPadding =
-  proto.applyAutopad =
-  proto.applyAutoPad =
-  proto.withAutopadding =
-  proto.withAutoPadding =
-  proto.withAutopad =
-  proto.withAutoPad =
-  proto.autoPad =
-  proto.autopad = function(pad, color) {
-    // Allow autopad(color)
-    if (typeof pad === 'string') {
-      color = pad;
-      pad = true;
-    }
-
-    // Allow autopad() and autopad(undefined, color)
-    if (typeof pad === 'undefined') {
-      pad = true;
-    }
-
-    var filters = createSizeFilters(this._currentOutput, 'pad', pad ? color || 'black' : false);
-
-    this._currentOutput.sizeFilters.clear();
-    this._currentOutput.sizeFilters(filters);
-
-    return this;
-  };
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/doc/output.js.html b/doc/output.js.html deleted file mode 100644 index d2b2d173..00000000 --- a/doc/output.js.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - JSDoc: Source: options/output.js - - - - - - - - - - -
- -

Source: options/output.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-var utils = require('../utils');
-
-
-/*
- *! Output-related methods
- */
-
-module.exports = function(proto) {
-  /**
-   * Add output
-   *
-   * @method FfmpegCommand#output
-   * @category Output
-   * @aliases addOutput
-   *
-   * @param {String|Writable} target target file path or writable stream
-   * @param {Object} [pipeopts={}] pipe options (only applies to streams)
-   * @return FfmpegCommand
-   */
-  proto.addOutput =
-  proto.output = function(target, pipeopts) {
-    var isFile = false;
-
-    if (!target && this._currentOutput) {
-      // No target is only allowed when called from constructor
-      throw new Error('Invalid output');
-    }
-
-    if (target && typeof target !== 'string') {
-      if (!('writable' in target) || !(target.writable)) {
-        throw new Error('Invalid output');
-      }
-    } else if (typeof target === 'string') {
-      var protocol = target.match(/^([a-z]{2,}):/i);
-      isFile = !protocol || protocol[0] === 'file';
-    }
-
-    if (target && !('target' in this._currentOutput)) {
-      // For backwards compatibility, set target for first output
-      this._currentOutput.target = target;
-      this._currentOutput.isFile = isFile;
-      this._currentOutput.pipeopts = pipeopts || {};
-    } else {
-      if (target && typeof target !== 'string') {
-        var hasOutputStream = this._outputs.some(function(output) {
-          return typeof output.target !== 'string';
-        });
-
-        if (hasOutputStream) {
-          throw new Error('Only one output stream is supported');
-        }
-      }
-
-      this._outputs.push(this._currentOutput = {
-        target: target,
-        isFile: isFile,
-        flags: {},
-        pipeopts: pipeopts || {}
-      });
-
-      var self = this;
-      ['audio', 'audioFilters', 'video', 'videoFilters', 'sizeFilters', 'options'].forEach(function(key) {
-        self._currentOutput[key] = utils.args();
-      });
-
-      if (!target) {
-        // Call from constructor: remove target key
-        delete this._currentOutput.target;
-      }
-    }
-
-    return this;
-  };
-
-
-  /**
-   * Specify output seek time
-   *
-   * @method FfmpegCommand#seek
-   * @category Input
-   * @aliases seekOutput
-   *
-   * @param {String|Number} seek seek time in seconds or as a '[hh:[mm:]]ss[.xxx]' string
-   * @return FfmpegCommand
-   */
-  proto.seekOutput =
-  proto.seek = function(seek) {
-    this._currentOutput.options('-ss', seek);
-    return this;
-  };
-
-
-  /**
-   * Set output duration
-   *
-   * @method FfmpegCommand#duration
-   * @category Output
-   * @aliases withDuration,setDuration
-   *
-   * @param {String|Number} duration duration in seconds or as a '[[hh:]mm:]ss[.xxx]' string
-   * @return FfmpegCommand
-   */
-  proto.withDuration =
-  proto.setDuration =
-  proto.duration = function(duration) {
-    this._currentOutput.options('-t', duration);
-    return this;
-  };
-
-
-  /**
-   * Set output format
-   *
-   * @method FfmpegCommand#format
-   * @category Output
-   * @aliases toFormat,withOutputFormat,outputFormat
-   *
-   * @param {String} format output format name
-   * @return FfmpegCommand
-   */
-  proto.toFormat =
-  proto.withOutputFormat =
-  proto.outputFormat =
-  proto.format = function(format) {
-    this._currentOutput.options('-f', format);
-    return this;
-  };
-
-
-  /**
-   * Add stream mapping to output
-   *
-   * @method FfmpegCommand#map
-   * @category Output
-   *
-   * @param {String} spec stream specification string, with optional square brackets
-   * @return FfmpegCommand
-   */
-  proto.map = function(spec) {
-    this._currentOutput.options('-map', spec.replace(utils.streamRegexp, '[$1]'));
-    return this;
-  };
-
-
-  /**
-   * Run flvtool2/flvmeta on output
-   *
-   * @method FfmpegCommand#flvmeta
-   * @category Output
-   * @aliases updateFlvMetadata
-   *
-   * @return FfmpegCommand
-   */
-  proto.updateFlvMetadata =
-  proto.flvmeta = function() {
-    this._currentOutput.flags.flvmeta = true;
-    return this;
-  };
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/doc/processor.js.html b/doc/processor.js.html deleted file mode 100644 index 6936f973..00000000 --- a/doc/processor.js.html +++ /dev/null @@ -1,708 +0,0 @@ - - - - - JSDoc: Source: processor.js - - - - - - - - - - -
- -

Source: processor.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-var spawn = require('child_process').spawn;
-var path = require('path');
-var fs = require('fs');
-var async = require('async');
-var utils = require('./utils');
-
-var nlRegexp = /\r\n|\r|\n/g;
-
-/*
- *! Processor methods
- */
-
-
-/**
- * Run ffprobe asynchronously and store data in command
- *
- * @param {FfmpegCommand} command
- * @private
- */
-function runFfprobe(command) {
-  command.ffprobe(0, function(err, data) {
-    command._ffprobeData = data;
-  });
-}
-
-
-module.exports = function(proto) {
-  /**
-   * Emitted just after ffmpeg has been spawned.
-   *
-   * @event FfmpegCommand#start
-   * @param {String} command ffmpeg command line
-   */
-
-  /**
-   * Emitted when ffmpeg reports progress information
-   *
-   * @event FfmpegCommand#progress
-   * @param {Object} progress progress object
-   * @param {Number} progress.frames number of frames transcoded
-   * @param {Number} progress.currentFps current processing speed in frames per second
-   * @param {Number} progress.currentKbps current output generation speed in kilobytes per second
-   * @param {Number} progress.targetSize current output file size
-   * @param {String} progress.timemark current video timemark
-   * @param {Number} [progress.percent] processing progress (may not be available depending on input)
-   */
-
-  /**
-   * Emitted when ffmpeg outputs to stderr
-   *
-   * @event FfmpegCommand#stderr
-   * @param {String} line stderr output line
-   */
-
-  /**
-   * Emitted when ffmpeg reports input codec data
-   *
-   * @event FfmpegCommand#codecData
-   * @param {Object} codecData codec data object
-   * @param {String} codecData.format input format name
-   * @param {String} codecData.audio input audio codec name
-   * @param {String} codecData.audio_details input audio codec parameters
-   * @param {String} codecData.video input video codec name
-   * @param {String} codecData.video_details input video codec parameters
-   */
-
-  /**
-   * Emitted when an error happens when preparing or running a command
-   *
-   * @event FfmpegCommand#error
-   * @param {Error} error error object
-   * @param {String|null} stdout ffmpeg stdout, unless outputting to a stream
-   * @param {String|null} stderr ffmpeg stderr
-   */
-
-  /**
-   * Emitted when a command finishes processing
-   *
-   * @event FfmpegCommand#end
-   * @param {Array|String|null} [filenames|stdout] generated filenames when taking screenshots, ffmpeg stdout when not outputting to a stream, null otherwise
-   * @param {String|null} stderr ffmpeg stderr
-   */
-
-
-  /**
-   * Spawn an ffmpeg process
-   *
-   * The 'options' argument may contain the following keys:
-   * - 'niceness': specify process niceness, ignored on Windows (default: 0)
-   * - `cwd`: change working directory
-   * - 'captureStdout': capture stdout and pass it to 'endCB' as its 2nd argument (default: false)
-   * - 'stdoutLines': override command limit (default: use command limit)
-   *
-   * The 'processCB' callback, if present, is called as soon as the process is created and
-   * receives a nodejs ChildProcess object.  It may not be called at all if an error happens
-   * before spawning the process.
-   *
-   * The 'endCB' callback is called either when an error occurs or when the ffmpeg process finishes.
-   *
-   * @method FfmpegCommand#_spawnFfmpeg
-   * @param {Array} args ffmpeg command line argument list
-   * @param {Object} [options] spawn options (see above)
-   * @param {Function} [processCB] callback called with process object and stdout/stderr ring buffers when process has been created
-   * @param {Function} endCB callback called with error (if applicable) and stdout/stderr ring buffers when process finished
-   * @private
-   */
-  proto._spawnFfmpeg = function(args, options, processCB, endCB) {
-    // Enable omitting options
-    if (typeof options === 'function') {
-      endCB = processCB;
-      processCB = options;
-      options = {};
-    }
-
-    // Enable omitting processCB
-    if (typeof endCB === 'undefined') {
-      endCB = processCB;
-      processCB = function() {};
-    }
-
-    var maxLines = 'stdoutLines' in options ? options.stdoutLines : this.options.stdoutLines;
-
-    // Find ffmpeg
-    this._getFfmpegPath(function(err, command) {
-      if (err) {
-        return endCB(err);
-      } else if (!command || command.length === 0) {
-        return endCB(new Error('Cannot find ffmpeg'));
-      }
-
-      // Apply niceness
-      if (options.niceness && options.niceness !== 0 && !utils.isWindows) {
-        args.unshift('-n', options.niceness, command);
-        command = 'nice';
-      }
-
-      var stdoutRing = utils.linesRing(maxLines);
-      var stdoutClosed = false;
-
-      var stderrRing = utils.linesRing(maxLines);
-      var stderrClosed = false;
-
-      // Spawn process
-      var ffmpegProc = spawn(command, args, options);
-
-      if (ffmpegProc.stderr) {
-        ffmpegProc.stderr.setEncoding('utf8');
-      }
-
-      ffmpegProc.on('error', function(err) {
-        endCB(err);
-      });
-
-      // Ensure we wait for captured streams to end before calling endCB
-      var exitError = null;
-      function handleExit(err) {
-        if (err) {
-          exitError = err;
-        }
-
-        if (processExited && (stdoutClosed || !options.captureStdout) && stderrClosed) {
-          endCB(exitError, stdoutRing, stderrRing);
-        }
-      }
-
-      // Handle process exit
-      var processExited = false;
-      ffmpegProc.on('exit', function(code, signal) {
-        processExited = true;
-
-        if (signal) {
-          handleExit(new Error('ffmpeg was killed with signal ' + signal));
-        } else if (code) {
-          handleExit(new Error('ffmpeg exited with code ' + code));
-        } else {
-          handleExit();
-        }
-      });
-
-      // Capture stdout if specified
-      if (options.captureStdout) {
-        ffmpegProc.stdout.on('data', function(data) {
-          stdoutRing.append(data);
-        });
-
-        ffmpegProc.stdout.on('close', function() {
-          stdoutRing.close();
-          stdoutClosed = true;
-          handleExit();
-        });
-      }
-
-      // Capture stderr if specified
-      ffmpegProc.stderr.on('data', function(data) {
-        stderrRing.append(data);
-      });
-
-      ffmpegProc.stderr.on('close', function() {
-        stderrRing.close();
-        stderrClosed = true;
-        handleExit();
-      });
-
-      // Call process callback
-      processCB(ffmpegProc, stdoutRing, stderrRing);
-    });
-  };
-
-
-  /**
-   * Build the argument list for an ffmpeg command
-   *
-   * @method FfmpegCommand#_getArguments
-   * @return argument list
-   * @private
-   */
-  proto._getArguments = function() {
-    var complexFilters = this._complexFilters.get();
-
-    var fileOutput = this._outputs.some(function(output) {
-      return output.isFile;
-    });
-
-    return [].concat(
-        // Inputs and input options
-        this._inputs.reduce(function(args, input) {
-          var source = (typeof input.source === 'string') ? input.source : 'pipe:0';
-
-          // For each input, add input options, then '-i <source>'
-          return args.concat(
-            input.options.get(),
-            ['-i', source]
-          );
-        }, []),
-
-        // Global options
-        this._global.get(),
-
-        // Overwrite if we have file outputs
-        fileOutput ? ['-y'] : [],
-
-        // Complex filters
-        complexFilters,
-
-        // Outputs, filters and output options
-        this._outputs.reduce(function(args, output) {
-          var sizeFilters = utils.makeFilterStrings(output.sizeFilters.get());
-          var audioFilters = output.audioFilters.get();
-          var videoFilters = output.videoFilters.get().concat(sizeFilters);
-          var outputArg;
-
-          if (!output.target) {
-            outputArg = [];
-          } else if (typeof output.target === 'string') {
-            outputArg = [output.target];
-          } else {
-            outputArg = ['pipe:1'];
-          }
-
-          return args.concat(
-            output.audio.get(),
-            audioFilters.length ? ['-filter:a', audioFilters.join(',')] : [],
-            output.video.get(),
-            videoFilters.length ? ['-filter:v', videoFilters.join(',')] : [],
-            output.options.get(),
-            outputArg
-          );
-        }, [])
-      );
-  };
-
-
-  /**
-   * Prepare execution of an ffmpeg command
-   *
-   * Checks prerequisites for the execution of the command (codec/format availability, flvtool...),
-   * then builds the argument list for ffmpeg and pass them to 'callback'.
-   *
-   * @method FfmpegCommand#_prepare
-   * @param {Function} callback callback with signature (err, args)
-   * @param {Boolean} [readMetadata=false] read metadata before processing
-   * @private
-   */
-  proto._prepare = function(callback, readMetadata) {
-    var self = this;
-
-    async.waterfall([
-      // Check codecs and formats
-      function(cb) {
-        self._checkCapabilities(cb);
-      },
-
-      // Read metadata if required
-      function(cb) {
-        if (!readMetadata) {
-          return cb();
-        }
-
-        self.ffprobe(0, function(err, data) {
-          if (!err) {
-            self._ffprobeData = data;
-          }
-
-          cb();
-        });
-      },
-
-      // Check for flvtool2/flvmeta if necessary
-      function(cb) {
-        var flvmeta = self._outputs.some(function(output) {
-          // Remove flvmeta flag on non-file output
-          if (output.flags.flvmeta && !output.isFile) {
-            self.logger.warn('Updating flv metadata is only supported for files');
-            output.flags.flvmeta = false;
-          }
-
-          return output.flags.flvmeta;
-        });
-
-        if (flvmeta) {
-          self._getFlvtoolPath(function(err) {
-            cb(err);
-          });
-        } else {
-          cb();
-        }
-      },
-
-      // Build argument list
-      function(cb) {
-        var args;
-        try {
-          args = self._getArguments();
-        } catch(e) {
-          return cb(e);
-        }
-
-        cb(null, args);
-      },
-
-      // Add "-strict experimental" option where needed
-      function(args, cb) {
-        self.availableEncoders(function(err, encoders) {
-          for (var i = 0; i < args.length; i++) {
-            if (args[i] === '-acodec' || args[i] === '-vcodec') {
-              i++;
-
-              if ((args[i] in encoders) && encoders[args[i]].experimental) {
-                args.splice(i + 1, 0, '-strict', 'experimental');
-                i += 2;
-              }
-            }
-          }
-
-          cb(null, args);
-        });
-      }
-    ], callback);
-
-    if (!readMetadata) {
-      // Read metadata as soon as 'progress' listeners are added
-
-      if (this.listeners('progress').length > 0) {
-        // Read metadata in parallel
-        runFfprobe(this);
-      } else {
-        // Read metadata as soon as the first 'progress' listener is added
-        this.once('newListener', function(event) {
-          if (event === 'progress') {
-            runFfprobe(this);
-          }
-        });
-      }
-    }
-  };
-
-
-  /**
-   * Run ffmpeg command
-   *
-   * @method FfmpegCommand#run
-   * @category Processing
-   * @aliases exec,execute
-   */
-  proto.exec =
-  proto.execute =
-  proto.run = function() {
-    var self = this;
-
-    // Check if at least one output is present
-    var outputPresent = this._outputs.some(function(output) {
-      return 'target' in output;
-    });
-
-    if (!outputPresent) {
-      throw new Error('No output specified');
-    }
-
-    // Get output stream if any
-    var outputStream = this._outputs.filter(function(output) {
-      return typeof output.target !== 'string';
-    })[0];
-
-    // Get input stream if any
-    var inputStream = this._inputs.filter(function(input) {
-      return typeof input.source !== 'string';
-    })[0];
-
-    // Ensure we send 'end' or 'error' only once
-    var ended = false;
-    function emitEnd(err, stdout, stderr) {
-      if (!ended) {
-        ended = true;
-
-        if (err) {
-          self.emit('error', err, stdout, stderr);
-        } else {
-          self.emit('end', stdout, stderr);
-        }
-      }
-    }
-
-    self._prepare(function(err, args) {
-      if (err) {
-        return emitEnd(err);
-      }
-
-      // Run ffmpeg
-      self._spawnFfmpeg(
-        args,
-        {
-          captureStdout: !outputStream,
-          niceness: self.options.niceness,
-          cwd: self.options.cwd
-        },
-
-        function processCB(ffmpegProc, stdoutRing, stderrRing) {
-          self.ffmpegProc = ffmpegProc;
-          self.emit('start', 'ffmpeg ' + args.join(' '));
-
-          // Pipe input stream if any
-          if (inputStream) {
-            inputStream.source.on('error', function(err) {
-              emitEnd(new Error('Input stream error: ' + err.message));
-              ffmpegProc.kill();
-            });
-
-            inputStream.source.resume();
-            inputStream.source.pipe(ffmpegProc.stdin);
-
-            // Set stdin error handler on ffmpeg (prevents nodejs catching the error, but
-            // ffmpeg will fail anyway, so no need to actually handle anything)
-            ffmpegProc.stdin.on('error', function() {});
-          }
-
-          // Setup timeout if requested
-          var processTimer;
-          if (self.options.timeout) {
-            processTimer = setTimeout(function() {
-              var msg = 'process ran into a timeout (' + self.options.timeout + 's)';
-
-              emitEnd(new Error(msg), stdoutRing.get(), stderrRing.get());
-              ffmpegProc.kill();
-            }, self.options.timeout * 1000);
-          }
-
-
-          if (outputStream) {
-            // Pipe ffmpeg stdout to output stream
-            ffmpegProc.stdout.pipe(outputStream.target, outputStream.pipeopts);
-
-            // Handle output stream events
-            outputStream.target.on('close', function() {
-              self.logger.debug('Output stream closed, scheduling kill for ffmpgeg process');
-
-              // Don't kill process yet, to give a chance to ffmpeg to
-              // terminate successfully first  This is necessary because
-              // under load, the process 'exit' event sometimes happens
-              // after the output stream 'close' event.
-              setTimeout(function() {
-                emitEnd(new Error('Output stream closed'));
-                ffmpegProc.kill();
-              }, 20);
-            });
-
-            outputStream.target.on('error', function(err) {
-              self.logger.debug('Output stream error, killing ffmpgeg process');
-              emitEnd(new Error('Output stream error: ' + err.message), stdoutRing.get(), stderrRing.get());
-              ffmpegProc.kill();
-            });
-          }
-
-          // Setup stderr handling
-          if (stderrRing) {
-
-            // 'stderr' event
-            if (self.listeners('stderr').length) {
-              stderrRing.callback(function(line) {
-                self.emit('stderr', line);
-              });
-            }
-
-            // 'codecData' event
-            if (self.listeners('codecData').length) {
-              var codecDataSent = false;
-              var codecObject = {};
-
-              stderrRing.callback(function(line) {
-                if (!codecDataSent)
-                  codecDataSent = utils.extractCodecData(self, line, codecObject);
-              });
-            }
-
-            // 'progress' event
-            if (self.listeners('progress').length) {
-              var duration = 0;
-
-              if (self._ffprobeData && self._ffprobeData.format && self._ffprobeData.format.duration) {
-                duration = Number(self._ffprobeData.format.duration);
-              }
-
-              stderrRing.callback(function(line) {
-                utils.extractProgress(self, line, duration);
-              });
-            }
-          }
-        },
-
-        function endCB(err, stdoutRing, stderrRing) {
-          delete self.ffmpegProc;
-
-          if (err) {
-            if (err.message.match(/ffmpeg exited with code/)) {
-              // Add ffmpeg error message
-              err.message += ': ' + utils.extractError(stderrRing.get());
-            }
-
-            emitEnd(err, stdoutRing.get(), stderrRing.get());
-          } else {
-            // Find out which outputs need flv metadata
-            var flvmeta = self._outputs.filter(function(output) {
-              return output.flags.flvmeta;
-            });
-
-            if (flvmeta.length) {
-              self._getFlvtoolPath(function(err, flvtool) {
-                if (err) {
-                  return emitEnd(err);
-                }
-
-                async.each(
-                  flvmeta,
-                  function(output, cb) {
-                    spawn(flvtool, ['-U', output.target])
-                      .on('error', function(err) {
-                        cb(new Error('Error running ' + flvtool + ' on ' + output.target + ': ' + err.message));
-                      })
-                      .on('exit', function(code, signal) {
-                        if (code !== 0 || signal) {
-                          cb(
-                            new Error(flvtool + ' ' +
-                              (signal ? 'received signal ' + signal
-                                      : 'exited with code ' + code)) +
-                              ' when running on ' + output.target
-                          );
-                        } else {
-                          cb();
-                        }
-                      });
-                  },
-                  function(err) {
-                    if (err) {
-                      emitEnd(err);
-                    } else {
-                      emitEnd(null, stdoutRing.get(), stderrRing.get());
-                    }
-                  }
-                );
-              });
-            } else {
-              emitEnd(null, stdoutRing.get(), stderrRing.get());
-            }
-          }
-        }
-      );
-    });
-  };
-
-
-  /**
-   * Renice current and/or future ffmpeg processes
-   *
-   * Ignored on Windows platforms.
-   *
-   * @method FfmpegCommand#renice
-   * @category Processing
-   *
-   * @param {Number} [niceness=0] niceness value between -20 (highest priority) and 20 (lowest priority)
-   * @return FfmpegCommand
-   */
-  proto.renice = function(niceness) {
-    if (!utils.isWindows) {
-      niceness = niceness || 0;
-
-      if (niceness < -20 || niceness > 20) {
-        this.logger.warn('Invalid niceness value: ' + niceness + ', must be between -20 and 20');
-      }
-
-      niceness = Math.min(20, Math.max(-20, niceness));
-      this.options.niceness = niceness;
-
-      if (this.ffmpegProc) {
-        var logger = this.logger;
-        var pid = this.ffmpegProc.pid;
-        var renice = spawn('renice', [niceness, '-p', pid]);
-
-        renice.on('error', function(err) {
-          logger.warn('could not renice process ' + pid + ': ' + err.message);
-        });
-
-        renice.on('exit', function(code, signal) {
-          if (signal) {
-            logger.warn('could not renice process ' + pid + ': renice was killed by signal ' + signal);
-          } else if (code) {
-            logger.warn('could not renice process ' + pid + ': renice exited with ' + code);
-          } else {
-            logger.info('successfully reniced process ' + pid + ' to ' + niceness + ' niceness');
-          }
-        });
-      }
-    }
-
-    return this;
-  };
-
-
-  /**
-   * Kill current ffmpeg process, if any
-   *
-   * @method FfmpegCommand#kill
-   * @category Processing
-   *
-   * @param {String} [signal=SIGKILL] signal name
-   * @return FfmpegCommand
-   */
-  proto.kill = function(signal) {
-    if (!this.ffmpegProc) {
-      this.logger.warn('No running ffmpeg process, cannot send signal');
-    } else {
-      this.ffmpegProc.kill(signal || 'SIGKILL');
-    }
-
-    return this;
-  };
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/doc/recipes.js.html b/doc/recipes.js.html deleted file mode 100644 index 4bfc6985..00000000 --- a/doc/recipes.js.html +++ /dev/null @@ -1,506 +0,0 @@ - - - - - JSDoc: Source: recipes.js - - - - - - - - - - -
- -

Source: recipes.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-var fs = require('fs');
-var path = require('path');
-var PassThrough = require('stream').PassThrough;
-var async = require('async');
-var utils = require('./utils');
-
-
-/*
- * Useful recipes for commands
- */
-
-module.exports = function recipes(proto) {
-  /**
-   * Execute ffmpeg command and save output to a file
-   *
-   * @method FfmpegCommand#save
-   * @category Processing
-   * @aliases saveToFile
-   *
-   * @param {String} output file path
-   * @return FfmpegCommand
-   */
-  proto.saveToFile =
-  proto.save = function(output) {
-    this.output(output).run();
-    return this;
-  };
-
-
-  /**
-   * Execute ffmpeg command and save output to a stream
-   *
-   * If 'stream' is not specified, a PassThrough stream is created and returned.
-   * 'options' will be used when piping ffmpeg output to the output stream
-   * (@see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options)
-   *
-   * @method FfmpegCommand#pipe
-   * @category Processing
-   * @aliases stream,writeToStream
-   *
-   * @param {stream.Writable} [stream] output stream
-   * @param {Object} [options={}] pipe options
-   * @return Output stream
-   */
-  proto.writeToStream =
-  proto.pipe =
-  proto.stream = function(stream, options) {
-    if (stream && !('writable' in stream)) {
-      options = stream;
-      stream = undefined;
-    }
-
-    if (!stream) {
-      if (process.version.match(/v0\.8\./)) {
-        throw new Error('PassThrough stream is not supported on node v0.8');
-      }
-
-      stream = new PassThrough();
-    }
-
-    this.output(stream, options).run();
-    return stream;
-  };
-
-
-  /**
-   * Generate images from a video
-   *
-   * Note: this method makes the command emit a 'filenames' event with an array of
-   * the generated image filenames.
-   *
-   * @method FfmpegCommand#screenshots
-   * @category Processing
-   * @aliases takeScreenshots,thumbnail,thumbnails,screenshot
-   *
-   * @param {Number|Object} [config=1] screenshot count or configuration object with
-   *   the following keys:
-   * @param {Number} [config.count] number of screenshots to take; using this option
-   *   takes screenshots at regular intervals (eg. count=4 would take screens at 20%, 40%,
-   *   60% and 80% of the video length).
-   * @param {String} [config.folder='.'] output folder
-   * @param {String} [config.filename='tn.png'] output filename pattern, may contain the following
-   *   tokens:
-   *   - '%s': offset in seconds
-   *   - '%w': screenshot width
-   *   - '%h': screenshot height
-   *   - '%r': screenshot resolution (same as '%wx%h')
-   *   - '%f': input filename
-   *   - '%b': input basename (filename w/o extension)
-   *   - '%i': index of screenshot in timemark array (can be zero-padded by using it like `%000i`)
-   * @param {Number[]|String[]} [config.timemarks] array of timemarks to take screenshots
-   *   at; each timemark may be a number of seconds, a '[[hh:]mm:]ss[.xxx]' string or a
-   *   'XX%' string.  Overrides 'count' if present.
-   * @param {Number[]|String[]} [config.timestamps] alias for 'timemarks'
-   * @param {Boolean} [config.fastSeek] use fast seek (less accurate)
-   * @param {String} [config.size] screenshot size, with the same syntax as {@link FfmpegCommand#size}
-   * @param {String} [folder] output folder (legacy alias for 'config.folder')
-   * @return FfmpegCommand
-   */
-  proto.takeScreenshots =
-  proto.thumbnail =
-  proto.thumbnails =
-  proto.screenshot =
-  proto.screenshots = function(config, folder) {
-    var self = this;
-    var source = this._currentInput.source;
-    config = config || { count: 1 };
-
-    // Accept a number of screenshots instead of a config object
-    if (typeof config === 'number') {
-      config = {
-        count: config
-      };
-    }
-
-    // Accept a second 'folder' parameter instead of config.folder
-    if (!('folder' in config)) {
-      config.folder = folder || '.';
-    }
-
-    // Accept 'timestamps' instead of 'timemarks'
-    if ('timestamps' in config) {
-      config.timemarks = config.timestamps;
-    }
-
-    // Compute timemarks from count if not present
-    if (!('timemarks' in config)) {
-      if (!config.count) {
-        throw new Error('Cannot take screenshots: neither a count nor a timemark list are specified');
-      }
-
-      var interval = 100 / (1 + config.count);
-      config.timemarks = [];
-      for (var i = 0; i < config.count; i++) {
-        config.timemarks.push((interval * (i + 1)) + '%');
-      }
-    }
-
-    // Parse size option
-    if ('size' in config) {
-      var fixedSize = config.size.match(/^(\d+)x(\d+)$/);
-      var fixedWidth = config.size.match(/^(\d+)x\?$/);
-      var fixedHeight = config.size.match(/^\?x(\d+)$/);
-      var percentSize = config.size.match(/^(\d+)%$/);
-
-      if (!fixedSize && !fixedWidth && !fixedHeight && !percentSize) {
-        throw new Error('Invalid size parameter: ' + config.size);
-      }
-    }
-
-    // Metadata helper
-    var metadata;
-    function getMetadata(cb) {
-      if (metadata) {
-        cb(null, metadata);
-      } else {
-        self.ffprobe(function(err, meta) {
-          metadata = meta;
-          cb(err, meta);
-        });
-      }
-    }
-
-    async.waterfall([
-      // Compute percent timemarks if any
-      function computeTimemarks(next) {
-        if (config.timemarks.some(function(t) { return ('' + t).match(/^[\d.]+%$/); })) {
-          if (typeof source !== 'string') {
-            return next(new Error('Cannot compute screenshot timemarks with an input stream, please specify fixed timemarks'));
-          }
-
-          getMetadata(function(err, meta) {
-            if (err) {
-              next(err);
-            } else {
-              // Select video stream with the highest resolution
-              var vstream = meta.streams.reduce(function(biggest, stream) {
-                if (stream.codec_type === 'video' && stream.width * stream.height > biggest.width * biggest.height) {
-                  return stream;
-                } else {
-                  return biggest;
-                }
-              }, { width: 0, height: 0 });
-
-              if (vstream.width === 0) {
-                return next(new Error('No video stream in input, cannot take screenshots'));
-              }
-
-              var duration = Number(vstream.duration);
-              if (isNaN(duration)) {
-                duration = Number(meta.format.duration);
-              }
-
-              if (isNaN(duration)) {
-                return next(new Error('Could not get input duration, please specify fixed timemarks'));
-              }
-
-              config.timemarks = config.timemarks.map(function(mark) {
-                if (('' + mark).match(/^([\d.]+)%$/)) {
-                  return duration * parseFloat(mark) / 100;
-                } else {
-                  return mark;
-                }
-              });
-
-              next();
-            }
-          });
-        } else {
-          next();
-        }
-      },
-
-      // Turn all timemarks into numbers and sort them
-      function normalizeTimemarks(next) {
-        config.timemarks = config.timemarks.map(function(mark) {
-          return utils.timemarkToSeconds(mark);
-        }).sort(function(a, b) { return a - b; });
-
-        next();
-      },
-
-      // Add '_%i' to pattern when requesting multiple screenshots and no variable token is present
-      function fixPattern(next) {
-        var pattern = config.filename || 'tn.png';
-
-        if (pattern.indexOf('.') === -1) {
-          pattern += '.png';
-        }
-
-        if (config.timemarks.length > 1 && !pattern.match(/%(s|0*i)/)) {
-          var ext = path.extname(pattern);
-          pattern = path.join(path.dirname(pattern), path.basename(pattern, ext) + '_%i' + ext);
-        }
-
-        next(null, pattern);
-      },
-
-      // Replace filename tokens (%f, %b) in pattern
-      function replaceFilenameTokens(pattern, next) {
-        if (pattern.match(/%[bf]/)) {
-          if (typeof source !== 'string') {
-            return next(new Error('Cannot replace %f or %b when using an input stream'));
-          }
-
-          pattern = pattern
-            .replace(/%f/g, path.basename(source))
-            .replace(/%b/g, path.basename(source, path.extname(source)));
-        }
-
-        next(null, pattern);
-      },
-
-      // Compute size if needed
-      function getSize(pattern, next) {
-        if (pattern.match(/%[whr]/)) {
-          if (fixedSize) {
-            return next(null, pattern, fixedSize[1], fixedSize[2]);
-          }
-
-          getMetadata(function(err, meta) {
-            if (err) {
-              return next(new Error('Could not determine video resolution to replace %w, %h or %r'));
-            }
-
-            var vstream = meta.streams.reduce(function(biggest, stream) {
-              if (stream.codec_type === 'video' && stream.width * stream.height > biggest.width * biggest.height) {
-                return stream;
-              } else {
-                return biggest;
-              }
-            }, { width: 0, height: 0 });
-
-            if (vstream.width === 0) {
-              return next(new Error('No video stream in input, cannot replace %w, %h or %r'));
-            }
-
-            var width = vstream.width;
-            var height = vstream.height;
-
-            if (fixedWidth) {
-              height = height * Number(fixedWidth[1]) / width;
-              width = Number(fixedWidth[1]);
-            } else if (fixedHeight) {
-              width = width * Number(fixedHeight[1]) / height;
-              height = Number(fixedHeight[1]);
-            } else if (percentSize) {
-              width = width * Number(percentSize[1]) / 100;
-              height = height * Number(percentSize[1]) / 100;
-            }
-
-            next(null, pattern, Math.round(width / 2) * 2, Math.round(height / 2) * 2);
-          });
-        } else {
-          next(null, pattern, -1, -1);
-        }
-      },
-
-      // Replace size tokens (%w, %h, %r) in pattern
-      function replaceSizeTokens(pattern, width, height, next) {
-        pattern = pattern
-          .replace(/%r/g, '%wx%h')
-          .replace(/%w/g, width)
-          .replace(/%h/g, height);
-
-        next(null, pattern);
-      },
-
-      // Replace variable tokens in pattern (%s, %i) and generate filename list
-      function replaceVariableTokens(pattern, next) {
-        var filenames = config.timemarks.map(function(t, i) {
-          return pattern
-            .replace(/%s/g, utils.timemarkToSeconds(t))
-            .replace(/%(0*)i/g, function(match, padding) {
-              var idx = '' + (i + 1);
-              return padding.substr(0, Math.max(0, padding.length + 1 - idx.length)) + idx;
-            });
-        });
-
-        self.emit('filenames', filenames);
-        next(null, filenames);
-      },
-
-      // Create output directory
-      function createDirectory(filenames, next) {
-        fs.exists(config.folder, function(exists) {
-          if (!exists) {
-            fs.mkdir(config.folder, function(err) {
-              if (err) {
-                next(err);
-              } else {
-                next(null, filenames);
-              }
-            });
-          } else {
-            next(null, filenames);
-          }
-        });
-      }
-    ], function runCommand(err, filenames) {
-      if (err) {
-        return self.emit('error', err);
-      }
-
-      var count = config.timemarks.length;
-      var split;
-      var filters = [split = {
-        filter: 'split',
-        options: count,
-        outputs: []
-      }];
-
-      if ('size' in config) {
-        // Set size to generate size filters
-        self.size(config.size);
-
-        // Get size filters and chain them with 'sizeN' stream names
-        var sizeFilters =  self._currentOutput.sizeFilters.get().map(function(f, i) {
-          if (i > 0) {
-            f.inputs = 'size' + (i - 1);
-          }
-
-          f.outputs = 'size' + i;
-
-          return f;
-        });
-
-        // Input last size filter output into split filter
-        split.inputs = 'size' + (sizeFilters.length - 1);
-
-        // Add size filters in front of split filter
-        filters = sizeFilters.concat(filters);
-
-        // Remove size filters
-        self._currentOutput.sizeFilters.clear();
-      }
-
-      var first = 0;
-      for (var i = 0; i < count; i++) {
-        var stream = 'screen' + i;
-        split.outputs.push(stream);
-
-        if (i === 0) {
-          first = config.timemarks[i];
-          self.seekInput(first);
-        }
-
-        self.output(path.join(config.folder, filenames[i]))
-          .frames(1)
-          .map(stream);
-
-        if (i > 0) {
-          self.seek(config.timemarks[i] - first);
-        }
-      }
-
-      self.complexFilter(filters);
-      self.run();
-    });
-
-    return this;
-  };
-
-
-  /**
-   * Merge (concatenate) inputs to a single file
-   *
-   * @method FfmpegCommand#concat
-   * @category Processing
-   * @aliases concatenate,mergeToFile
-   *
-   * @param {String|Writable} target output file or writable stream
-   * @param {Object} [options] pipe options (only used when outputting to a writable stream)
-   * @return FfmpegCommand
-   */
-  proto.mergeToFile =
-  proto.concatenate =
-  proto.concat = function(target, options) {
-    // Find out which streams are present in the first non-stream input
-    var fileInput = this._inputs.filter(function(input) {
-      return !input.isStream;
-    })[0];
-
-    var self = this;
-    this.ffprobe(this._inputs.indexOf(fileInput), function(err, data) {
-      if (err) {
-        return self.emit('error', err);
-      }
-
-      var hasAudioStreams = data.streams.some(function(stream) {
-        return stream.codec_type === 'audio';
-      });
-
-      var hasVideoStreams = data.streams.some(function(stream) {
-        return stream.codec_type === 'video';
-      });
-
-      // Setup concat filter and start processing
-      self.output(target, options)
-        .complexFilter({
-          filter: 'concat',
-          options: {
-            n: self._inputs.length,
-            v: hasVideoStreams ? 1 : 0,
-            a: hasAudioStreams ? 1 : 0
-          }
-        })
-        .run();
-    });
-
-    return this;
-  };
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/doc/scripts/linenumber.js b/doc/scripts/linenumber.js deleted file mode 100644 index 8d52f7ea..00000000 --- a/doc/scripts/linenumber.js +++ /dev/null @@ -1,25 +0,0 @@ -/*global document */ -(function() { - var source = document.getElementsByClassName('prettyprint source linenums'); - var i = 0; - var lineNumber = 0; - var lineId; - var lines; - var totalLines; - var anchorHash; - - if (source && source[0]) { - anchorHash = document.location.hash.substring(1); - lines = source[0].getElementsByTagName('li'); - totalLines = lines.length; - - for (; i < totalLines; i++) { - lineNumber++; - lineId = 'line' + lineNumber; - lines[i].id = lineId; - if (lineId === anchorHash) { - lines[i].className += ' selected'; - } - } - } -})(); diff --git a/doc/scripts/prettify/Apache-License-2.0.txt b/doc/scripts/prettify/Apache-License-2.0.txt deleted file mode 100644 index d6456956..00000000 --- a/doc/scripts/prettify/Apache-License-2.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/doc/scripts/prettify/lang-css.js b/doc/scripts/prettify/lang-css.js deleted file mode 100644 index 041e1f59..00000000 --- a/doc/scripts/prettify/lang-css.js +++ /dev/null @@ -1,2 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", -/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/doc/scripts/prettify/prettify.js b/doc/scripts/prettify/prettify.js deleted file mode 100644 index eef5ad7e..00000000 --- a/doc/scripts/prettify/prettify.js +++ /dev/null @@ -1,28 +0,0 @@ -var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; -(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= -[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), -l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, -q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, -q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, -"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), -a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} -for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], -"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], -H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], -J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ -I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), -["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", -/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), -["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", -hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= -!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p h2 { - margin-top: 6px; -} - -h3 -{ - font-size: 150%; - font-weight: bold; - letter-spacing: -0.01em; - margin-top: 16px; - margin: 50px 0 3px 0; -} - -h4 -{ - font-size: 130%; - font-weight: bold; - letter-spacing: -0.01em; - margin-top: 16px; - margin: 18px 0 3px 0; - color: #526492; -} - -h5, .container-overview .subsection-title -{ - font-size: 120%; - font-weight: bold; - letter-spacing: -0.01em; - margin: 8px 0 3px -16px; -} - -h6 -{ - font-size: 100%; - letter-spacing: -0.01em; - margin: 6px 0 3px 0; - font-style: italic; -} - -article > dl, article > pre { - margin-left: 2em; -} - -.ancestors { color: #999; } -.ancestors a -{ - color: #999 !important; - text-decoration: none; -} - -.important -{ - font-weight: bold; - color: #950B02; -} - -.yes-def { - text-indent: -1000px; -} - -.type-signature { - color: #aaa; -} - -.name, .signature { - font-family: Consolas, "Lucida Console", Monaco, monospace; -} - -.details { margin-top: 14px; border-left: 2px solid #DDD; } -.details dt { width:100px; float:left; padding-left: 10px; padding-top: 6px; } -.details dd { margin-left: 50px; } -.details ul { margin: 0; } -.details ul { list-style-type: none; } -.details li { margin-left: 30px; padding-top: 6px; } -.details pre.prettyprint { margin: 0 } -.details .object-value { padding-top: 0; } - -.description { - margin-bottom: 1em; - margin-left: -16px; - margin-top: 1em; -} - -.code-caption -{ - font-style: italic; - font-family: Palatino, 'Palatino Linotype', serif; - font-size: 107%; - margin: 0; -} - -.prettyprint -{ - border: 1px solid #ddd; - width: 80%; - overflow: auto; -} - -.prettyprint.source { - width: inherit; -} - -.prettyprint code -{ - font-family: Consolas, 'Lucida Console', Monaco, monospace; - font-size: 100%; - line-height: 18px; - display: block; - padding: 4px 12px; - margin: 0; - background-color: #fff; - color: #000; -} - -.prettyprint code span.line -{ - display: inline-block; -} - -.prettyprint.linenums -{ - padding-left: 70px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.prettyprint.linenums ol -{ - padding-left: 0; -} - -.prettyprint.linenums li -{ - border-left: 3px #ddd solid; -} - -.prettyprint.linenums li.selected, -.prettyprint.linenums li.selected * -{ - background-color: lightyellow; -} - -.prettyprint.linenums li * -{ - -webkit-user-select: text; - -moz-user-select: text; - -ms-user-select: text; - user-select: text; -} - -.params, .props -{ - border-spacing: 0; - border: 0; - border-collapse: collapse; -} - -.params .name, .props .name, .name code { - color: #526492; - font-family: Consolas, 'Lucida Console', Monaco, monospace; - font-size: 100%; -} - -.params td, .params th, .props td, .props th -{ - border: 1px solid #ddd; - margin: 0px; - text-align: left; - vertical-align: top; - padding: 4px 6px; - display: table-cell; -} - -.params thead tr, .props thead tr -{ - background-color: #ddd; - font-weight: bold; -} - -.params .params thead tr, .props .props thead tr -{ - background-color: #fff; - font-weight: bold; -} - -.params th, .props th { border-right: 1px solid #aaa; } -.params thead .last, .props thead .last { border-right: 1px solid #ddd; } - -.params td.description > p:first-child -{ - margin-top: 0; - padding-top: 0; -} - -.params td.description > p:last-child -{ - margin-bottom: 0; - padding-bottom: 0; -} - -.disabled { - color: #454545; -} diff --git a/doc/styles/prettify-jsdoc.css b/doc/styles/prettify-jsdoc.css deleted file mode 100644 index 5a2526e3..00000000 --- a/doc/styles/prettify-jsdoc.css +++ /dev/null @@ -1,111 +0,0 @@ -/* JSDoc prettify.js theme */ - -/* plain text */ -.pln { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* string content */ -.str { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a keyword */ -.kwd { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a comment */ -.com { - font-weight: normal; - font-style: italic; -} - -/* a type name */ -.typ { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* a literal value */ -.lit { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* punctuation */ -.pun { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* lisp open bracket */ -.opn { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* lisp close bracket */ -.clo { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a markup tag name */ -.tag { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a markup attribute name */ -.atn { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a markup attribute value */ -.atv { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a declaration */ -.dec { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a variable name */ -.var { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* a function name */ -.fun { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* Specify class=linenums on a pre to get line numbering */ -ol.linenums { - margin-top: 0; - margin-bottom: 0; -} diff --git a/doc/styles/prettify-tomorrow.css b/doc/styles/prettify-tomorrow.css deleted file mode 100644 index aa2908c2..00000000 --- a/doc/styles/prettify-tomorrow.css +++ /dev/null @@ -1,132 +0,0 @@ -/* Tomorrow Theme */ -/* Original theme - https://github.com/chriskempson/tomorrow-theme */ -/* Pretty printing styles. Used with prettify.js. */ -/* SPAN elements with the classes below are added by prettyprint. */ -/* plain text */ -.pln { - color: #4d4d4c; } - -@media screen { - /* string content */ - .str { - color: #718c00; } - - /* a keyword */ - .kwd { - color: #8959a8; } - - /* a comment */ - .com { - color: #8e908c; } - - /* a type name */ - .typ { - color: #4271ae; } - - /* a literal value */ - .lit { - color: #f5871f; } - - /* punctuation */ - .pun { - color: #4d4d4c; } - - /* lisp open bracket */ - .opn { - color: #4d4d4c; } - - /* lisp close bracket */ - .clo { - color: #4d4d4c; } - - /* a markup tag name */ - .tag { - color: #c82829; } - - /* a markup attribute name */ - .atn { - color: #f5871f; } - - /* a markup attribute value */ - .atv { - color: #3e999f; } - - /* a declaration */ - .dec { - color: #f5871f; } - - /* a variable name */ - .var { - color: #c82829; } - - /* a function name */ - .fun { - color: #4271ae; } } -/* Use higher contrast and text-weight for printable form. */ -@media print, projection { - .str { - color: #060; } - - .kwd { - color: #006; - font-weight: bold; } - - .com { - color: #600; - font-style: italic; } - - .typ { - color: #404; - font-weight: bold; } - - .lit { - color: #044; } - - .pun, .opn, .clo { - color: #440; } - - .tag { - color: #006; - font-weight: bold; } - - .atn { - color: #404; } - - .atv { - color: #060; } } -/* Style */ -/* -pre.prettyprint { - background: white; - font-family: Menlo, Monaco, Consolas, monospace; - font-size: 12px; - line-height: 1.5; - border: 1px solid #ccc; - padding: 10px; } -*/ - -/* Specify class=linenums on a pre to get line numbering */ -ol.linenums { - margin-top: 0; - margin-bottom: 0; } - -/* IE indents via margin-left */ -li.L0, -li.L1, -li.L2, -li.L3, -li.L4, -li.L5, -li.L6, -li.L7, -li.L8, -li.L9 { - /* */ } - -/* Alternate shading for lines */ -li.L1, -li.L3, -li.L5, -li.L7, -li.L9 { - /* */ } diff --git a/doc/utils.js.html b/doc/utils.js.html deleted file mode 100644 index 7fef79ac..00000000 --- a/doc/utils.js.html +++ /dev/null @@ -1,505 +0,0 @@ - - - - - JSDoc: Source: utils.js - - - - - - - - - - -
- -

Source: utils.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-var exec = require('child_process').exec;
-var isWindows = require('os').platform().match(/win(32|64)/);
-var which = require('which');
-
-var nlRegexp = /\r\n|\r|\n/g;
-var streamRegexp = /^\[?(.*?)\]?$/;
-var filterEscapeRegexp = /[,]/;
-var whichCache = {};
-
-/**
- * Parse progress line from ffmpeg stderr
- *
- * @param {String} line progress line
- * @return progress object
- * @private
- */
-function parseProgressLine(line) {
-  var progress = {};
-
-  // Remove all spaces after = and trim
-  line  = line.replace(/=\s+/g, '=').trim();
-  var progressParts = line.split(' ');
-
-  // Split every progress part by "=" to get key and value
-  for(var i = 0; i < progressParts.length; i++) {
-    var progressSplit = progressParts[i].split('=', 2);
-    var key = progressSplit[0];
-    var value = progressSplit[1];
-
-    // This is not a progress line
-    if(typeof value === 'undefined')
-      return null;
-
-    progress[key] = value;
-  }
-
-  return progress;
-}
-
-
-var utils = module.exports = {
-  isWindows: isWindows,
-  streamRegexp: streamRegexp,
-
-
-  /**
-   * Copy an object keys into another one
-   *
-   * @param {Object} source source object
-   * @param {Object} dest destination object
-   * @private
-   */
-  copy: function(source, dest) {
-    Object.keys(source).forEach(function(key) {
-      dest[key] = source[key];
-    });
-  },
-
-
-  /**
-   * Create an argument list
-   *
-   * Returns a function that adds new arguments to the list.
-   * It also has the following methods:
-   * - clear() empties the argument list
-   * - get() returns the argument list
-   * - find(arg, count) finds 'arg' in the list and return the following 'count' items, or undefined if not found
-   * - remove(arg, count) remove 'arg' in the list as well as the following 'count' items
-   *
-   * @private
-   */
-  args: function() {
-    var list = [];
-
-    // Append argument(s) to the list
-    var argfunc = function() {
-      if (arguments.length === 1 && Array.isArray(arguments[0])) {
-        list = list.concat(arguments[0]);
-      } else {
-        list = list.concat([].slice.call(arguments));
-      }
-    };
-
-    // Clear argument list
-    argfunc.clear = function() {
-      list = [];
-    };
-
-    // Return argument list
-    argfunc.get = function() {
-      return list;
-    };
-
-    // Find argument 'arg' in list, and if found, return an array of the 'count' items that follow it
-    argfunc.find = function(arg, count) {
-      var index = list.indexOf(arg);
-      if (index !== -1) {
-        return list.slice(index + 1, index + 1 + (count || 0));
-      }
-    };
-
-    // Find argument 'arg' in list, and if found, remove it as well as the 'count' items that follow it
-    argfunc.remove = function(arg, count) {
-      var index = list.indexOf(arg);
-      if (index !== -1) {
-        list.splice(index, (count || 0) + 1);
-      }
-    };
-
-    // Clone argument list
-    argfunc.clone = function() {
-      var cloned = utils.args();
-      cloned(list);
-      return cloned;
-    };
-
-    return argfunc;
-  },
-
-
-  /**
-   * Generate filter strings
-   *
-   * @param {String[]|Object[]} filters filter specifications. When using objects,
-   *   each must have the following properties:
-   * @param {String} filters.filter filter name
-   * @param {String|Array} [filters.inputs] (array of) input stream specifier(s) for the filter,
-   *   defaults to ffmpeg automatically choosing the first unused matching streams
-   * @param {String|Array} [filters.outputs] (array of) output stream specifier(s) for the filter,
-   *   defaults to ffmpeg automatically assigning the output to the output file
-   * @param {Object|String|Array} [filters.options] filter options, can be omitted to not set any options
-   * @return String[]
-   * @private
-   */
-  makeFilterStrings: function(filters) {
-    return filters.map(function(filterSpec) {
-      if (typeof filterSpec === 'string') {
-        return filterSpec;
-      }
-
-      var filterString = '';
-
-      // Filter string format is:
-      // [input1][input2]...filter[output1][output2]...
-      // The 'filter' part can optionaly have arguments:
-      //   filter=arg1:arg2:arg3
-      //   filter=arg1=v1:arg2=v2:arg3=v3
-
-      // Add inputs
-      if (Array.isArray(filterSpec.inputs)) {
-        filterString += filterSpec.inputs.map(function(streamSpec) {
-          return streamSpec.replace(streamRegexp, '[$1]');
-        }).join('');
-      } else if (typeof filterSpec.inputs === 'string') {
-        filterString += filterSpec.inputs.replace(streamRegexp, '[$1]');
-      }
-
-      // Add filter
-      filterString += filterSpec.filter;
-
-      // Add options
-      if (filterSpec.options) {
-        if (typeof filterSpec.options === 'string' || typeof filterSpec.options === 'number') {
-          // Option string
-          filterString += '=' + filterSpec.options;
-        } else if (Array.isArray(filterSpec.options)) {
-          // Option array (unnamed options)
-          filterString += '=' + filterSpec.options.map(function(option) {
-            if (typeof option === 'string' && option.match(filterEscapeRegexp)) {
-              return '\'' + option + '\'';
-            } else {
-              return option;
-            }
-          }).join(':');
-        } else if (Object.keys(filterSpec.options).length) {
-          // Option object (named options)
-          filterString += '=' + Object.keys(filterSpec.options).map(function(option) {
-            var value = filterSpec.options[option];
-
-            if (typeof value === 'string' && value.match(filterEscapeRegexp)) {
-              value = '\'' + value + '\'';
-            }
-
-            return option + '=' + value;
-          }).join(':');
-        }
-      }
-
-      // Add outputs
-      if (Array.isArray(filterSpec.outputs)) {
-        filterString += filterSpec.outputs.map(function(streamSpec) {
-          return streamSpec.replace(streamRegexp, '[$1]');
-        }).join('');
-      } else if (typeof filterSpec.outputs === 'string') {
-        filterString += filterSpec.outputs.replace(streamRegexp, '[$1]');
-      }
-
-      return filterString;
-    });
-  },
-
-
-  /**
-   * Search for an executable
-   *
-   * Uses 'which' or 'where' depending on platform
-   *
-   * @param {String} name executable name
-   * @param {Function} callback callback with signature (err, path)
-   * @private
-   */
-  which: function(name, callback) {
-    if (name in whichCache) {
-      return callback(null, whichCache[name]);
-    }
-
-    which(name, function(err, result){
-      if (err) {
-        // Treat errors as not found
-        return callback(null, whichCache[name] = '');
-      }
-      callback(null, whichCache[name] = result);
-    });
-  },
-
-
-  /**
-   * Convert a [[hh:]mm:]ss[.xxx] timemark into seconds
-   *
-   * @param {String} timemark timemark string
-   * @return Number
-   * @private
-   */
-  timemarkToSeconds: function(timemark) {
-    if (typeof timemark === 'number') {
-      return timemark;
-    }
-
-    if (timemark.indexOf(':') === -1 && timemark.indexOf('.') >= 0) {
-      return Number(timemark);
-    }
-
-    var parts = timemark.split(':');
-
-    // add seconds
-    var secs = Number(parts.pop());
-
-    if (parts.length) {
-      // add minutes
-      secs += Number(parts.pop()) * 60;
-    }
-
-    if (parts.length) {
-      // add hours
-      secs += Number(parts.pop()) * 3600;
-    }
-
-    return secs;
-  },
-
-
-  /**
-   * Extract codec data from ffmpeg stderr and emit 'codecData' event if appropriate
-   * Call it with an initially empty codec object once with each line of stderr output until it returns true
-   *
-   * @param {FfmpegCommand} command event emitter
-   * @param {String} stderrLine ffmpeg stderr output line
-   * @param {Object} codecObject object used to accumulate codec data between calls
-   * @return {Boolean} true if codec data is complete (and event was emitted), false otherwise
-   * @private
-   */
-  extractCodecData: function(command, stderrLine, codecsObject) {
-    var inputPattern = /Input #[0-9]+, ([^ ]+),/;
-    var durPattern = /Duration\: ([^,]+)/;
-    var audioPattern = /Audio\: (.*)/;
-    var videoPattern = /Video\: (.*)/;
-
-    if (!('inputStack' in codecsObject)) {
-      codecsObject.inputStack = [];
-      codecsObject.inputIndex = -1;
-      codecsObject.inInput = false;
-    }
-
-    var inputStack = codecsObject.inputStack;
-    var inputIndex = codecsObject.inputIndex;
-    var inInput = codecsObject.inInput;
-
-    var format, dur, audio, video;
-
-    if (format = stderrLine.match(inputPattern)) {
-      inInput = codecsObject.inInput = true;
-      inputIndex = codecsObject.inputIndex = codecsObject.inputIndex + 1;
-
-      inputStack[inputIndex] = { format: format[1], audio: '', video: '', duration: '' };
-    } else if (inInput && (dur = stderrLine.match(durPattern))) {
-      inputStack[inputIndex].duration = dur[1];
-    } else if (inInput && (audio = stderrLine.match(audioPattern))) {
-      audio = audio[1].split(', ');
-      inputStack[inputIndex].audio = audio[0];
-      inputStack[inputIndex].audio_details = audio;
-    } else if (inInput && (video = stderrLine.match(videoPattern))) {
-      video = video[1].split(', ');
-      inputStack[inputIndex].video = video[0];
-      inputStack[inputIndex].video_details = video;
-    } else if (/Output #\d+/.test(stderrLine)) {
-      inInput = codecsObject.inInput = false;
-    } else if (/Stream mapping:|Press (\[q\]|ctrl-c) to stop/.test(stderrLine)) {
-      command.emit.apply(command, ['codecData'].concat(inputStack));
-      return true;
-    }
-
-    return false;
-  },
-
-
-  /**
-   * Extract progress data from ffmpeg stderr and emit 'progress' event if appropriate
-   *
-   * @param {FfmpegCommand} command event emitter
-   * @param {String} stderrLine ffmpeg stderr data
-   * @param {Number} [duration=0] expected output duration in seconds
-   * @private
-   */
-  extractProgress: function(command, stderrLine, duration) {
-    var progress = parseProgressLine(stderrLine);
-
-    if (progress) {
-      // build progress report object
-      var ret = {
-        frames: parseInt(progress.frame, 10),
-        currentFps: parseInt(progress.fps, 10),
-        currentKbps: progress.bitrate ? parseFloat(progress.bitrate.replace('kbits/s', '')) : 0,
-        targetSize: parseInt(progress.size, 10),
-        timemark: progress.time
-      };
-
-      // calculate percent progress using duration
-      if (duration && duration > 0) {
-        ret.percent = (utils.timemarkToSeconds(ret.timemark) / duration) * 100;
-      }
-
-      command.emit('progress', ret);
-    }
-  },
-
-
-  /**
-   * Extract error message(s) from ffmpeg stderr
-   *
-   * @param {String} stderr ffmpeg stderr data
-   * @return {String}
-   * @private
-   */
-  extractError: function(stderr) {
-    // Only return the last stderr lines that don't start with a space or a square bracket
-    return stderr.split(nlRegexp).reduce(function(messages, message) {
-      if (message.charAt(0) === ' ' || message.charAt(0) === '[') {
-        return [];
-      } else {
-        messages.push(message);
-        return messages;
-      }
-    }, []).join('\n');
-  },
-
-
-  /**
-   * Creates a line ring buffer object with the following methods:
-   * - append(str) : appends a string or buffer
-   * - get() : returns the whole string
-   * - close() : prevents further append() calls and does a last call to callbacks
-   * - callback(cb) : calls cb for each line (incl. those already in the ring)
-   *
-   * @param {Numebr} maxLines maximum number of lines to store (<= 0 for unlimited)
-   */
-  linesRing: function(maxLines) {
-    var cbs = [];
-    var lines = [];
-    var current = null;
-    var closed = false
-    var max = maxLines - 1;
-
-    function emit(line) {
-      cbs.forEach(function(cb) { cb(line); });
-    }
-
-    return {
-      callback: function(cb) {
-        lines.forEach(function(l) { cb(l); });
-        cbs.push(cb);
-      },
-
-      append: function(str) {
-        if (closed) return;
-        if (str instanceof Buffer) str = '' + str;
-        if (!str || str.length === 0) return;
-
-        var newLines = str.split(nlRegexp);
-
-        if (newLines.length === 1) {
-          if (current !== null) {
-            current = current + newLines.shift();
-          } else {
-            current = newLines.shift();
-          }
-        } else {
-          if (current !== null) {
-            current = current + newLines.shift();
-            emit(current);
-            lines.push(current);
-          }
-
-          current = newLines.pop();
-
-          newLines.forEach(function(l) {
-            emit(l);
-            lines.push(l);
-          });
-
-          if (max > -1 && lines.length > max) {
-            lines.splice(0, lines.length - max);
-          }
-        }
-      },
-
-      get: function() {
-        if (current !== null) {
-          return lines.concat([current]).join('\n');
-        } else {
-          return lines.join('\n');
-        }
-      },
-
-      close: function() {
-        if (closed) return;
-
-        if (current !== null) {
-          emit(current);
-          lines.push(current);
-
-          if (max > -1 && lines.length > max) {
-            lines.shift();
-          }
-
-          current = null;
-        }
-
-        closed = true;
-      }
-    };
-  }
-};
-
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.4.0 on Sun May 01 2016 12:10:37 GMT+0200 (CEST) -
- - - - - diff --git a/doc/video.js.html b/doc/video.js.html deleted file mode 100644 index 9d4089d8..00000000 --- a/doc/video.js.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - - JSDoc: Source: options/video.js - - - - - - - - - - -
- -

Source: options/video.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-var utils = require('../utils');
-
-
-/*
- *! Video-related methods
- */
-
-module.exports = function(proto) {
-  /**
-   * Disable video in the output
-   *
-   * @method FfmpegCommand#noVideo
-   * @category Video
-   * @aliases withNoVideo
-   *
-   * @return FfmpegCommand
-   */
-  proto.withNoVideo =
-  proto.noVideo = function() {
-    this._currentOutput.video.clear();
-    this._currentOutput.videoFilters.clear();
-    this._currentOutput.video('-vn');
-
-    return this;
-  };
-
-
-  /**
-   * Specify video codec
-   *
-   * @method FfmpegCommand#videoCodec
-   * @category Video
-   * @aliases withVideoCodec
-   *
-   * @param {String} codec video codec name
-   * @return FfmpegCommand
-   */
-  proto.withVideoCodec =
-  proto.videoCodec = function(codec) {
-    this._currentOutput.video('-vcodec', codec);
-    return this;
-  };
-
-
-  /**
-   * Specify video bitrate
-   *
-   * @method FfmpegCommand#videoBitrate
-   * @category Video
-   * @aliases withVideoBitrate
-   *
-   * @param {String|Number} bitrate video bitrate in kbps (with an optional 'k' suffix)
-   * @param {Boolean} [constant=false] enforce constant bitrate
-   * @return FfmpegCommand
-   */
-  proto.withVideoBitrate =
-  proto.videoBitrate = function(bitrate, constant) {
-    bitrate = ('' + bitrate).replace(/k?$/, 'k');
-
-    this._currentOutput.video('-b:v', bitrate);
-    if (constant) {
-      this._currentOutput.video(
-        '-maxrate', bitrate,
-        '-minrate', bitrate,
-        '-bufsize', '3M'
-      );
-    }
-
-    return this;
-  };
-
-
-  /**
-   * Specify custom video filter(s)
-   *
-   * Can be called both with one or many filters, or a filter array.
-   *
-   * @example
-   * command.videoFilters('filter1');
-   *
-   * @example
-   * command.videoFilters('filter1', 'filter2=param1=value1:param2=value2');
-   *
-   * @example
-   * command.videoFilters(['filter1', 'filter2']);
-   *
-   * @example
-   * command.videoFilters([
-   *   {
-   *     filter: 'filter1'
-   *   },
-   *   {
-   *     filter: 'filter2',
-   *     options: 'param=value:param=value'
-   *   }
-   * ]);
-   *
-   * @example
-   * command.videoFilters(
-   *   {
-   *     filter: 'filter1',
-   *     options: ['value1', 'value2']
-   *   },
-   *   {
-   *     filter: 'filter2',
-   *     options: { param1: 'value1', param2: 'value2' }
-   *   }
-   * );
-   *
-   * @method FfmpegCommand#videoFilters
-   * @category Video
-   * @aliases withVideoFilter,withVideoFilters,videoFilter
-   *
-   * @param {...String|String[]|Object[]} filters video filter strings, string array or
-   *   filter specification array, each with the following properties:
-   * @param {String} filters.filter filter name
-   * @param {String|String[]|Object} [filters.options] filter option string, array, or object
-   * @return FfmpegCommand
-   */
-  proto.withVideoFilter =
-  proto.withVideoFilters =
-  proto.videoFilter =
-  proto.videoFilters = function(filters) {
-    if (arguments.length > 1) {
-      filters = [].slice.call(arguments);
-    }
-
-    if (!Array.isArray(filters)) {
-      filters = [filters];
-    }
-
-    this._currentOutput.videoFilters(utils.makeFilterStrings(filters));
-
-    return this;
-  };
-
-
-  /**
-   * Specify output FPS
-   *
-   * @method FfmpegCommand#fps
-   * @category Video
-   * @aliases withOutputFps,withOutputFPS,withFpsOutput,withFPSOutput,withFps,withFPS,outputFPS,outputFps,fpsOutput,FPSOutput,FPS
-   *
-   * @param {Number} fps output FPS
-   * @return FfmpegCommand
-   */
-  proto.withOutputFps =
-  proto.withOutputFPS =
-  proto.withFpsOutput =
-  proto.withFPSOutput =
-  proto.withFps =
-  proto.withFPS =
-  proto.outputFPS =
-  proto.outputFps =
-  proto.fpsOutput =
-  proto.FPSOutput =
-  proto.fps =
-  proto.FPS = function(fps) {
-    this._currentOutput.video('-r', fps);
-    return this;
-  };
-
-
-  /**
-   * Only transcode a certain number of frames
-   *
-   * @method FfmpegCommand#frames
-   * @category Video
-   * @aliases takeFrames,withFrames
-   *
-   * @param {Number} frames frame count
-   * @return FfmpegCommand
-   */
-  proto.takeFrames =
-  proto.withFrames =
-  proto.frames = function(frames) {
-    this._currentOutput.video('-vframes', frames);
-    return this;
-  };
-};
-
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.3.0-alpha5 on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST) -
- - - - - diff --git a/doc/videosize.js.html b/doc/videosize.js.html deleted file mode 100644 index b94dfdab..00000000 --- a/doc/videosize.js.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - JSDoc: Source: options/videosize.js - - - - - - - - - - -
- -

Source: options/videosize.js

- - - - - -
-
-
/*jshint node:true*/
-'use strict';
-
-/*
- *! Size helpers
- */
-
-
-/**
- * Return filters to pad video to width*height,
- *
- * @param {Number} width output width
- * @param {Number} height output height
- * @param {Number} aspect video aspect ratio (without padding)
- * @param {Number} color padding color
- * @return scale/pad filters
- * @private
- */
-function getScalePadFilters(width, height, aspect, color) {
-  /*
-    let a be the input aspect ratio, A be the requested aspect ratio
-
-    if a > A, padding is done on top and bottom
-    if a < A, padding is done on left and right
-   */
-
-  return [
-    /*
-      In both cases, we first have to scale the input to match the requested size.
-      When using computed width/height, we truncate them to multiples of 2
-     */
-    {
-      filter: 'scale',
-      options: {
-        w: 'if(gt(a,' + aspect + '),' + width + ',trunc(' + height + '*a/2)*2)',
-        h: 'if(lt(a,' + aspect + '),' + height + ',trunc(' + width + '/a/2)*2)'
-      }
-    },
-
-    /*
-      Then we pad the scaled input to match the target size
-      (here iw and ih refer to the padding input, i.e the scaled output)
-     */
-
-    {
-      filter: 'pad',
-      options: {
-        w: width,
-        h: height,
-        x: 'if(gt(a,' + aspect + '),0,(' + width + '-iw)/2)',
-        y: 'if(lt(a,' + aspect + '),0,(' + height + '-ih)/2)',
-        color: color
-      }
-    }
-  ];
-}
-
-
-/**
- * Recompute size filters
- *
- * @param {Object} output
- * @param {String} key newly-added parameter name ('size', 'aspect' or 'pad')
- * @param {String} value newly-added parameter value
- * @return filter string array
- * @private
- */
-function createSizeFilters(output, key, value) {
-  // Store parameters
-  var data = output.sizeData = output.sizeData || {};
-  data[key] = value;
-
-  if (!('size' in data)) {
-    // No size requested, keep original size
-    return [];
-  }
-
-  // Try to match the different size string formats
-  var fixedSize = data.size.match(/([0-9]+)x([0-9]+)/);
-  var fixedWidth = data.size.match(/([0-9]+)x\?/);
-  var fixedHeight = data.size.match(/\?x([0-9]+)/);
-  var percentRatio = data.size.match(/\b([0-9]{1,3})%/);
-  var width, height, aspect;
-
-  if (percentRatio) {
-    var ratio = Number(percentRatio[1]) / 100;
-    return [{
-      filter: 'scale',
-      options: {
-        w: 'trunc(iw*' + ratio + '/2)*2',
-        h: 'trunc(ih*' + ratio + '/2)*2'
-      }
-    }];
-  } else if (fixedSize) {
-    // Round target size to multiples of 2
-    width = Math.round(Number(fixedSize[1]) / 2) * 2;
-    height = Math.round(Number(fixedSize[2]) / 2) * 2;
-
-    aspect = width / height;
-
-    if (data.pad) {
-      return getScalePadFilters(width, height, aspect, data.pad);
-    } else {
-      // No autopad requested, rescale to target size
-      return [{ filter: 'scale', options: { w: width, h: height }}];
-    }
-  } else if (fixedWidth || fixedHeight) {
-    if ('aspect' in data) {
-      // Specified aspect ratio
-      width = fixedWidth ? fixedWidth[1] : Math.round(Number(fixedHeight[1]) * data.aspect);
-      height = fixedHeight ? fixedHeight[1] : Math.round(Number(fixedWidth[1]) / data.aspect);
-
-      // Round to multiples of 2
-      width = Math.round(width / 2) * 2;
-      height = Math.round(height / 2) * 2;
-
-      if (data.pad) {
-        return getScalePadFilters(width, height, data.aspect, data.pad);
-      } else {
-        // No autopad requested, rescale to target size
-        return [{ filter: 'scale', options: { w: width, h: height }}];
-      }
-    } else {
-      // Keep input aspect ratio
-
-      if (fixedWidth) {
-        return [{
-          filter: 'scale',
-          options: {
-            w: Math.round(Number(fixedWidth[1]) / 2) * 2,
-            h: 'trunc(ow/a/2)*2'
-          }
-        }];
-      } else {
-        return [{
-          filter: 'scale',
-          options: {
-            w: 'trunc(oh*a/2)*2',
-            h: Math.round(Number(fixedHeight[1]) / 2) * 2
-          }
-        }];
-      }
-    }
-  } else {
-    throw new Error('Invalid size specified: ' + data.size);
-  }
-}
-
-
-/*
- *! Video size-related methods
- */
-
-module.exports = function(proto) {
-  /**
-   * Keep display aspect ratio
-   *
-   * This method is useful when converting an input with non-square pixels to an output format
-   * that does not support non-square pixels.  It rescales the input so that the display aspect
-   * ratio is the same.
-   *
-   * @method FfmpegCommand#keepDAR
-   * @category Video size
-   * @aliases keepPixelAspect,keepDisplayAspect,keepDisplayAspectRatio
-   *
-   * @return FfmpegCommand
-   */
-  proto.keepPixelAspect = // Only for compatibility, this is not about keeping _pixel_ aspect ratio
-  proto.keepDisplayAspect =
-  proto.keepDisplayAspectRatio =
-  proto.keepDAR = function() {
-    return this.videoFilters([
-      {
-        filter: 'scale',
-        options: {
-          w: 'if(gt(sar,1),iw*sar,iw)',
-          h: 'if(lt(sar,1),ih/sar,ih)'
-        }
-      },
-      {
-        filter: 'setsar',
-        options: '1'
-      }
-    ]);
-  };
-
-
-  /**
-   * Set output size
-   *
-   * The 'size' parameter can have one of 4 forms:
-   * - 'X%': rescale to xx % of the original size
-   * - 'WxH': specify width and height
-   * - 'Wx?': specify width and compute height from input aspect ratio
-   * - '?xH': specify height and compute width from input aspect ratio
-   *
-   * Note: both dimensions will be truncated to multiples of 2.
-   *
-   * @method FfmpegCommand#size
-   * @category Video size
-   * @aliases withSize,setSize
-   *
-   * @param {String} size size string, eg. '33%', '320x240', '320x?', '?x240'
-   * @return FfmpegCommand
-   */
-  proto.withSize =
-  proto.setSize =
-  proto.size = function(size) {
-    var filters = createSizeFilters(this._currentOutput, 'size', size);
-
-    this._currentOutput.sizeFilters.clear();
-    this._currentOutput.sizeFilters(filters);
-
-    return this;
-  };
-
-
-  /**
-   * Set output aspect ratio
-   *
-   * @method FfmpegCommand#aspect
-   * @category Video size
-   * @aliases withAspect,withAspectRatio,setAspect,setAspectRatio,aspectRatio
-   *
-   * @param {String|Number} aspect aspect ratio (number or 'X:Y' string)
-   * @return FfmpegCommand
-   */
-  proto.withAspect =
-  proto.withAspectRatio =
-  proto.setAspect =
-  proto.setAspectRatio =
-  proto.aspect =
-  proto.aspectRatio = function(aspect) {
-    var a = Number(aspect);
-    if (isNaN(a)) {
-      var match = aspect.match(/^(\d+):(\d+)$/);
-      if (match) {
-        a = Number(match[1]) / Number(match[2]);
-      } else {
-        throw new Error('Invalid aspect ratio: ' + aspect);
-      }
-    }
-
-    var filters = createSizeFilters(this._currentOutput, 'aspect', a);
-
-    this._currentOutput.sizeFilters.clear();
-    this._currentOutput.sizeFilters(filters);
-
-    return this;
-  };
-
-
-  /**
-   * Enable auto-padding the output
-   *
-   * @method FfmpegCommand#autopad
-   * @category Video size
-   * @aliases applyAutopadding,applyAutoPadding,applyAutopad,applyAutoPad,withAutopadding,withAutoPadding,withAutopad,withAutoPad,autoPad
-   *
-   * @param {Boolean} [pad=true] enable/disable auto-padding
-   * @param {String} [color='black'] pad color
-   */
-  proto.applyAutopadding =
-  proto.applyAutoPadding =
-  proto.applyAutopad =
-  proto.applyAutoPad =
-  proto.withAutopadding =
-  proto.withAutoPadding =
-  proto.withAutopad =
-  proto.withAutoPad =
-  proto.autoPad =
-  proto.autopad = function(pad, color) {
-    // Allow autopad(color)
-    if (typeof pad === 'string') {
-      color = pad;
-      pad = true;
-    }
-
-    // Allow autopad() and autopad(undefined, color)
-    if (typeof pad === 'undefined') {
-      pad = true;
-    }
-
-    var filters = createSizeFilters(this._currentOutput, 'pad', pad ? color || 'black' : false);
-
-    this._currentOutput.sizeFilters.clear();
-    this._currentOutput.sizeFilters(filters);
-
-    return this;
-  };
-};
-
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.3.0-alpha5 on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST) -
- - - - - diff --git a/examples/any-to-mp4-steam.js b/examples/any-to-mp4-steam.js deleted file mode 100644 index c78f93ca..00000000 --- a/examples/any-to-mp4-steam.js +++ /dev/null @@ -1,16 +0,0 @@ -// The solution based on adding -movflags for mp4 output -// For more movflags details check ffmpeg docs -// https://ffmpeg.org/ffmpeg-formats.html#toc-Options-9 - -var fs = require('fs'); -var path = require('path'); -var ffmpeg = require('../index'); - -var pathToSourceFile = path.resolve(__dirname, '../test/assets/testvideo-169.avi'); -var readStream = fs.createReadStream(pathToSourceFile); -var writeStream = fs.createWriteStream('./output.mp4'); - -ffmpeg(readStream) - .addOutputOptions('-movflags +frag_keyframe+separate_moof+omit_tfhd_offset+empty_moov') - .format('mp4') - .pipe(writeStream); diff --git a/examples/express-stream.js b/examples/express-stream.js deleted file mode 100644 index 172d4125..00000000 --- a/examples/express-stream.js +++ /dev/null @@ -1,30 +0,0 @@ -var express = require('express'), - ffmpeg = require('../index'); - -var app = express(); - -app.use(express.static(__dirname + '/flowplayer')); - -app.get('/', function(req, res) { - res.send('index.html'); -}); - -app.get('/video/:filename', function(req, res) { - res.contentType('flv'); - // make sure you set the correct path to your video file storage - var pathToMovie = '/path/to/storage/' + req.params.filename; - var proc = ffmpeg(pathToMovie) - // use the 'flashvideo' preset (located in /lib/presets/flashvideo.js) - .preset('flashvideo') - // setup event handlers - .on('end', function() { - console.log('file has been converted succesfully'); - }) - .on('error', function(err) { - console.log('an error happened: ' + err.message); - }) - // save to stream - .pipe(res, {end:true}); -}); - -app.listen(4000); diff --git a/examples/flowplayer/flowplayer.controls.swf b/examples/flowplayer/flowplayer.controls.swf deleted file mode 100644 index 5507a531..00000000 Binary files a/examples/flowplayer/flowplayer.controls.swf and /dev/null differ diff --git a/examples/flowplayer/flowplayer.min.js b/examples/flowplayer/flowplayer.min.js deleted file mode 100644 index 500492e2..00000000 --- a/examples/flowplayer/flowplayer.min.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * flowplayer.js 3.2.6. The Flowplayer API - * - * Copyright 2009-2011 Flowplayer Oy - * - * This file is part of Flowplayer. - * - * Flowplayer is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Flowplayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Flowplayer. If not, see . - * - * Date: 2011-02-04 05:45:28 -0500 (Fri, 04 Feb 2011) - * Revision: 614 - */ -(function(){function g(o){console.log("$f.fireEvent",[].slice.call(o))}function k(q){if(!q||typeof q!="object"){return q}var o=new q.constructor();for(var p in q){if(q.hasOwnProperty(p)){o[p]=k(q[p])}}return o}function m(t,q){if(!t){return}var o,p=0,r=t.length;if(r===undefined){for(o in t){if(q.call(t[o],o,t[o])===false){break}}}else{for(var s=t[0];p1){var t=arguments[1],q=(arguments.length==3)?arguments[2]:{};if(typeof t=="string"){t={src:t}}t=i({bgcolor:"#000000",version:[9,0],expressInstall:"http://static.flowplayer.org/swf/expressinstall.swf",cachebusting:false},t);if(typeof o=="string"){if(o.indexOf(".")!=-1){var s=[];m(n(o),function(){s.push(new b(this,k(t),k(q)))});return new d(s)}else{var r=c(o);return new b(r!==null?r:o,t,q)}}else{if(o){return new b(o,t,q)}}}return null};i(window.$f,{fireEvent:function(){var o=[].slice.call(arguments);var q=$f(o[0]);return q?q._fireEvent(o.slice(1)):null},addPlugin:function(o,p){b.prototype[o]=p;return $f},each:m,extend:i});if(typeof jQuery=="function"){jQuery.fn.flowplayer=function(q,p){if(!arguments.length||typeof arguments[0]=="number"){var o=[];this.each(function(){var r=$f(this);if(r){o.push(r)}});return arguments.length?o[arguments[0]]:new d(o)}return this.each(function(){$f(this,k(q),p?k(p):{})})}}})();(function(){var e=typeof jQuery=="function";var i={width:"100%",height:"100%",allowfullscreen:true,allowscriptaccess:"always",quality:"high",version:null,onFail:null,expressInstall:null,w3c:false,cachebusting:false};if(e){jQuery.tools=jQuery.tools||{};jQuery.tools.flashembed={version:"1.0.4",conf:i}}function j(){if(c.done){return false}var l=document;if(l&&l.getElementsByTagName&&l.getElementById&&l.body){clearInterval(c.timer);c.timer=null;for(var k=0;k'}q.width=q.height=q.id=q.w3c=q.src=null;for(var l in q){if(q[l]!==null){n+=''}}var o="";if(t){for(var m in t){if(t[m]!==null){o+=m+"="+(typeof t[m]=="object"?g(t[m]):t[m])+"&"}}o=o.substring(0,o.length-1);n+='"}n+="";return n}function d(m,p,l){var k=flashembed.getVersion();f(this,{getContainer:function(){return m},getConf:function(){return p},getVersion:function(){return k},getFlashvars:function(){return l},getApi:function(){return m.firstChild},getHTML:function(){return a(p,l)}});var q=p.version;var r=p.expressInstall;var o=!q||flashembed.isSupported(q);if(o){p.onFail=p.version=p.expressInstall=null;m.innerHTML=a(p,l)}else{if(q&&r&&flashembed.isSupported([6,65])){f(p,{src:r});l={MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title};m.innerHTML=a(p,l)}else{if(m.innerHTML.replace(/\s/g,"")!==""){}else{m.innerHTML="

Flash version "+q+" or greater is required

"+(k[0]>0?"Your version is "+k:"You have no flash plugin installed")+"

"+(m.tagName=="A"?"

Click here to download latest version

":"

Download latest version from here

");if(m.tagName=="A"){m.onclick=function(){location.href="http://www.adobe.com/go/getflashplayer"}}}}}if(!o&&p.onFail){var n=p.onFail.call(this);if(typeof n=="string"){m.innerHTML=n}}if(document.all){window[p.id]=document.getElementById(p.id)}}window.flashembed=function(l,m,k){if(typeof l=="string"){var n=document.getElementById(l);if(n){l=n}else{c(function(){flashembed(l,m,k)});return}}if(!l){return}if(typeof m=="string"){m={src:m}}var o=f({},i);f(o,m);return new d(l,o,k)};f(window.flashembed,{getVersion:function(){var m=[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var l=navigator.plugins["Shockwave Flash"].description;if(typeof l!="undefined"){l=l.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var n=parseInt(l.replace(/^(.*)\..*$/,"$1"),10);var r=/r/.test(l)?parseInt(l.replace(/^.*r(.*)$/,"$1"),10):0;m=[n,r]}}else{if(window.ActiveXObject){try{var p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(q){try{p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");m=[6,0];p.AllowScriptAccess="always"}catch(k){if(m[0]==6){return m}}try{p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(o){}}if(typeof p=="object"){l=p.GetVariable("$version");if(typeof l!="undefined"){l=l.replace(/^\S+\s+(.*)$/,"$1").split(",");m=[parseInt(l[0],10),parseInt(l[2],10)]}}}}return m},isSupported:function(k){var m=flashembed.getVersion();var l=(m[0]>k[0])||(m[0]==k[0]&&m[1]>=k[1]);return l},domReady:c,asString:g,getHTML:a});if(e){jQuery.fn.flashembed=function(l,k){var m=null;this.each(function(){m=flashembed(this,l,k)});return l.api===false?this:m}}})(); \ No newline at end of file diff --git a/examples/flowplayer/flowplayer.swf b/examples/flowplayer/flowplayer.swf deleted file mode 100644 index 20a41193..00000000 Binary files a/examples/flowplayer/flowplayer.swf and /dev/null differ diff --git a/examples/flowplayer/index.html b/examples/flowplayer/index.html deleted file mode 100644 index 5761b409..00000000 --- a/examples/flowplayer/index.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - node-fluent-ffmpeg - - - - - - - - - - - \ No newline at end of file diff --git a/examples/full.js b/examples/full.js deleted file mode 100644 index fe17c0bf..00000000 --- a/examples/full.js +++ /dev/null @@ -1,33 +0,0 @@ -var ffmpeg = require('../index'); - -// make sure you set the correct path to your video file -var proc = ffmpeg('/path/to/your_movie.avi') - // set video bitrate - .videoBitrate(1024) - // set target codec - .videoCodec('divx') - // set aspect ratio - .aspect('16:9') - // set size in percent - .size('50%') - // set fps - .fps(24) - // set audio bitrate - .audioBitrate('128k') - // set audio codec - .audioCodec('libmp3lame') - // set number of audio channels - .audioChannels(2) - // set custom option - .addOption('-vtag', 'DIVX') - // set output format to force - .format('avi') - // setup event handlers - .on('end', function() { - console.log('file has been converted succesfully'); - }) - .on('error', function(err) { - console.log('an error happened: ' + err.message); - }) - // save to file - .save('/path/to/your_target.avi'); diff --git a/examples/image2video.js b/examples/image2video.js deleted file mode 100644 index eee2dd9b..00000000 --- a/examples/image2video.js +++ /dev/null @@ -1,17 +0,0 @@ -var ffmpeg = require('fluent-ffmpeg'); - -// make sure you set the correct path to your video file -var proc = ffmpeg('/path/to/your_image.jpg') - // loop for 5 seconds - .loop(5) - // using 25 fps - .fps(25) - // setup event handlers - .on('end', function() { - console.log('file has been converted succesfully'); - }) - .on('error', function(err) { - console.log('an error happened: ' + err.message); - }) - // save to file - .save('/path/to/your_target.m4v'); diff --git a/examples/input-stream.js b/examples/input-stream.js deleted file mode 100644 index 1707cfe2..00000000 --- a/examples/input-stream.js +++ /dev/null @@ -1,23 +0,0 @@ -var fs = require('fs'), - ffmpeg = require('../index'); - -// open input stream -var infs = fs.createReadStream(__dirname + '/test/assets/testvideo-43.avi'); - -infs.on('error', function(err) { - console.log(err); -}); - -// create new ffmpeg processor instance using input stream -// instead of file path (can be any ReadableStream) -var proc = ffmpeg(infs) - .preset('flashvideo') - // setup event handlers - .on('end', function() { - console.log('done processing input stream'); - }) - .on('error', function(err) { - console.log('an error happened: ' + err.message); - }) - // save to file - .save('/path/to/your_target.flv'); diff --git a/examples/livertmp2hls.js b/examples/livertmp2hls.js deleted file mode 100644 index f922b45a..00000000 --- a/examples/livertmp2hls.js +++ /dev/null @@ -1,29 +0,0 @@ -var ffmpeg = require('../index'); - -// make sure you set the correct path to your video file -var proc = ffmpeg('rtmp://path/to/live/stream', { timeout: 432000 }) - // set video bitrate - .videoBitrate(1024) - // set h264 preset - .addOption('preset','superfast') - // set target codec - .videoCodec('libx264') - // set audio bitrate - .audioBitrate('128k') - // set audio codec - .audioCodec('libfaac') - // set number of audio channels - .audioChannels(2) - // set hls segments time - .addOption('-hls_time', 10) - // include all the segments in the list - .addOption('-hls_list_size',0) - // setup event handlers - .on('end', function() { - console.log('file has been converted succesfully'); - }) - .on('error', function(err) { - console.log('an error happened: ' + err.message); - }) - // save to file - .save('/path/to/your_target.m3u8'); diff --git a/examples/mergeVideos.js b/examples/mergeVideos.js deleted file mode 100644 index 2fa986fb..00000000 --- a/examples/mergeVideos.js +++ /dev/null @@ -1,31 +0,0 @@ -var ffmpeg = require('../index'); - -/* - replicates this sequence of commands: - - ffmpeg -i title.mp4 -qscale:v 1 intermediate1.mpg - ffmpeg -i source.mp4 -qscale:v 1 intermediate2.mpg - ffmpeg -i concat:"intermediate1.mpg|intermediate2.mpg" -c copy intermediate_all.mpg - ffmpeg -i intermediate_all.mpg -qscale:v 2 output.mp4 - - Create temporary .mpg files for each video and deletes them after merge is completed. - These files are created by filename pattern like [videoFilename.ext].temp.mpg [outputFilename.ext].temp.merged.mp4 - */ - -var firstFile = "title.mp4"; -var secondFile = "source.mp4"; -var thirdFile = "third.mov"; -var outPath = "out.mp4"; - -var proc = ffmpeg(firstFile) - .input(secondFile) - .input(thirdFile) - //.input(fourthFile) - //.input(...) - .on('end', function() { - console.log('files have been merged succesfully'); - }) - .on('error', function(err) { - console.log('an error happened: ' + err.message); - }) - .mergeToFile(outPath); \ No newline at end of file diff --git a/examples/metadata.js b/examples/metadata.js deleted file mode 100644 index 86cd573a..00000000 --- a/examples/metadata.js +++ /dev/null @@ -1,6 +0,0 @@ -var ffmpeg = require('../index'); - -// make sure you set the correct path to your video file -ffmpeg.ffprobe('/path/to/your_movie.avi',function(err, metadata) { - console.log(require('util').inspect(metadata, false, null)); -}); diff --git a/examples/preset.js b/examples/preset.js deleted file mode 100644 index 94d674a8..00000000 --- a/examples/preset.js +++ /dev/null @@ -1,17 +0,0 @@ -var ffmpeg = require('../index'); - -// make sure you set the correct path to your video file -var proc = ffmpeg('/path/to/your_movie.avi') - // use the 'podcast' preset (located in /lib/presets/podcast.js) - .preset('podcast') - // in case you want to override the preset's setting, just keep chaining - .videoBitrate('512k') - // setup event handlers - .on('end', function() { - console.log('file has been converted succesfully'); - }) - .on('error', function(err) { - console.log('an error happened: ' + err.message); - }) - // save to file - .save('/path/to/your_target.m4v'); diff --git a/examples/progress.js b/examples/progress.js deleted file mode 100644 index feebbd34..00000000 --- a/examples/progress.js +++ /dev/null @@ -1,23 +0,0 @@ -var fs = require('fs'), - ffmpeg = require('../index'); - -// open input stream -var infs = fs.createReadStream(__dirname + '/test/assets/testvideo-43.avi'); - -infs.on('error', function(err) { - console.log(err); -}); - -var proc = ffmpeg(infs) - .preset('flashvideo') - // setup event handlers - .on('progress', function(info) { - console.log('progress ' + info.percent + '%'); - }) - .on('end', function() { - console.log('done processing input stream'); - }) - .on('error', function(err) { - console.log('an error happened: ' + err.message); - }) - .save('/path/to/your_target.flv'); \ No newline at end of file diff --git a/examples/stream.js b/examples/stream.js deleted file mode 100644 index 63083d14..00000000 --- a/examples/stream.js +++ /dev/null @@ -1,19 +0,0 @@ -var ffmpeg = require('../index'), - fs = require('fs'); - -// create the target stream (can be any WritableStream) -var stream = fs.createWriteStream('/path/to/yout_target.flv') - -// make sure you set the correct path to your video file -var proc = ffmpeg('/path/to/your_movie.avi') - // use the 'flashvideo' preset (located in /lib/presets/flashvideo.js) - .preset('flashvideo') - // setup event handlers - .on('end', function() { - console.log('file has been converted succesfully'); - }) - .on('error', function(err) { - console.log('an error happened: ' + err.message); - }) - // save to stream - .pipe(stream, {end:true}); //end = true, close output stream after writing diff --git a/examples/thumbnails.js b/examples/thumbnails.js deleted file mode 100644 index 98a3c037..00000000 --- a/examples/thumbnails.js +++ /dev/null @@ -1,15 +0,0 @@ -var ffmpeg = require('../index'); - -var proc = ffmpeg('/path/to/your_movie.avi') - // setup event handlers - .on('filenames', function(filenames) { - console.log('screenshots are ' + filenames.join(', ')); - }) - .on('end', function() { - console.log('screenshots were saved'); - }) - .on('error', function(err) { - console.log('an error happened: ' + err.message); - }) - // take 2 screenshots at predefined timemarks and size - .takeScreenshots({ count: 2, timemarks: [ '00:00:02.000', '6' ], size: '150x100' }, '/path/to/thumbnail/folder'); diff --git a/index.js b/index.js deleted file mode 100644 index 68a1522e..00000000 --- a/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/fluent-ffmpeg'); diff --git a/lib/capabilities.js b/lib/capabilities.js deleted file mode 100644 index 3722ff16..00000000 --- a/lib/capabilities.js +++ /dev/null @@ -1,665 +0,0 @@ -/*jshint node:true*/ -'use strict'; - -var fs = require('fs'); -var path = require('path'); -var async = require('async'); -var utils = require('./utils'); - -/* - *! Capability helpers - */ - -var avCodecRegexp = /^\s*([D ])([E ])([VAS])([S ])([D ])([T ]) ([^ ]+) +(.*)$/; -var ffCodecRegexp = /^\s*([D\.])([E\.])([VAS])([I\.])([L\.])([S\.]) ([^ ]+) +(.*)$/; -var ffEncodersRegexp = /\(encoders:([^\)]+)\)/; -var ffDecodersRegexp = /\(decoders:([^\)]+)\)/; -var encodersRegexp = /^\s*([VAS\.])([F\.])([S\.])([X\.])([B\.])([D\.]) ([^ ]+) +(.*)$/; -var formatRegexp = /^\s*([D ])([E ]) ([^ ]+) +(.*)$/; -var lineBreakRegexp = /\r\n|\r|\n/; -var filterRegexp = /^(?: [T\.][S\.][C\.] )?([^ ]+) +(AA?|VV?|\|)->(AA?|VV?|\|) +(.*)$/; - -var cache = {}; - -module.exports = function(proto) { - /** - * Manually define the ffmpeg binary full path. - * - * @method FfmpegCommand#setFfmpegPath - * - * @param {String} ffmpegPath The full path to the ffmpeg binary. - * @return FfmpegCommand - */ - proto.setFfmpegPath = function(ffmpegPath) { - cache.ffmpegPath = ffmpegPath; - return this; - }; - - /** - * Manually define the ffprobe binary full path. - * - * @method FfmpegCommand#setFfprobePath - * - * @param {String} ffprobePath The full path to the ffprobe binary. - * @return FfmpegCommand - */ - proto.setFfprobePath = function(ffprobePath) { - cache.ffprobePath = ffprobePath; - return this; - }; - - /** - * Manually define the flvtool2/flvmeta binary full path. - * - * @method FfmpegCommand#setFlvtoolPath - * - * @param {String} flvtool The full path to the flvtool2 or flvmeta binary. - * @return FfmpegCommand - */ - proto.setFlvtoolPath = function(flvtool) { - cache.flvtoolPath = flvtool; - return this; - }; - - /** - * Forget executable paths - * - * (only used for testing purposes) - * - * @method FfmpegCommand#_forgetPaths - * @private - */ - proto._forgetPaths = function() { - delete cache.ffmpegPath; - delete cache.ffprobePath; - delete cache.flvtoolPath; - }; - - /** - * Check for ffmpeg availability - * - * If the FFMPEG_PATH environment variable is set, try to use it. - * If it is unset or incorrect, try to find ffmpeg in the PATH instead. - * - * @method FfmpegCommand#_getFfmpegPath - * @param {Function} callback callback with signature (err, path) - * @private - */ - proto._getFfmpegPath = function(callback) { - if ('ffmpegPath' in cache) { - return callback(null, cache.ffmpegPath); - } - - async.waterfall([ - // Try FFMPEG_PATH - function(cb) { - if (process.env.FFMPEG_PATH) { - fs.exists(process.env.FFMPEG_PATH, function(exists) { - if (exists) { - cb(null, process.env.FFMPEG_PATH); - } else { - cb(null, ''); - } - }); - } else { - cb(null, ''); - } - }, - - // Search in the PATH - function(ffmpeg, cb) { - if (ffmpeg.length) { - return cb(null, ffmpeg); - } - - utils.which('ffmpeg', function(err, ffmpeg) { - cb(err, ffmpeg); - }); - } - ], function(err, ffmpeg) { - if (err) { - callback(err); - } else { - callback(null, cache.ffmpegPath = (ffmpeg || '')); - } - }); - }; - - - /** - * Check for ffprobe availability - * - * If the FFPROBE_PATH environment variable is set, try to use it. - * If it is unset or incorrect, try to find ffprobe in the PATH instead. - * If this still fails, try to find ffprobe in the same directory as ffmpeg. - * - * @method FfmpegCommand#_getFfprobePath - * @param {Function} callback callback with signature (err, path) - * @private - */ - proto._getFfprobePath = function(callback) { - var self = this; - - if ('ffprobePath' in cache) { - return callback(null, cache.ffprobePath); - } - - async.waterfall([ - // Try FFPROBE_PATH - function(cb) { - if (process.env.FFPROBE_PATH) { - fs.exists(process.env.FFPROBE_PATH, function(exists) { - cb(null, exists ? process.env.FFPROBE_PATH : ''); - }); - } else { - cb(null, ''); - } - }, - - // Search in the PATH - function(ffprobe, cb) { - if (ffprobe.length) { - return cb(null, ffprobe); - } - - utils.which('ffprobe', function(err, ffprobe) { - cb(err, ffprobe); - }); - }, - - // Search in the same directory as ffmpeg - function(ffprobe, cb) { - if (ffprobe.length) { - return cb(null, ffprobe); - } - - self._getFfmpegPath(function(err, ffmpeg) { - if (err) { - cb(err); - } else if (ffmpeg.length) { - var name = utils.isWindows ? 'ffprobe.exe' : 'ffprobe'; - var ffprobe = path.join(path.dirname(ffmpeg), name); - fs.exists(ffprobe, function(exists) { - cb(null, exists ? ffprobe : ''); - }); - } else { - cb(null, ''); - } - }); - } - ], function(err, ffprobe) { - if (err) { - callback(err); - } else { - callback(null, cache.ffprobePath = (ffprobe || '')); - } - }); - }; - - - /** - * Check for flvtool2/flvmeta availability - * - * If the FLVTOOL2_PATH or FLVMETA_PATH environment variable are set, try to use them. - * If both are either unset or incorrect, try to find flvtool2 or flvmeta in the PATH instead. - * - * @method FfmpegCommand#_getFlvtoolPath - * @param {Function} callback callback with signature (err, path) - * @private - */ - proto._getFlvtoolPath = function(callback) { - if ('flvtoolPath' in cache) { - return callback(null, cache.flvtoolPath); - } - - async.waterfall([ - // Try FLVMETA_PATH - function(cb) { - if (process.env.FLVMETA_PATH) { - fs.exists(process.env.FLVMETA_PATH, function(exists) { - cb(null, exists ? process.env.FLVMETA_PATH : ''); - }); - } else { - cb(null, ''); - } - }, - - // Try FLVTOOL2_PATH - function(flvtool, cb) { - if (flvtool.length) { - return cb(null, flvtool); - } - - if (process.env.FLVTOOL2_PATH) { - fs.exists(process.env.FLVTOOL2_PATH, function(exists) { - cb(null, exists ? process.env.FLVTOOL2_PATH : ''); - }); - } else { - cb(null, ''); - } - }, - - // Search for flvmeta in the PATH - function(flvtool, cb) { - if (flvtool.length) { - return cb(null, flvtool); - } - - utils.which('flvmeta', function(err, flvmeta) { - cb(err, flvmeta); - }); - }, - - // Search for flvtool2 in the PATH - function(flvtool, cb) { - if (flvtool.length) { - return cb(null, flvtool); - } - - utils.which('flvtool2', function(err, flvtool2) { - cb(err, flvtool2); - }); - }, - ], function(err, flvtool) { - if (err) { - callback(err); - } else { - callback(null, cache.flvtoolPath = (flvtool || '')); - } - }); - }; - - - /** - * A callback passed to {@link FfmpegCommand#availableFilters}. - * - * @callback FfmpegCommand~filterCallback - * @param {Error|null} err error object or null if no error happened - * @param {Object} filters filter object with filter names as keys and the following - * properties for each filter: - * @param {String} filters.description filter description - * @param {String} filters.input input type, one of 'audio', 'video' and 'none' - * @param {Boolean} filters.multipleInputs whether the filter supports multiple inputs - * @param {String} filters.output output type, one of 'audio', 'video' and 'none' - * @param {Boolean} filters.multipleOutputs whether the filter supports multiple outputs - */ - - /** - * Query ffmpeg for available filters - * - * @method FfmpegCommand#availableFilters - * @category Capabilities - * @aliases getAvailableFilters - * - * @param {FfmpegCommand~filterCallback} callback callback function - */ - proto.availableFilters = - proto.getAvailableFilters = function(callback) { - if ('filters' in cache) { - return callback(null, cache.filters); - } - - this._spawnFfmpeg(['-filters'], { captureStdout: true, stdoutLines: 0 }, function (err, stdoutRing) { - if (err) { - return callback(err); - } - - var stdout = stdoutRing.get(); - var lines = stdout.split('\n'); - var data = {}; - var types = { A: 'audio', V: 'video', '|': 'none' }; - - lines.forEach(function(line) { - var match = line.match(filterRegexp); - if (match) { - data[match[1]] = { - description: match[4], - input: types[match[2].charAt(0)], - multipleInputs: match[2].length > 1, - output: types[match[3].charAt(0)], - multipleOutputs: match[3].length > 1 - }; - } - }); - - callback(null, cache.filters = data); - }); - }; - - - /** - * A callback passed to {@link FfmpegCommand#availableCodecs}. - * - * @callback FfmpegCommand~codecCallback - * @param {Error|null} err error object or null if no error happened - * @param {Object} codecs codec object with codec names as keys and the following - * properties for each codec (more properties may be available depending on the - * ffmpeg version used): - * @param {String} codecs.description codec description - * @param {Boolean} codecs.canDecode whether the codec is able to decode streams - * @param {Boolean} codecs.canEncode whether the codec is able to encode streams - */ - - /** - * Query ffmpeg for available codecs - * - * @method FfmpegCommand#availableCodecs - * @category Capabilities - * @aliases getAvailableCodecs - * - * @param {FfmpegCommand~codecCallback} callback callback function - */ - proto.availableCodecs = - proto.getAvailableCodecs = function(callback) { - if ('codecs' in cache) { - return callback(null, cache.codecs); - } - - this._spawnFfmpeg(['-codecs'], { captureStdout: true, stdoutLines: 0 }, function(err, stdoutRing) { - if (err) { - return callback(err); - } - - var stdout = stdoutRing.get(); - var lines = stdout.split(lineBreakRegexp); - var data = {}; - - lines.forEach(function(line) { - var match = line.match(avCodecRegexp); - if (match && match[7] !== '=') { - data[match[7]] = { - type: { 'V': 'video', 'A': 'audio', 'S': 'subtitle' }[match[3]], - description: match[8], - canDecode: match[1] === 'D', - canEncode: match[2] === 'E', - drawHorizBand: match[4] === 'S', - directRendering: match[5] === 'D', - weirdFrameTruncation: match[6] === 'T' - }; - } - - match = line.match(ffCodecRegexp); - if (match && match[7] !== '=') { - var codecData = data[match[7]] = { - type: { 'V': 'video', 'A': 'audio', 'S': 'subtitle' }[match[3]], - description: match[8], - canDecode: match[1] === 'D', - canEncode: match[2] === 'E', - intraFrameOnly: match[4] === 'I', - isLossy: match[5] === 'L', - isLossless: match[6] === 'S' - }; - - var encoders = codecData.description.match(ffEncodersRegexp); - encoders = encoders ? encoders[1].trim().split(' ') : []; - - var decoders = codecData.description.match(ffDecodersRegexp); - decoders = decoders ? decoders[1].trim().split(' ') : []; - - if (encoders.length || decoders.length) { - var coderData = {}; - utils.copy(codecData, coderData); - delete coderData.canEncode; - delete coderData.canDecode; - - encoders.forEach(function(name) { - data[name] = {}; - utils.copy(coderData, data[name]); - data[name].canEncode = true; - }); - - decoders.forEach(function(name) { - if (name in data) { - data[name].canDecode = true; - } else { - data[name] = {}; - utils.copy(coderData, data[name]); - data[name].canDecode = true; - } - }); - } - } - }); - - callback(null, cache.codecs = data); - }); - }; - - - /** - * A callback passed to {@link FfmpegCommand#availableEncoders}. - * - * @callback FfmpegCommand~encodersCallback - * @param {Error|null} err error object or null if no error happened - * @param {Object} encoders encoders object with encoder names as keys and the following - * properties for each encoder: - * @param {String} encoders.description codec description - * @param {Boolean} encoders.type "audio", "video" or "subtitle" - * @param {Boolean} encoders.frameMT whether the encoder is able to do frame-level multithreading - * @param {Boolean} encoders.sliceMT whether the encoder is able to do slice-level multithreading - * @param {Boolean} encoders.experimental whether the encoder is experimental - * @param {Boolean} encoders.drawHorizBand whether the encoder supports draw_horiz_band - * @param {Boolean} encoders.directRendering whether the encoder supports direct encoding method 1 - */ - - /** - * Query ffmpeg for available encoders - * - * @method FfmpegCommand#availableEncoders - * @category Capabilities - * @aliases getAvailableEncoders - * - * @param {FfmpegCommand~encodersCallback} callback callback function - */ - proto.availableEncoders = - proto.getAvailableEncoders = function(callback) { - if ('encoders' in cache) { - return callback(null, cache.encoders); - } - - this._spawnFfmpeg(['-encoders'], { captureStdout: true, stdoutLines: 0 }, function(err, stdoutRing) { - if (err) { - return callback(err); - } - - var stdout = stdoutRing.get(); - var lines = stdout.split(lineBreakRegexp); - var data = {}; - - lines.forEach(function(line) { - var match = line.match(encodersRegexp); - if (match && match[7] !== '=') { - data[match[7]] = { - type: { 'V': 'video', 'A': 'audio', 'S': 'subtitle' }[match[1]], - description: match[8], - frameMT: match[2] === 'F', - sliceMT: match[3] === 'S', - experimental: match[4] === 'X', - drawHorizBand: match[5] === 'B', - directRendering: match[6] === 'D' - }; - } - }); - - callback(null, cache.encoders = data); - }); - }; - - - /** - * A callback passed to {@link FfmpegCommand#availableFormats}. - * - * @callback FfmpegCommand~formatCallback - * @param {Error|null} err error object or null if no error happened - * @param {Object} formats format object with format names as keys and the following - * properties for each format: - * @param {String} formats.description format description - * @param {Boolean} formats.canDemux whether the format is able to demux streams from an input file - * @param {Boolean} formats.canMux whether the format is able to mux streams into an output file - */ - - /** - * Query ffmpeg for available formats - * - * @method FfmpegCommand#availableFormats - * @category Capabilities - * @aliases getAvailableFormats - * - * @param {FfmpegCommand~formatCallback} callback callback function - */ - proto.availableFormats = - proto.getAvailableFormats = function(callback) { - if ('formats' in cache) { - return callback(null, cache.formats); - } - - // Run ffmpeg -formats - this._spawnFfmpeg(['-formats'], { captureStdout: true, stdoutLines: 0 }, function (err, stdoutRing) { - if (err) { - return callback(err); - } - - // Parse output - var stdout = stdoutRing.get(); - var lines = stdout.split(lineBreakRegexp); - var data = {}; - - lines.forEach(function(line) { - var match = line.match(formatRegexp); - if (match) { - match[3].split(',').forEach(function(format) { - if (!(format in data)) { - data[format] = { - description: match[4], - canDemux: false, - canMux: false - }; - } - - if (match[1] === 'D') { - data[format].canDemux = true; - } - if (match[2] === 'E') { - data[format].canMux = true; - } - }); - } - }); - - callback(null, cache.formats = data); - }); - }; - - - /** - * Check capabilities before executing a command - * - * Checks whether all used codecs and formats are indeed available - * - * @method FfmpegCommand#_checkCapabilities - * @param {Function} callback callback with signature (err) - * @private - */ - proto._checkCapabilities = function(callback) { - var self = this; - async.waterfall([ - // Get available formats - function(cb) { - self.availableFormats(cb); - }, - - // Check whether specified formats are available - function(formats, cb) { - var unavailable; - - // Output format(s) - unavailable = self._outputs - .reduce(function(fmts, output) { - var format = output.options.find('-f', 1); - if (format) { - if (!(format[0] in formats) || !(formats[format[0]].canMux)) { - fmts.push(format); - } - } - - return fmts; - }, []); - - if (unavailable.length === 1) { - return cb(new Error('Output format ' + unavailable[0] + ' is not available')); - } else if (unavailable.length > 1) { - return cb(new Error('Output formats ' + unavailable.join(', ') + ' are not available')); - } - - // Input format(s) - unavailable = self._inputs - .reduce(function(fmts, input) { - var format = input.options.find('-f', 1); - if (format) { - if (!(format[0] in formats) || !(formats[format[0]].canDemux)) { - fmts.push(format[0]); - } - } - - return fmts; - }, []); - - if (unavailable.length === 1) { - return cb(new Error('Input format ' + unavailable[0] + ' is not available')); - } else if (unavailable.length > 1) { - return cb(new Error('Input formats ' + unavailable.join(', ') + ' are not available')); - } - - cb(); - }, - - // Get available codecs - function(cb) { - self.availableEncoders(cb); - }, - - // Check whether specified codecs are available and add strict experimental options if needed - function(encoders, cb) { - var unavailable; - - // Audio codec(s) - unavailable = self._outputs.reduce(function(cdcs, output) { - var acodec = output.audio.find('-acodec', 1); - if (acodec && acodec[0] !== 'copy') { - if (!(acodec[0] in encoders) || encoders[acodec[0]].type !== 'audio') { - cdcs.push(acodec[0]); - } - } - - return cdcs; - }, []); - - if (unavailable.length === 1) { - return cb(new Error('Audio codec ' + unavailable[0] + ' is not available')); - } else if (unavailable.length > 1) { - return cb(new Error('Audio codecs ' + unavailable.join(', ') + ' are not available')); - } - - // Video codec(s) - unavailable = self._outputs.reduce(function(cdcs, output) { - var vcodec = output.video.find('-vcodec', 1); - if (vcodec && vcodec[0] !== 'copy') { - if (!(vcodec[0] in encoders) || encoders[vcodec[0]].type !== 'video') { - cdcs.push(vcodec[0]); - } - } - - return cdcs; - }, []); - - if (unavailable.length === 1) { - return cb(new Error('Video codec ' + unavailable[0] + ' is not available')); - } else if (unavailable.length > 1) { - return cb(new Error('Video codecs ' + unavailable.join(', ') + ' are not available')); - } - - cb(); - } - ], callback); - }; -}; diff --git a/lib/ffprobe.js b/lib/ffprobe.js deleted file mode 100644 index d24be85d..00000000 --- a/lib/ffprobe.js +++ /dev/null @@ -1,261 +0,0 @@ -/*jshint node:true, laxcomma:true*/ -'use strict'; - -var spawn = require('child_process').spawn; - - -function legacyTag(key) { return key.match(/^TAG:/); } -function legacyDisposition(key) { return key.match(/^DISPOSITION:/); } - -function parseFfprobeOutput(out) { - var lines = out.split(/\r\n|\r|\n/); - - lines = lines.filter(function (line) { - return line.length > 0; - }); - - var data = { - streams: [], - format: {}, - chapters: [] - }; - - function parseBlock(name) { - var data = {}; - - var line = lines.shift(); - while (typeof line !== 'undefined') { - if (line.toLowerCase() == '[/'+name+']') { - return data; - } else if (line.match(/^\[/)) { - line = lines.shift(); - continue; - } - - var kv = line.match(/^([^=]+)=(.*)$/); - if (kv) { - if (!(kv[1].match(/^TAG:/)) && kv[2].match(/^[0-9]+(\.[0-9]+)?$/)) { - data[kv[1]] = Number(kv[2]); - } else { - data[kv[1]] = kv[2]; - } - } - - line = lines.shift(); - } - - return data; - } - - var line = lines.shift(); - while (typeof line !== 'undefined') { - if (line.match(/^\[stream/i)) { - var stream = parseBlock('stream'); - data.streams.push(stream); - } else if (line.match(/^\[chapter/i)) { - var chapter = parseBlock('chapter'); - data.chapters.push(chapter); - } else if (line.toLowerCase() === '[format]') { - data.format = parseBlock('format'); - } - - line = lines.shift(); - } - - return data; -} - - - -module.exports = function(proto) { - /** - * A callback passed to the {@link FfmpegCommand#ffprobe} method. - * - * @callback FfmpegCommand~ffprobeCallback - * - * @param {Error|null} err error object or null if no error happened - * @param {Object} ffprobeData ffprobe output data; this object - * has the same format as what the following command returns: - * - * `ffprobe -print_format json -show_streams -show_format INPUTFILE` - * @param {Array} ffprobeData.streams stream information - * @param {Object} ffprobeData.format format information - */ - - /** - * Run ffprobe on last specified input - * - * @method FfmpegCommand#ffprobe - * @category Metadata - * - * @param {?Number} [index] 0-based index of input to probe (defaults to last input) - * @param {?String[]} [options] array of output options to return - * @param {FfmpegCommand~ffprobeCallback} callback callback function - * - */ - proto.ffprobe = function() { - var input, index = null, options = [], callback; - - // the last argument should be the callback - var callback = arguments[arguments.length - 1]; - - var ended = false - function handleCallback(err, data) { - if (!ended) { - ended = true; - callback(err, data); - } - }; - - // map the arguments to the correct variable names - switch (arguments.length) { - case 3: - index = arguments[0]; - options = arguments[1]; - break; - case 2: - if (typeof arguments[0] === 'number') { - index = arguments[0]; - } else if (Array.isArray(arguments[0])) { - options = arguments[0]; - } - break; - } - - - if (index === null) { - if (!this._currentInput) { - return handleCallback(new Error('No input specified')); - } - - input = this._currentInput; - } else { - input = this._inputs[index]; - - if (!input) { - return handleCallback(new Error('Invalid input index')); - } - } - - // Find ffprobe - this._getFfprobePath(function(err, path) { - if (err) { - return handleCallback(err); - } else if (!path) { - return handleCallback(new Error('Cannot find ffprobe')); - } - - var stdout = ''; - var stdoutClosed = false; - var stderr = ''; - var stderrClosed = false; - - // Spawn ffprobe - var src = input.isStream ? 'pipe:0' : input.source; - var ffprobe = spawn(path, ['-show_streams', '-show_format'].concat(options, src), {windowsHide: true}); - - if (input.isStream) { - // Skip errors on stdin. These get thrown when ffprobe is complete and - // there seems to be no way hook in and close stdin before it throws. - ffprobe.stdin.on('error', function(err) { - if (['ECONNRESET', 'EPIPE', 'EOF'].indexOf(err.code) >= 0) { return; } - handleCallback(err); - }); - - // Once ffprobe's input stream closes, we need no more data from the - // input - ffprobe.stdin.on('close', function() { - input.source.pause(); - input.source.unpipe(ffprobe.stdin); - }); - - input.source.pipe(ffprobe.stdin); - } - - ffprobe.on('error', callback); - - // Ensure we wait for captured streams to end before calling callback - var exitError = null; - function handleExit(err) { - if (err) { - exitError = err; - } - - if (processExited && stdoutClosed && stderrClosed) { - if (exitError) { - if (stderr) { - exitError.message += '\n' + stderr; - } - - return handleCallback(exitError); - } - - // Process output - var data = parseFfprobeOutput(stdout); - - // Handle legacy output with "TAG:x" and "DISPOSITION:x" keys - [data.format].concat(data.streams).forEach(function(target) { - if (target) { - var legacyTagKeys = Object.keys(target).filter(legacyTag); - - if (legacyTagKeys.length) { - target.tags = target.tags || {}; - - legacyTagKeys.forEach(function(tagKey) { - target.tags[tagKey.substr(4)] = target[tagKey]; - delete target[tagKey]; - }); - } - - var legacyDispositionKeys = Object.keys(target).filter(legacyDisposition); - - if (legacyDispositionKeys.length) { - target.disposition = target.disposition || {}; - - legacyDispositionKeys.forEach(function(dispositionKey) { - target.disposition[dispositionKey.substr(12)] = target[dispositionKey]; - delete target[dispositionKey]; - }); - } - } - }); - - handleCallback(null, data); - } - } - - // Handle ffprobe exit - var processExited = false; - ffprobe.on('exit', function(code, signal) { - processExited = true; - - if (code) { - handleExit(new Error('ffprobe exited with code ' + code)); - } else if (signal) { - handleExit(new Error('ffprobe was killed with signal ' + signal)); - } else { - handleExit(); - } - }); - - // Handle stdout/stderr streams - ffprobe.stdout.on('data', function(data) { - stdout += data; - }); - - ffprobe.stdout.on('close', function() { - stdoutClosed = true; - handleExit(); - }); - - ffprobe.stderr.on('data', function(data) { - stderr += data; - }); - - ffprobe.stderr.on('close', function() { - stderrClosed = true; - handleExit(); - }); - }); - }; -}; diff --git a/lib/fluent-ffmpeg.js b/lib/fluent-ffmpeg.js deleted file mode 100644 index 7e648560..00000000 --- a/lib/fluent-ffmpeg.js +++ /dev/null @@ -1,226 +0,0 @@ -/*jshint node:true*/ -'use strict'; - -var path = require('path'); -var util = require('util'); -var EventEmitter = require('events').EventEmitter; - -var utils = require('./utils'); -var ARGLISTS = ['_global', '_audio', '_audioFilters', '_video', '_videoFilters', '_sizeFilters', '_complexFilters']; - - -/** - * Create an ffmpeg command - * - * Can be called with or without the 'new' operator, and the 'input' parameter - * may be specified as 'options.source' instead (or passed later with the - * addInput method). - * - * @constructor - * @param {String|ReadableStream} [input] input file path or readable stream - * @param {Object} [options] command options - * @param {Object} [options.logger=] logger object with 'error', 'warning', 'info' and 'debug' methods - * @param {Number} [options.niceness=0] ffmpeg process niceness, ignored on Windows - * @param {Number} [options.priority=0] alias for `niceness` - * @param {String} [options.presets="fluent-ffmpeg/lib/presets"] directory to load presets from - * @param {String} [options.preset="fluent-ffmpeg/lib/presets"] alias for `presets` - * @param {String} [options.stdoutLines=100] maximum lines of ffmpeg output to keep in memory, use 0 for unlimited - * @param {Number} [options.timeout=] ffmpeg processing timeout in seconds - * @param {String|ReadableStream} [options.source=] alias for the `input` parameter - */ -function FfmpegCommand(input, options) { - // Make 'new' optional - if (!(this instanceof FfmpegCommand)) { - return new FfmpegCommand(input, options); - } - - EventEmitter.call(this); - - if (typeof input === 'object' && !('readable' in input)) { - // Options object passed directly - options = input; - } else { - // Input passed first - options = options || {}; - options.source = input; - } - - // Add input if present - this._inputs = []; - if (options.source) { - this.input(options.source); - } - - // Add target-less output for backwards compatibility - this._outputs = []; - this.output(); - - // Create argument lists - var self = this; - ['_global', '_complexFilters'].forEach(function(prop) { - self[prop] = utils.args(); - }); - - // Set default option values - options.stdoutLines = 'stdoutLines' in options ? options.stdoutLines : 100; - options.presets = options.presets || options.preset || path.join(__dirname, 'presets'); - options.niceness = options.niceness || options.priority || 0; - - // Save options - this.options = options; - - // Setup logger - this.logger = options.logger || { - debug: function() {}, - info: function() {}, - warn: function() {}, - error: function() {} - }; -} -util.inherits(FfmpegCommand, EventEmitter); -module.exports = FfmpegCommand; - - -/** - * Clone an ffmpeg command - * - * This method is useful when you want to process the same input multiple times. - * It returns a new FfmpegCommand instance with the exact same options. - * - * All options set _after_ the clone() call will only be applied to the instance - * it has been called on. - * - * @example - * var command = ffmpeg('/path/to/source.avi') - * .audioCodec('libfaac') - * .videoCodec('libx264') - * .format('mp4'); - * - * command.clone() - * .size('320x200') - * .save('/path/to/output-small.mp4'); - * - * command.clone() - * .size('640x400') - * .save('/path/to/output-medium.mp4'); - * - * command.save('/path/to/output-original-size.mp4'); - * - * @method FfmpegCommand#clone - * @return FfmpegCommand - */ -FfmpegCommand.prototype.clone = function() { - var clone = new FfmpegCommand(); - var self = this; - - // Clone options and logger - clone.options = this.options; - clone.logger = this.logger; - - // Clone inputs - clone._inputs = this._inputs.map(function(input) { - return { - source: input.source, - options: input.options.clone() - }; - }); - - // Create first output - if ('target' in this._outputs[0]) { - // We have outputs set, don't clone them and create first output - clone._outputs = []; - clone.output(); - } else { - // No outputs set, clone first output options - clone._outputs = [ - clone._currentOutput = { - flags: {} - } - ]; - - ['audio', 'audioFilters', 'video', 'videoFilters', 'sizeFilters', 'options'].forEach(function(key) { - clone._currentOutput[key] = self._currentOutput[key].clone(); - }); - - if (this._currentOutput.sizeData) { - clone._currentOutput.sizeData = {}; - utils.copy(this._currentOutput.sizeData, clone._currentOutput.sizeData); - } - - utils.copy(this._currentOutput.flags, clone._currentOutput.flags); - } - - // Clone argument lists - ['_global', '_complexFilters'].forEach(function(prop) { - clone[prop] = self[prop].clone(); - }); - - return clone; -}; - - -/* Add methods from options submodules */ - -require('./options/inputs')(FfmpegCommand.prototype); -require('./options/audio')(FfmpegCommand.prototype); -require('./options/video')(FfmpegCommand.prototype); -require('./options/videosize')(FfmpegCommand.prototype); -require('./options/output')(FfmpegCommand.prototype); -require('./options/custom')(FfmpegCommand.prototype); -require('./options/misc')(FfmpegCommand.prototype); - - -/* Add processor methods */ - -require('./processor')(FfmpegCommand.prototype); - - -/* Add capabilities methods */ - -require('./capabilities')(FfmpegCommand.prototype); - -FfmpegCommand.setFfmpegPath = function(path) { - (new FfmpegCommand()).setFfmpegPath(path); -}; - -FfmpegCommand.setFfprobePath = function(path) { - (new FfmpegCommand()).setFfprobePath(path); -}; - -FfmpegCommand.setFlvtoolPath = function(path) { - (new FfmpegCommand()).setFlvtoolPath(path); -}; - -FfmpegCommand.availableFilters = -FfmpegCommand.getAvailableFilters = function(callback) { - (new FfmpegCommand()).availableFilters(callback); -}; - -FfmpegCommand.availableCodecs = -FfmpegCommand.getAvailableCodecs = function(callback) { - (new FfmpegCommand()).availableCodecs(callback); -}; - -FfmpegCommand.availableFormats = -FfmpegCommand.getAvailableFormats = function(callback) { - (new FfmpegCommand()).availableFormats(callback); -}; - -FfmpegCommand.availableEncoders = -FfmpegCommand.getAvailableEncoders = function(callback) { - (new FfmpegCommand()).availableEncoders(callback); -}; - - -/* Add ffprobe methods */ - -require('./ffprobe')(FfmpegCommand.prototype); - -FfmpegCommand.ffprobe = function(file) { - var instance = new FfmpegCommand(file); - instance.ffprobe.apply(instance, Array.prototype.slice.call(arguments, 1)); -}; - -/* Add processing recipes */ - -require('./recipes')(FfmpegCommand.prototype); diff --git a/lib/options/audio.js b/lib/options/audio.js deleted file mode 100644 index 607fdb37..00000000 --- a/lib/options/audio.js +++ /dev/null @@ -1,178 +0,0 @@ -/*jshint node:true*/ -'use strict'; - -var utils = require('../utils'); - - -/* - *! Audio-related methods - */ - -module.exports = function(proto) { - /** - * Disable audio in the output - * - * @method FfmpegCommand#noAudio - * @category Audio - * @aliases withNoAudio - * @return FfmpegCommand - */ - proto.withNoAudio = - proto.noAudio = function() { - this._currentOutput.audio.clear(); - this._currentOutput.audioFilters.clear(); - this._currentOutput.audio('-an'); - - return this; - }; - - - /** - * Specify audio codec - * - * @method FfmpegCommand#audioCodec - * @category Audio - * @aliases withAudioCodec - * - * @param {String} codec audio codec name - * @return FfmpegCommand - */ - proto.withAudioCodec = - proto.audioCodec = function(codec) { - this._currentOutput.audio('-acodec', codec); - - return this; - }; - - - /** - * Specify audio bitrate - * - * @method FfmpegCommand#audioBitrate - * @category Audio - * @aliases withAudioBitrate - * - * @param {String|Number} bitrate audio bitrate in kbps (with an optional 'k' suffix) - * @return FfmpegCommand - */ - proto.withAudioBitrate = - proto.audioBitrate = function(bitrate) { - this._currentOutput.audio('-b:a', ('' + bitrate).replace(/k?$/, 'k')); - return this; - }; - - - /** - * Specify audio channel count - * - * @method FfmpegCommand#audioChannels - * @category Audio - * @aliases withAudioChannels - * - * @param {Number} channels channel count - * @return FfmpegCommand - */ - proto.withAudioChannels = - proto.audioChannels = function(channels) { - this._currentOutput.audio('-ac', channels); - return this; - }; - - - /** - * Specify audio frequency - * - * @method FfmpegCommand#audioFrequency - * @category Audio - * @aliases withAudioFrequency - * - * @param {Number} freq audio frequency in Hz - * @return FfmpegCommand - */ - proto.withAudioFrequency = - proto.audioFrequency = function(freq) { - this._currentOutput.audio('-ar', freq); - return this; - }; - - - /** - * Specify audio quality - * - * @method FfmpegCommand#audioQuality - * @category Audio - * @aliases withAudioQuality - * - * @param {Number} quality audio quality factor - * @return FfmpegCommand - */ - proto.withAudioQuality = - proto.audioQuality = function(quality) { - this._currentOutput.audio('-aq', quality); - return this; - }; - - - /** - * Specify custom audio filter(s) - * - * Can be called both with one or many filters, or a filter array. - * - * @example - * command.audioFilters('filter1'); - * - * @example - * command.audioFilters('filter1', 'filter2=param1=value1:param2=value2'); - * - * @example - * command.audioFilters(['filter1', 'filter2']); - * - * @example - * command.audioFilters([ - * { - * filter: 'filter1' - * }, - * { - * filter: 'filter2', - * options: 'param=value:param=value' - * } - * ]); - * - * @example - * command.audioFilters( - * { - * filter: 'filter1', - * options: ['value1', 'value2'] - * }, - * { - * filter: 'filter2', - * options: { param1: 'value1', param2: 'value2' } - * } - * ); - * - * @method FfmpegCommand#audioFilters - * @aliases withAudioFilter,withAudioFilters,audioFilter - * @category Audio - * - * @param {...String|String[]|Object[]} filters audio filter strings, string array or - * filter specification array, each with the following properties: - * @param {String} filters.filter filter name - * @param {String|String[]|Object} [filters.options] filter option string, array, or object - * @return FfmpegCommand - */ - proto.withAudioFilter = - proto.withAudioFilters = - proto.audioFilter = - proto.audioFilters = function(filters) { - if (arguments.length > 1) { - filters = [].slice.call(arguments); - } - - if (!Array.isArray(filters)) { - filters = [filters]; - } - - this._currentOutput.audioFilters(utils.makeFilterStrings(filters)); - return this; - }; -}; diff --git a/lib/options/custom.js b/lib/options/custom.js deleted file mode 100644 index d7435664..00000000 --- a/lib/options/custom.js +++ /dev/null @@ -1,212 +0,0 @@ -/*jshint node:true*/ -'use strict'; - -var utils = require('../utils'); - - -/* - *! Custom options methods - */ - -module.exports = function(proto) { - /** - * Add custom input option(s) - * - * When passing a single string or an array, each string containing two - * words is split (eg. inputOptions('-option value') is supported) for - * compatibility reasons. This is not the case when passing more than - * one argument. - * - * @example - * command.inputOptions('option1'); - * - * @example - * command.inputOptions('option1', 'option2'); - * - * @example - * command.inputOptions(['option1', 'option2']); - * - * @method FfmpegCommand#inputOptions - * @category Custom options - * @aliases addInputOption,addInputOptions,withInputOption,withInputOptions,inputOption - * - * @param {...String} options option string(s) or string array - * @return FfmpegCommand - */ - proto.addInputOption = - proto.addInputOptions = - proto.withInputOption = - proto.withInputOptions = - proto.inputOption = - proto.inputOptions = function(options) { - if (!this._currentInput) { - throw new Error('No input specified'); - } - - var doSplit = true; - - if (arguments.length > 1) { - options = [].slice.call(arguments); - doSplit = false; - } - - if (!Array.isArray(options)) { - options = [options]; - } - - this._currentInput.options(options.reduce(function(options, option) { - var split = String(option).split(' '); - - if (doSplit && split.length === 2) { - options.push(split[0], split[1]); - } else { - options.push(option); - } - - return options; - }, [])); - return this; - }; - - - /** - * Add custom output option(s) - * - * @example - * command.outputOptions('option1'); - * - * @example - * command.outputOptions('option1', 'option2'); - * - * @example - * command.outputOptions(['option1', 'option2']); - * - * @method FfmpegCommand#outputOptions - * @category Custom options - * @aliases addOutputOption,addOutputOptions,addOption,addOptions,withOutputOption,withOutputOptions,withOption,withOptions,outputOption - * - * @param {...String} options option string(s) or string array - * @return FfmpegCommand - */ - proto.addOutputOption = - proto.addOutputOptions = - proto.addOption = - proto.addOptions = - proto.withOutputOption = - proto.withOutputOptions = - proto.withOption = - proto.withOptions = - proto.outputOption = - proto.outputOptions = function(options) { - var doSplit = true; - - if (arguments.length > 1) { - options = [].slice.call(arguments); - doSplit = false; - } - - if (!Array.isArray(options)) { - options = [options]; - } - - this._currentOutput.options(options.reduce(function(options, option) { - var split = String(option).split(' '); - - if (doSplit && split.length === 2) { - options.push(split[0], split[1]); - } else { - options.push(option); - } - - return options; - }, [])); - return this; - }; - - - /** - * Specify a complex filtergraph - * - * Calling this method will override any previously set filtergraph, but you can set - * as many filters as needed in one call. - * - * @example Overlay an image over a video (using a filtergraph string) - * ffmpeg() - * .input('video.avi') - * .input('image.png') - * .complexFilter('[0:v][1:v]overlay[out]', ['out']); - * - * @example Overlay an image over a video (using a filter array) - * ffmpeg() - * .input('video.avi') - * .input('image.png') - * .complexFilter([{ - * filter: 'overlay', - * inputs: ['0:v', '1:v'], - * outputs: ['out'] - * }], ['out']); - * - * @example Split video into RGB channels and output a 3x1 video with channels side to side - * ffmpeg() - * .input('video.avi') - * .complexFilter([ - * // Duplicate video stream 3 times into streams a, b, and c - * { filter: 'split', options: '3', outputs: ['a', 'b', 'c'] }, - * - * // Create stream 'red' by cancelling green and blue channels from stream 'a' - * { filter: 'lutrgb', options: { g: 0, b: 0 }, inputs: 'a', outputs: 'red' }, - * - * // Create stream 'green' by cancelling red and blue channels from stream 'b' - * { filter: 'lutrgb', options: { r: 0, b: 0 }, inputs: 'b', outputs: 'green' }, - * - * // Create stream 'blue' by cancelling red and green channels from stream 'c' - * { filter: 'lutrgb', options: { r: 0, g: 0 }, inputs: 'c', outputs: 'blue' }, - * - * // Pad stream 'red' to 3x width, keeping the video on the left, and name output 'padded' - * { filter: 'pad', options: { w: 'iw*3', h: 'ih' }, inputs: 'red', outputs: 'padded' }, - * - * // Overlay 'green' onto 'padded', moving it to the center, and name output 'redgreen' - * { filter: 'overlay', options: { x: 'w', y: 0 }, inputs: ['padded', 'green'], outputs: 'redgreen'}, - * - * // Overlay 'blue' onto 'redgreen', moving it to the right - * { filter: 'overlay', options: { x: '2*w', y: 0 }, inputs: ['redgreen', 'blue']}, - * ]); - * - * @method FfmpegCommand#complexFilter - * @category Custom options - * @aliases filterGraph - * - * @param {String|Array} spec filtergraph string or array of filter specification - * objects, each having the following properties: - * @param {String} spec.filter filter name - * @param {String|Array} [spec.inputs] (array of) input stream specifier(s) for the filter, - * defaults to ffmpeg automatically choosing the first unused matching streams - * @param {String|Array} [spec.outputs] (array of) output stream specifier(s) for the filter, - * defaults to ffmpeg automatically assigning the output to the output file - * @param {Object|String|Array} [spec.options] filter options, can be omitted to not set any options - * @param {Array} [map] (array of) stream specifier(s) from the graph to include in - * ffmpeg output, defaults to ffmpeg automatically choosing the first matching streams. - * @return FfmpegCommand - */ - proto.filterGraph = - proto.complexFilter = function(spec, map) { - this._complexFilters.clear(); - - if (!Array.isArray(spec)) { - spec = [spec]; - } - - this._complexFilters('-filter_complex', utils.makeFilterStrings(spec).join(';')); - - if (Array.isArray(map)) { - var self = this; - map.forEach(function(streamSpec) { - self._complexFilters('-map', streamSpec.replace(utils.streamRegexp, '[$1]')); - }); - } else if (typeof map === 'string') { - this._complexFilters('-map', map.replace(utils.streamRegexp, '[$1]')); - } - - return this; - }; -}; diff --git a/lib/options/inputs.js b/lib/options/inputs.js deleted file mode 100644 index 804a21a3..00000000 --- a/lib/options/inputs.js +++ /dev/null @@ -1,178 +0,0 @@ -/*jshint node:true*/ -'use strict'; - -var utils = require('../utils'); - -/* - *! Input-related methods - */ - -module.exports = function(proto) { - /** - * Add an input to command - * - * Also switches "current input", that is the input that will be affected - * by subsequent input-related methods. - * - * Note: only one stream input is supported for now. - * - * @method FfmpegCommand#input - * @category Input - * @aliases mergeAdd,addInput - * - * @param {String|Readable} source input file path or readable stream - * @return FfmpegCommand - */ - proto.mergeAdd = - proto.addInput = - proto.input = function(source) { - var isFile = false; - var isStream = false; - - if (typeof source !== 'string') { - if (!('readable' in source) || !(source.readable)) { - throw new Error('Invalid input'); - } - - var hasInputStream = this._inputs.some(function(input) { - return input.isStream; - }); - - if (hasInputStream) { - throw new Error('Only one input stream is supported'); - } - - isStream = true; - source.pause(); - } else { - var protocol = source.match(/^([a-z]{2,}):/i); - isFile = !protocol || protocol[0] === 'file'; - } - - this._inputs.push(this._currentInput = { - source: source, - isFile: isFile, - isStream: isStream, - options: utils.args() - }); - - return this; - }; - - - /** - * Specify input format for the last specified input - * - * @method FfmpegCommand#inputFormat - * @category Input - * @aliases withInputFormat,fromFormat - * - * @param {String} format input format - * @return FfmpegCommand - */ - proto.withInputFormat = - proto.inputFormat = - proto.fromFormat = function(format) { - if (!this._currentInput) { - throw new Error('No input specified'); - } - - this._currentInput.options('-f', format); - return this; - }; - - - /** - * Specify input FPS for the last specified input - * (only valid for raw video formats) - * - * @method FfmpegCommand#inputFps - * @category Input - * @aliases withInputFps,withInputFPS,withFpsInput,withFPSInput,inputFPS,inputFps,fpsInput - * - * @param {Number} fps input FPS - * @return FfmpegCommand - */ - proto.withInputFps = - proto.withInputFPS = - proto.withFpsInput = - proto.withFPSInput = - proto.inputFPS = - proto.inputFps = - proto.fpsInput = - proto.FPSInput = function(fps) { - if (!this._currentInput) { - throw new Error('No input specified'); - } - - this._currentInput.options('-r', fps); - return this; - }; - - - /** - * Use native framerate for the last specified input - * - * @method FfmpegCommand#native - * @category Input - * @aliases nativeFramerate,withNativeFramerate - * - * @return FfmmegCommand - */ - proto.nativeFramerate = - proto.withNativeFramerate = - proto.native = function() { - if (!this._currentInput) { - throw new Error('No input specified'); - } - - this._currentInput.options('-re'); - return this; - }; - - - /** - * Specify input seek time for the last specified input - * - * @method FfmpegCommand#seekInput - * @category Input - * @aliases setStartTime,seekTo - * - * @param {String|Number} seek seek time in seconds or as a '[hh:[mm:]]ss[.xxx]' string - * @return FfmpegCommand - */ - proto.setStartTime = - proto.seekInput = function(seek) { - if (!this._currentInput) { - throw new Error('No input specified'); - } - - this._currentInput.options('-ss', seek); - - return this; - }; - - - /** - * Loop over the last specified input - * - * @method FfmpegCommand#loop - * @category Input - * - * @param {String|Number} [duration] loop duration in seconds or as a '[[hh:]mm:]ss[.xxx]' string - * @return FfmpegCommand - */ - proto.loop = function(duration) { - if (!this._currentInput) { - throw new Error('No input specified'); - } - - this._currentInput.options('-loop', '1'); - - if (typeof duration !== 'undefined') { - this.duration(duration); - } - - return this; - }; -}; diff --git a/lib/options/misc.js b/lib/options/misc.js deleted file mode 100644 index a92f7aab..00000000 --- a/lib/options/misc.js +++ /dev/null @@ -1,41 +0,0 @@ -/*jshint node:true*/ -'use strict'; - -var path = require('path'); - -/* - *! Miscellaneous methods - */ - -module.exports = function(proto) { - /** - * Use preset - * - * @method FfmpegCommand#preset - * @category Miscellaneous - * @aliases usingPreset - * - * @param {String|Function} preset preset name or preset function - */ - proto.usingPreset = - proto.preset = function(preset) { - if (typeof preset === 'function') { - preset(this); - } else { - try { - var modulePath = path.join(this.options.presets, preset); - var module = require(modulePath); - - if (typeof module.load === 'function') { - module.load(this); - } else { - throw new Error('preset ' + modulePath + ' has no load() function'); - } - } catch (err) { - throw new Error('preset ' + modulePath + ' could not be loaded: ' + err.message); - } - } - - return this; - }; -}; diff --git a/lib/options/output.js b/lib/options/output.js deleted file mode 100644 index da4f7711..00000000 --- a/lib/options/output.js +++ /dev/null @@ -1,162 +0,0 @@ -/*jshint node:true*/ -'use strict'; - -var utils = require('../utils'); - - -/* - *! Output-related methods - */ - -module.exports = function(proto) { - /** - * Add output - * - * @method FfmpegCommand#output - * @category Output - * @aliases addOutput - * - * @param {String|Writable} target target file path or writable stream - * @param {Object} [pipeopts={}] pipe options (only applies to streams) - * @return FfmpegCommand - */ - proto.addOutput = - proto.output = function(target, pipeopts) { - var isFile = false; - - if (!target && this._currentOutput) { - // No target is only allowed when called from constructor - throw new Error('Invalid output'); - } - - if (target && typeof target !== 'string') { - if (!('writable' in target) || !(target.writable)) { - throw new Error('Invalid output'); - } - } else if (typeof target === 'string') { - var protocol = target.match(/^([a-z]{2,}):/i); - isFile = !protocol || protocol[0] === 'file'; - } - - if (target && !('target' in this._currentOutput)) { - // For backwards compatibility, set target for first output - this._currentOutput.target = target; - this._currentOutput.isFile = isFile; - this._currentOutput.pipeopts = pipeopts || {}; - } else { - if (target && typeof target !== 'string') { - var hasOutputStream = this._outputs.some(function(output) { - return typeof output.target !== 'string'; - }); - - if (hasOutputStream) { - throw new Error('Only one output stream is supported'); - } - } - - this._outputs.push(this._currentOutput = { - target: target, - isFile: isFile, - flags: {}, - pipeopts: pipeopts || {} - }); - - var self = this; - ['audio', 'audioFilters', 'video', 'videoFilters', 'sizeFilters', 'options'].forEach(function(key) { - self._currentOutput[key] = utils.args(); - }); - - if (!target) { - // Call from constructor: remove target key - delete this._currentOutput.target; - } - } - - return this; - }; - - - /** - * Specify output seek time - * - * @method FfmpegCommand#seek - * @category Input - * @aliases seekOutput - * - * @param {String|Number} seek seek time in seconds or as a '[hh:[mm:]]ss[.xxx]' string - * @return FfmpegCommand - */ - proto.seekOutput = - proto.seek = function(seek) { - this._currentOutput.options('-ss', seek); - return this; - }; - - - /** - * Set output duration - * - * @method FfmpegCommand#duration - * @category Output - * @aliases withDuration,setDuration - * - * @param {String|Number} duration duration in seconds or as a '[[hh:]mm:]ss[.xxx]' string - * @return FfmpegCommand - */ - proto.withDuration = - proto.setDuration = - proto.duration = function(duration) { - this._currentOutput.options('-t', duration); - return this; - }; - - - /** - * Set output format - * - * @method FfmpegCommand#format - * @category Output - * @aliases toFormat,withOutputFormat,outputFormat - * - * @param {String} format output format name - * @return FfmpegCommand - */ - proto.toFormat = - proto.withOutputFormat = - proto.outputFormat = - proto.format = function(format) { - this._currentOutput.options('-f', format); - return this; - }; - - - /** - * Add stream mapping to output - * - * @method FfmpegCommand#map - * @category Output - * - * @param {String} spec stream specification string, with optional square brackets - * @return FfmpegCommand - */ - proto.map = function(spec) { - this._currentOutput.options('-map', spec.replace(utils.streamRegexp, '[$1]')); - return this; - }; - - - /** - * Run flvtool2/flvmeta on output - * - * @method FfmpegCommand#flvmeta - * @category Output - * @aliases updateFlvMetadata - * - * @return FfmpegCommand - */ - proto.updateFlvMetadata = - proto.flvmeta = function() { - this._currentOutput.flags.flvmeta = true; - return this; - }; -}; diff --git a/lib/options/video.js b/lib/options/video.js deleted file mode 100644 index bb13c664..00000000 --- a/lib/options/video.js +++ /dev/null @@ -1,184 +0,0 @@ -/*jshint node:true*/ -'use strict'; - -var utils = require('../utils'); - - -/* - *! Video-related methods - */ - -module.exports = function(proto) { - /** - * Disable video in the output - * - * @method FfmpegCommand#noVideo - * @category Video - * @aliases withNoVideo - * - * @return FfmpegCommand - */ - proto.withNoVideo = - proto.noVideo = function() { - this._currentOutput.video.clear(); - this._currentOutput.videoFilters.clear(); - this._currentOutput.video('-vn'); - - return this; - }; - - - /** - * Specify video codec - * - * @method FfmpegCommand#videoCodec - * @category Video - * @aliases withVideoCodec - * - * @param {String} codec video codec name - * @return FfmpegCommand - */ - proto.withVideoCodec = - proto.videoCodec = function(codec) { - this._currentOutput.video('-vcodec', codec); - return this; - }; - - - /** - * Specify video bitrate - * - * @method FfmpegCommand#videoBitrate - * @category Video - * @aliases withVideoBitrate - * - * @param {String|Number} bitrate video bitrate in kbps (with an optional 'k' suffix) - * @param {Boolean} [constant=false] enforce constant bitrate - * @return FfmpegCommand - */ - proto.withVideoBitrate = - proto.videoBitrate = function(bitrate, constant) { - bitrate = ('' + bitrate).replace(/k?$/, 'k'); - - this._currentOutput.video('-b:v', bitrate); - if (constant) { - this._currentOutput.video( - '-maxrate', bitrate, - '-minrate', bitrate, - '-bufsize', '3M' - ); - } - - return this; - }; - - - /** - * Specify custom video filter(s) - * - * Can be called both with one or many filters, or a filter array. - * - * @example - * command.videoFilters('filter1'); - * - * @example - * command.videoFilters('filter1', 'filter2=param1=value1:param2=value2'); - * - * @example - * command.videoFilters(['filter1', 'filter2']); - * - * @example - * command.videoFilters([ - * { - * filter: 'filter1' - * }, - * { - * filter: 'filter2', - * options: 'param=value:param=value' - * } - * ]); - * - * @example - * command.videoFilters( - * { - * filter: 'filter1', - * options: ['value1', 'value2'] - * }, - * { - * filter: 'filter2', - * options: { param1: 'value1', param2: 'value2' } - * } - * ); - * - * @method FfmpegCommand#videoFilters - * @category Video - * @aliases withVideoFilter,withVideoFilters,videoFilter - * - * @param {...String|String[]|Object[]} filters video filter strings, string array or - * filter specification array, each with the following properties: - * @param {String} filters.filter filter name - * @param {String|String[]|Object} [filters.options] filter option string, array, or object - * @return FfmpegCommand - */ - proto.withVideoFilter = - proto.withVideoFilters = - proto.videoFilter = - proto.videoFilters = function(filters) { - if (arguments.length > 1) { - filters = [].slice.call(arguments); - } - - if (!Array.isArray(filters)) { - filters = [filters]; - } - - this._currentOutput.videoFilters(utils.makeFilterStrings(filters)); - - return this; - }; - - - /** - * Specify output FPS - * - * @method FfmpegCommand#fps - * @category Video - * @aliases withOutputFps,withOutputFPS,withFpsOutput,withFPSOutput,withFps,withFPS,outputFPS,outputFps,fpsOutput,FPSOutput,FPS - * - * @param {Number} fps output FPS - * @return FfmpegCommand - */ - proto.withOutputFps = - proto.withOutputFPS = - proto.withFpsOutput = - proto.withFPSOutput = - proto.withFps = - proto.withFPS = - proto.outputFPS = - proto.outputFps = - proto.fpsOutput = - proto.FPSOutput = - proto.fps = - proto.FPS = function(fps) { - this._currentOutput.video('-r', fps); - return this; - }; - - - /** - * Only transcode a certain number of frames - * - * @method FfmpegCommand#frames - * @category Video - * @aliases takeFrames,withFrames - * - * @param {Number} frames frame count - * @return FfmpegCommand - */ - proto.takeFrames = - proto.withFrames = - proto.frames = function(frames) { - this._currentOutput.video('-vframes', frames); - return this; - }; -}; diff --git a/lib/options/videosize.js b/lib/options/videosize.js deleted file mode 100644 index b175dcd4..00000000 --- a/lib/options/videosize.js +++ /dev/null @@ -1,291 +0,0 @@ -/*jshint node:true*/ -'use strict'; - -/* - *! Size helpers - */ - - -/** - * Return filters to pad video to width*height, - * - * @param {Number} width output width - * @param {Number} height output height - * @param {Number} aspect video aspect ratio (without padding) - * @param {Number} color padding color - * @return scale/pad filters - * @private - */ -function getScalePadFilters(width, height, aspect, color) { - /* - let a be the input aspect ratio, A be the requested aspect ratio - - if a > A, padding is done on top and bottom - if a < A, padding is done on left and right - */ - - return [ - /* - In both cases, we first have to scale the input to match the requested size. - When using computed width/height, we truncate them to multiples of 2 - */ - { - filter: 'scale', - options: { - w: 'if(gt(a,' + aspect + '),' + width + ',trunc(' + height + '*a/2)*2)', - h: 'if(lt(a,' + aspect + '),' + height + ',trunc(' + width + '/a/2)*2)' - } - }, - - /* - Then we pad the scaled input to match the target size - (here iw and ih refer to the padding input, i.e the scaled output) - */ - - { - filter: 'pad', - options: { - w: width, - h: height, - x: 'if(gt(a,' + aspect + '),0,(' + width + '-iw)/2)', - y: 'if(lt(a,' + aspect + '),0,(' + height + '-ih)/2)', - color: color - } - } - ]; -} - - -/** - * Recompute size filters - * - * @param {Object} output - * @param {String} key newly-added parameter name ('size', 'aspect' or 'pad') - * @param {String} value newly-added parameter value - * @return filter string array - * @private - */ -function createSizeFilters(output, key, value) { - // Store parameters - var data = output.sizeData = output.sizeData || {}; - data[key] = value; - - if (!('size' in data)) { - // No size requested, keep original size - return []; - } - - // Try to match the different size string formats - var fixedSize = data.size.match(/([0-9]+)x([0-9]+)/); - var fixedWidth = data.size.match(/([0-9]+)x\?/); - var fixedHeight = data.size.match(/\?x([0-9]+)/); - var percentRatio = data.size.match(/\b([0-9]{1,3})%/); - var width, height, aspect; - - if (percentRatio) { - var ratio = Number(percentRatio[1]) / 100; - return [{ - filter: 'scale', - options: { - w: 'trunc(iw*' + ratio + '/2)*2', - h: 'trunc(ih*' + ratio + '/2)*2' - } - }]; - } else if (fixedSize) { - // Round target size to multiples of 2 - width = Math.round(Number(fixedSize[1]) / 2) * 2; - height = Math.round(Number(fixedSize[2]) / 2) * 2; - - aspect = width / height; - - if (data.pad) { - return getScalePadFilters(width, height, aspect, data.pad); - } else { - // No autopad requested, rescale to target size - return [{ filter: 'scale', options: { w: width, h: height }}]; - } - } else if (fixedWidth || fixedHeight) { - if ('aspect' in data) { - // Specified aspect ratio - width = fixedWidth ? fixedWidth[1] : Math.round(Number(fixedHeight[1]) * data.aspect); - height = fixedHeight ? fixedHeight[1] : Math.round(Number(fixedWidth[1]) / data.aspect); - - // Round to multiples of 2 - width = Math.round(width / 2) * 2; - height = Math.round(height / 2) * 2; - - if (data.pad) { - return getScalePadFilters(width, height, data.aspect, data.pad); - } else { - // No autopad requested, rescale to target size - return [{ filter: 'scale', options: { w: width, h: height }}]; - } - } else { - // Keep input aspect ratio - - if (fixedWidth) { - return [{ - filter: 'scale', - options: { - w: Math.round(Number(fixedWidth[1]) / 2) * 2, - h: 'trunc(ow/a/2)*2' - } - }]; - } else { - return [{ - filter: 'scale', - options: { - w: 'trunc(oh*a/2)*2', - h: Math.round(Number(fixedHeight[1]) / 2) * 2 - } - }]; - } - } - } else { - throw new Error('Invalid size specified: ' + data.size); - } -} - - -/* - *! Video size-related methods - */ - -module.exports = function(proto) { - /** - * Keep display aspect ratio - * - * This method is useful when converting an input with non-square pixels to an output format - * that does not support non-square pixels. It rescales the input so that the display aspect - * ratio is the same. - * - * @method FfmpegCommand#keepDAR - * @category Video size - * @aliases keepPixelAspect,keepDisplayAspect,keepDisplayAspectRatio - * - * @return FfmpegCommand - */ - proto.keepPixelAspect = // Only for compatibility, this is not about keeping _pixel_ aspect ratio - proto.keepDisplayAspect = - proto.keepDisplayAspectRatio = - proto.keepDAR = function() { - return this.videoFilters([ - { - filter: 'scale', - options: { - w: 'if(gt(sar,1),iw*sar,iw)', - h: 'if(lt(sar,1),ih/sar,ih)' - } - }, - { - filter: 'setsar', - options: '1' - } - ]); - }; - - - /** - * Set output size - * - * The 'size' parameter can have one of 4 forms: - * - 'X%': rescale to xx % of the original size - * - 'WxH': specify width and height - * - 'Wx?': specify width and compute height from input aspect ratio - * - '?xH': specify height and compute width from input aspect ratio - * - * Note: both dimensions will be truncated to multiples of 2. - * - * @method FfmpegCommand#size - * @category Video size - * @aliases withSize,setSize - * - * @param {String} size size string, eg. '33%', '320x240', '320x?', '?x240' - * @return FfmpegCommand - */ - proto.withSize = - proto.setSize = - proto.size = function(size) { - var filters = createSizeFilters(this._currentOutput, 'size', size); - - this._currentOutput.sizeFilters.clear(); - this._currentOutput.sizeFilters(filters); - - return this; - }; - - - /** - * Set output aspect ratio - * - * @method FfmpegCommand#aspect - * @category Video size - * @aliases withAspect,withAspectRatio,setAspect,setAspectRatio,aspectRatio - * - * @param {String|Number} aspect aspect ratio (number or 'X:Y' string) - * @return FfmpegCommand - */ - proto.withAspect = - proto.withAspectRatio = - proto.setAspect = - proto.setAspectRatio = - proto.aspect = - proto.aspectRatio = function(aspect) { - var a = Number(aspect); - if (isNaN(a)) { - var match = aspect.match(/^(\d+):(\d+)$/); - if (match) { - a = Number(match[1]) / Number(match[2]); - } else { - throw new Error('Invalid aspect ratio: ' + aspect); - } - } - - var filters = createSizeFilters(this._currentOutput, 'aspect', a); - - this._currentOutput.sizeFilters.clear(); - this._currentOutput.sizeFilters(filters); - - return this; - }; - - - /** - * Enable auto-padding the output - * - * @method FfmpegCommand#autopad - * @category Video size - * @aliases applyAutopadding,applyAutoPadding,applyAutopad,applyAutoPad,withAutopadding,withAutoPadding,withAutopad,withAutoPad,autoPad - * - * @param {Boolean} [pad=true] enable/disable auto-padding - * @param {String} [color='black'] pad color - */ - proto.applyAutopadding = - proto.applyAutoPadding = - proto.applyAutopad = - proto.applyAutoPad = - proto.withAutopadding = - proto.withAutoPadding = - proto.withAutopad = - proto.withAutoPad = - proto.autoPad = - proto.autopad = function(pad, color) { - // Allow autopad(color) - if (typeof pad === 'string') { - color = pad; - pad = true; - } - - // Allow autopad() and autopad(undefined, color) - if (typeof pad === 'undefined') { - pad = true; - } - - var filters = createSizeFilters(this._currentOutput, 'pad', pad ? color || 'black' : false); - - this._currentOutput.sizeFilters.clear(); - this._currentOutput.sizeFilters(filters); - - return this; - }; -}; diff --git a/lib/presets/divx.js b/lib/presets/divx.js deleted file mode 100644 index 128236e9..00000000 --- a/lib/presets/divx.js +++ /dev/null @@ -1,14 +0,0 @@ -/*jshint node:true */ -'use strict'; - -exports.load = function(ffmpeg) { - ffmpeg - .format('avi') - .videoBitrate('1024k') - .videoCodec('mpeg4') - .size('720x?') - .audioBitrate('128k') - .audioChannels(2) - .audioCodec('libmp3lame') - .outputOptions(['-vtag DIVX']); -}; \ No newline at end of file diff --git a/lib/presets/flashvideo.js b/lib/presets/flashvideo.js deleted file mode 100644 index 72f9a5cb..00000000 --- a/lib/presets/flashvideo.js +++ /dev/null @@ -1,16 +0,0 @@ -/*jshint node:true */ -'use strict'; - -exports.load = function(ffmpeg) { - ffmpeg - .format('flv') - .flvmeta() - .size('320x?') - .videoBitrate('512k') - .videoCodec('libx264') - .fps(24) - .audioBitrate('96k') - .audioCodec('aac') - .audioFrequency(22050) - .audioChannels(2); -}; diff --git a/lib/presets/podcast.js b/lib/presets/podcast.js deleted file mode 100644 index 06b7a3c3..00000000 --- a/lib/presets/podcast.js +++ /dev/null @@ -1,16 +0,0 @@ -/*jshint node:true */ -'use strict'; - -exports.load = function(ffmpeg) { - ffmpeg - .format('m4v') - .videoBitrate('512k') - .videoCodec('libx264') - .size('320x176') - .audioBitrate('128k') - .audioCodec('aac') - .audioChannels(1) - .outputOptions(['-flags', '+loop', '-cmp', '+chroma', '-partitions','+parti4x4+partp8x8+partb8x8', '-flags2', - '+mixed_refs', '-me_method umh', '-subq 5', '-bufsize 2M', '-rc_eq \'blurCplx^(1-qComp)\'', - '-qcomp 0.6', '-qmin 10', '-qmax 51', '-qdiff 4', '-level 13' ]); -}; diff --git a/lib/processor.js b/lib/processor.js deleted file mode 100644 index 36d980ad..00000000 --- a/lib/processor.js +++ /dev/null @@ -1,662 +0,0 @@ -/*jshint node:true*/ -'use strict'; - -var spawn = require('child_process').spawn; -var path = require('path'); -var fs = require('fs'); -var async = require('async'); -var utils = require('./utils'); - -/* - *! Processor methods - */ - - -/** - * Run ffprobe asynchronously and store data in command - * - * @param {FfmpegCommand} command - * @private - */ -function runFfprobe(command) { - const inputProbeIndex = 0; - if (command._inputs[inputProbeIndex].isStream) { - // Don't probe input streams as this will consume them - return; - } - command.ffprobe(inputProbeIndex, function(err, data) { - command._ffprobeData = data; - }); -} - - -module.exports = function(proto) { - /** - * Emitted just after ffmpeg has been spawned. - * - * @event FfmpegCommand#start - * @param {String} command ffmpeg command line - */ - - /** - * Emitted when ffmpeg reports progress information - * - * @event FfmpegCommand#progress - * @param {Object} progress progress object - * @param {Number} progress.frames number of frames transcoded - * @param {Number} progress.currentFps current processing speed in frames per second - * @param {Number} progress.currentKbps current output generation speed in kilobytes per second - * @param {Number} progress.targetSize current output file size - * @param {String} progress.timemark current video timemark - * @param {Number} [progress.percent] processing progress (may not be available depending on input) - */ - - /** - * Emitted when ffmpeg outputs to stderr - * - * @event FfmpegCommand#stderr - * @param {String} line stderr output line - */ - - /** - * Emitted when ffmpeg reports input codec data - * - * @event FfmpegCommand#codecData - * @param {Object} codecData codec data object - * @param {String} codecData.format input format name - * @param {String} codecData.audio input audio codec name - * @param {String} codecData.audio_details input audio codec parameters - * @param {String} codecData.video input video codec name - * @param {String} codecData.video_details input video codec parameters - */ - - /** - * Emitted when an error happens when preparing or running a command - * - * @event FfmpegCommand#error - * @param {Error} error error object, with optional properties 'inputStreamError' / 'outputStreamError' for errors on their respective streams - * @param {String|null} stdout ffmpeg stdout, unless outputting to a stream - * @param {String|null} stderr ffmpeg stderr - */ - - /** - * Emitted when a command finishes processing - * - * @event FfmpegCommand#end - * @param {Array|String|null} [filenames|stdout] generated filenames when taking screenshots, ffmpeg stdout when not outputting to a stream, null otherwise - * @param {String|null} stderr ffmpeg stderr - */ - - - /** - * Spawn an ffmpeg process - * - * The 'options' argument may contain the following keys: - * - 'niceness': specify process niceness, ignored on Windows (default: 0) - * - `cwd`: change working directory - * - 'captureStdout': capture stdout and pass it to 'endCB' as its 2nd argument (default: false) - * - 'stdoutLines': override command limit (default: use command limit) - * - * The 'processCB' callback, if present, is called as soon as the process is created and - * receives a nodejs ChildProcess object. It may not be called at all if an error happens - * before spawning the process. - * - * The 'endCB' callback is called either when an error occurs or when the ffmpeg process finishes. - * - * @method FfmpegCommand#_spawnFfmpeg - * @param {Array} args ffmpeg command line argument list - * @param {Object} [options] spawn options (see above) - * @param {Function} [processCB] callback called with process object and stdout/stderr ring buffers when process has been created - * @param {Function} endCB callback called with error (if applicable) and stdout/stderr ring buffers when process finished - * @private - */ - proto._spawnFfmpeg = function(args, options, processCB, endCB) { - // Enable omitting options - if (typeof options === 'function') { - endCB = processCB; - processCB = options; - options = {}; - } - - // Enable omitting processCB - if (typeof endCB === 'undefined') { - endCB = processCB; - processCB = function() {}; - } - - var maxLines = 'stdoutLines' in options ? options.stdoutLines : this.options.stdoutLines; - - // Find ffmpeg - this._getFfmpegPath(function(err, command) { - if (err) { - return endCB(err); - } else if (!command || command.length === 0) { - return endCB(new Error('Cannot find ffmpeg')); - } - - // Apply niceness - if (options.niceness && options.niceness !== 0 && !utils.isWindows) { - args.unshift('-n', options.niceness, command); - command = 'nice'; - } - - var stdoutRing = utils.linesRing(maxLines); - var stdoutClosed = false; - - var stderrRing = utils.linesRing(maxLines); - var stderrClosed = false; - - // Spawn process - var ffmpegProc = spawn(command, args, options); - - if (ffmpegProc.stderr) { - ffmpegProc.stderr.setEncoding('utf8'); - } - - ffmpegProc.on('error', function(err) { - endCB(err); - }); - - // Ensure we wait for captured streams to end before calling endCB - var exitError = null; - function handleExit(err) { - if (err) { - exitError = err; - } - - if (processExited && (stdoutClosed || !options.captureStdout) && stderrClosed) { - endCB(exitError, stdoutRing, stderrRing); - } - } - - // Handle process exit - var processExited = false; - ffmpegProc.on('exit', function(code, signal) { - processExited = true; - - if (signal) { - handleExit(new Error('ffmpeg was killed with signal ' + signal)); - } else if (code) { - handleExit(new Error('ffmpeg exited with code ' + code)); - } else { - handleExit(); - } - }); - - // Capture stdout if specified - if (options.captureStdout) { - ffmpegProc.stdout.on('data', function(data) { - stdoutRing.append(data); - }); - - ffmpegProc.stdout.on('close', function() { - stdoutRing.close(); - stdoutClosed = true; - handleExit(); - }); - } - - // Capture stderr if specified - ffmpegProc.stderr.on('data', function(data) { - stderrRing.append(data); - }); - - ffmpegProc.stderr.on('close', function() { - stderrRing.close(); - stderrClosed = true; - handleExit(); - }); - - // Call process callback - processCB(ffmpegProc, stdoutRing, stderrRing); - }); - }; - - - /** - * Build the argument list for an ffmpeg command - * - * @method FfmpegCommand#_getArguments - * @return argument list - * @private - */ - proto._getArguments = function() { - var complexFilters = this._complexFilters.get(); - - var fileOutput = this._outputs.some(function(output) { - return output.isFile; - }); - - return [].concat( - // Inputs and input options - this._inputs.reduce(function(args, input) { - var source = (typeof input.source === 'string') ? input.source : 'pipe:0'; - - // For each input, add input options, then '-i ' - return args.concat( - input.options.get(), - ['-i', source] - ); - }, []), - - // Global options - this._global.get(), - - // Overwrite if we have file outputs - fileOutput ? ['-y'] : [], - - // Complex filters - complexFilters, - - // Outputs, filters and output options - this._outputs.reduce(function(args, output) { - var sizeFilters = utils.makeFilterStrings(output.sizeFilters.get()); - var audioFilters = output.audioFilters.get(); - var videoFilters = output.videoFilters.get().concat(sizeFilters); - var outputArg; - - if (!output.target) { - outputArg = []; - } else if (typeof output.target === 'string') { - outputArg = [output.target]; - } else { - outputArg = ['pipe:1']; - } - - return args.concat( - output.audio.get(), - audioFilters.length ? ['-filter:a', audioFilters.join(',')] : [], - output.video.get(), - videoFilters.length ? ['-filter:v', videoFilters.join(',')] : [], - output.options.get(), - outputArg - ); - }, []) - ); - }; - - - /** - * Prepare execution of an ffmpeg command - * - * Checks prerequisites for the execution of the command (codec/format availability, flvtool...), - * then builds the argument list for ffmpeg and pass them to 'callback'. - * - * @method FfmpegCommand#_prepare - * @param {Function} callback callback with signature (err, args) - * @param {Boolean} [readMetadata=false] read metadata before processing - * @private - */ - proto._prepare = function(callback, readMetadata) { - var self = this; - - async.waterfall([ - // Check codecs and formats - function(cb) { - self._checkCapabilities(cb); - }, - - // Read metadata if required - function(cb) { - if (!readMetadata) { - return cb(); - } - - self.ffprobe(0, function(err, data) { - if (!err) { - self._ffprobeData = data; - } - - cb(); - }); - }, - - // Check for flvtool2/flvmeta if necessary - function(cb) { - var flvmeta = self._outputs.some(function(output) { - // Remove flvmeta flag on non-file output - if (output.flags.flvmeta && !output.isFile) { - self.logger.warn('Updating flv metadata is only supported for files'); - output.flags.flvmeta = false; - } - - return output.flags.flvmeta; - }); - - if (flvmeta) { - self._getFlvtoolPath(function(err) { - cb(err); - }); - } else { - cb(); - } - }, - - // Build argument list - function(cb) { - var args; - try { - args = self._getArguments(); - } catch(e) { - return cb(e); - } - - cb(null, args); - }, - - // Add "-strict experimental" option where needed - function(args, cb) { - self.availableEncoders(function(err, encoders) { - for (var i = 0; i < args.length; i++) { - if (args[i] === '-acodec' || args[i] === '-vcodec') { - i++; - - if ((args[i] in encoders) && encoders[args[i]].experimental) { - args.splice(i + 1, 0, '-strict', 'experimental'); - i += 2; - } - } - } - - cb(null, args); - }); - } - ], callback); - - if (!readMetadata) { - // Read metadata as soon as 'progress' listeners are added - - if (this.listeners('progress').length > 0) { - // Read metadata in parallel - runFfprobe(this); - } else { - // Read metadata as soon as the first 'progress' listener is added - this.once('newListener', function(event) { - if (event === 'progress') { - runFfprobe(this); - } - }); - } - } - }; - - - /** - * Run ffmpeg command - * - * @method FfmpegCommand#run - * @category Processing - * @aliases exec,execute - */ - proto.exec = - proto.execute = - proto.run = function() { - var self = this; - - // Check if at least one output is present - var outputPresent = this._outputs.some(function(output) { - return 'target' in output; - }); - - if (!outputPresent) { - throw new Error('No output specified'); - } - - // Get output stream if any - var outputStream = this._outputs.filter(function(output) { - return typeof output.target !== 'string'; - })[0]; - - // Get input stream if any - var inputStream = this._inputs.filter(function(input) { - return typeof input.source !== 'string'; - })[0]; - - // Ensure we send 'end' or 'error' only once - var ended = false; - function emitEnd(err, stdout, stderr) { - if (!ended) { - ended = true; - - if (err) { - self.emit('error', err, stdout, stderr); - } else { - self.emit('end', stdout, stderr); - } - } - } - - self._prepare(function(err, args) { - if (err) { - return emitEnd(err); - } - - // Run ffmpeg - self._spawnFfmpeg( - args, - { - captureStdout: !outputStream, - niceness: self.options.niceness, - cwd: self.options.cwd, - windowsHide: true - }, - - function processCB(ffmpegProc, stdoutRing, stderrRing) { - self.ffmpegProc = ffmpegProc; - self.emit('start', 'ffmpeg ' + args.join(' ')); - - // Pipe input stream if any - if (inputStream) { - inputStream.source.on('error', function(err) { - var reportingErr = new Error('Input stream error: ' + err.message); - reportingErr.inputStreamError = err; - emitEnd(reportingErr); - ffmpegProc.kill(); - }); - - inputStream.source.resume(); - inputStream.source.pipe(ffmpegProc.stdin); - - // Set stdin error handler on ffmpeg (prevents nodejs catching the error, but - // ffmpeg will fail anyway, so no need to actually handle anything) - ffmpegProc.stdin.on('error', function() {}); - } - - // Setup timeout if requested - if (self.options.timeout) { - self.processTimer = setTimeout(function() { - var msg = 'process ran into a timeout (' + self.options.timeout + 's)'; - - emitEnd(new Error(msg), stdoutRing.get(), stderrRing.get()); - ffmpegProc.kill(); - }, self.options.timeout * 1000); - } - - - if (outputStream) { - // Pipe ffmpeg stdout to output stream - ffmpegProc.stdout.pipe(outputStream.target, outputStream.pipeopts); - - // Handle output stream events - outputStream.target.on('close', function() { - self.logger.debug('Output stream closed, scheduling kill for ffmpeg process'); - - // Don't kill process yet, to give a chance to ffmpeg to - // terminate successfully first This is necessary because - // under load, the process 'exit' event sometimes happens - // after the output stream 'close' event. - setTimeout(function() { - emitEnd(new Error('Output stream closed')); - ffmpegProc.kill(); - }, 20); - }); - - outputStream.target.on('error', function(err) { - self.logger.debug('Output stream error, killing ffmpeg process'); - var reportingErr = new Error('Output stream error: ' + err.message); - reportingErr.outputStreamError = err; - emitEnd(reportingErr, stdoutRing.get(), stderrRing.get()); - ffmpegProc.kill('SIGKILL'); - }); - } - - // Setup stderr handling - if (stderrRing) { - - // 'stderr' event - if (self.listeners('stderr').length) { - stderrRing.callback(function(line) { - self.emit('stderr', line); - }); - } - - // 'codecData' event - if (self.listeners('codecData').length) { - var codecDataSent = false; - var codecObject = {}; - - stderrRing.callback(function(line) { - if (!codecDataSent) - codecDataSent = utils.extractCodecData(self, line, codecObject); - }); - } - - // 'progress' event - if (self.listeners('progress').length) { - stderrRing.callback(function(line) { - utils.extractProgress(self, line); - }); - } - } - }, - - function endCB(err, stdoutRing, stderrRing) { - clearTimeout(self.processTimer); - delete self.ffmpegProc; - - if (err) { - if (err.message.match(/ffmpeg exited with code/)) { - // Add ffmpeg error message - err.message += ': ' + utils.extractError(stderrRing.get()); - } - - emitEnd(err, stdoutRing.get(), stderrRing.get()); - } else { - // Find out which outputs need flv metadata - var flvmeta = self._outputs.filter(function(output) { - return output.flags.flvmeta; - }); - - if (flvmeta.length) { - self._getFlvtoolPath(function(err, flvtool) { - if (err) { - return emitEnd(err); - } - - async.each( - flvmeta, - function(output, cb) { - spawn(flvtool, ['-U', output.target], {windowsHide: true}) - .on('error', function(err) { - cb(new Error('Error running ' + flvtool + ' on ' + output.target + ': ' + err.message)); - }) - .on('exit', function(code, signal) { - if (code !== 0 || signal) { - cb( - new Error(flvtool + ' ' + - (signal ? 'received signal ' + signal - : 'exited with code ' + code)) + - ' when running on ' + output.target - ); - } else { - cb(); - } - }); - }, - function(err) { - if (err) { - emitEnd(err); - } else { - emitEnd(null, stdoutRing.get(), stderrRing.get()); - } - } - ); - }); - } else { - emitEnd(null, stdoutRing.get(), stderrRing.get()); - } - } - } - ); - }); - - return this; - }; - - - /** - * Renice current and/or future ffmpeg processes - * - * Ignored on Windows platforms. - * - * @method FfmpegCommand#renice - * @category Processing - * - * @param {Number} [niceness=0] niceness value between -20 (highest priority) and 20 (lowest priority) - * @return FfmpegCommand - */ - proto.renice = function(niceness) { - if (!utils.isWindows) { - niceness = niceness || 0; - - if (niceness < -20 || niceness > 20) { - this.logger.warn('Invalid niceness value: ' + niceness + ', must be between -20 and 20'); - } - - niceness = Math.min(20, Math.max(-20, niceness)); - this.options.niceness = niceness; - - if (this.ffmpegProc) { - var logger = this.logger; - var pid = this.ffmpegProc.pid; - var renice = spawn('renice', [niceness, '-p', pid], {windowsHide: true}); - - renice.on('error', function(err) { - logger.warn('could not renice process ' + pid + ': ' + err.message); - }); - - renice.on('exit', function(code, signal) { - if (signal) { - logger.warn('could not renice process ' + pid + ': renice was killed by signal ' + signal); - } else if (code) { - logger.warn('could not renice process ' + pid + ': renice exited with ' + code); - } else { - logger.info('successfully reniced process ' + pid + ' to ' + niceness + ' niceness'); - } - }); - } - } - - return this; - }; - - - /** - * Kill current ffmpeg process, if any - * - * @method FfmpegCommand#kill - * @category Processing - * - * @param {String} [signal=SIGKILL] signal name - * @return FfmpegCommand - */ - proto.kill = function(signal) { - if (!this.ffmpegProc) { - this.logger.warn('No running ffmpeg process, cannot send signal'); - } else { - this.ffmpegProc.kill(signal || 'SIGKILL'); - } - - return this; - }; -}; diff --git a/lib/recipes.js b/lib/recipes.js deleted file mode 100644 index 4ee1223e..00000000 --- a/lib/recipes.js +++ /dev/null @@ -1,456 +0,0 @@ -/*jshint node:true*/ -'use strict'; - -var fs = require('fs'); -var path = require('path'); -var PassThrough = require('stream').PassThrough; -var async = require('async'); -var utils = require('./utils'); - - -/* - * Useful recipes for commands - */ - -module.exports = function recipes(proto) { - /** - * Execute ffmpeg command and save output to a file - * - * @method FfmpegCommand#save - * @category Processing - * @aliases saveToFile - * - * @param {String} output file path - * @return FfmpegCommand - */ - proto.saveToFile = - proto.save = function(output) { - this.output(output).run(); - return this; - }; - - - /** - * Execute ffmpeg command and save output to a stream - * - * If 'stream' is not specified, a PassThrough stream is created and returned. - * 'options' will be used when piping ffmpeg output to the output stream - * (@see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options) - * - * @method FfmpegCommand#pipe - * @category Processing - * @aliases stream,writeToStream - * - * @param {stream.Writable} [stream] output stream - * @param {Object} [options={}] pipe options - * @return Output stream - */ - proto.writeToStream = - proto.pipe = - proto.stream = function(stream, options) { - if (stream && !('writable' in stream)) { - options = stream; - stream = undefined; - } - - if (!stream) { - if (process.version.match(/v0\.8\./)) { - throw new Error('PassThrough stream is not supported on node v0.8'); - } - - stream = new PassThrough(); - } - - this.output(stream, options).run(); - return stream; - }; - - - /** - * Generate images from a video - * - * Note: this method makes the command emit a 'filenames' event with an array of - * the generated image filenames. - * - * @method FfmpegCommand#screenshots - * @category Processing - * @aliases takeScreenshots,thumbnail,thumbnails,screenshot - * - * @param {Number|Object} [config=1] screenshot count or configuration object with - * the following keys: - * @param {Number} [config.count] number of screenshots to take; using this option - * takes screenshots at regular intervals (eg. count=4 would take screens at 20%, 40%, - * 60% and 80% of the video length). - * @param {String} [config.folder='.'] output folder - * @param {String} [config.filename='tn.png'] output filename pattern, may contain the following - * tokens: - * - '%s': offset in seconds - * - '%w': screenshot width - * - '%h': screenshot height - * - '%r': screenshot resolution (same as '%wx%h') - * - '%f': input filename - * - '%b': input basename (filename w/o extension) - * - '%i': index of screenshot in timemark array (can be zero-padded by using it like `%000i`) - * @param {Number[]|String[]} [config.timemarks] array of timemarks to take screenshots - * at; each timemark may be a number of seconds, a '[[hh:]mm:]ss[.xxx]' string or a - * 'XX%' string. Overrides 'count' if present. - * @param {Number[]|String[]} [config.timestamps] alias for 'timemarks' - * @param {Boolean} [config.fastSeek] use fast seek (less accurate) - * @param {String} [config.size] screenshot size, with the same syntax as {@link FfmpegCommand#size} - * @param {String} [folder] output folder (legacy alias for 'config.folder') - * @return FfmpegCommand - */ - proto.takeScreenshots = - proto.thumbnail = - proto.thumbnails = - proto.screenshot = - proto.screenshots = function(config, folder) { - var self = this; - var source = this._currentInput.source; - config = config || { count: 1 }; - - // Accept a number of screenshots instead of a config object - if (typeof config === 'number') { - config = { - count: config - }; - } - - // Accept a second 'folder' parameter instead of config.folder - if (!('folder' in config)) { - config.folder = folder || '.'; - } - - // Accept 'timestamps' instead of 'timemarks' - if ('timestamps' in config) { - config.timemarks = config.timestamps; - } - - // Compute timemarks from count if not present - if (!('timemarks' in config)) { - if (!config.count) { - throw new Error('Cannot take screenshots: neither a count nor a timemark list are specified'); - } - - var interval = 100 / (1 + config.count); - config.timemarks = []; - for (var i = 0; i < config.count; i++) { - config.timemarks.push((interval * (i + 1)) + '%'); - } - } - - // Parse size option - if ('size' in config) { - var fixedSize = config.size.match(/^(\d+)x(\d+)$/); - var fixedWidth = config.size.match(/^(\d+)x\?$/); - var fixedHeight = config.size.match(/^\?x(\d+)$/); - var percentSize = config.size.match(/^(\d+)%$/); - - if (!fixedSize && !fixedWidth && !fixedHeight && !percentSize) { - throw new Error('Invalid size parameter: ' + config.size); - } - } - - // Metadata helper - var metadata; - function getMetadata(cb) { - if (metadata) { - cb(null, metadata); - } else { - self.ffprobe(function(err, meta) { - metadata = meta; - cb(err, meta); - }); - } - } - - async.waterfall([ - // Compute percent timemarks if any - function computeTimemarks(next) { - if (config.timemarks.some(function(t) { return ('' + t).match(/^[\d.]+%$/); })) { - if (typeof source !== 'string') { - return next(new Error('Cannot compute screenshot timemarks with an input stream, please specify fixed timemarks')); - } - - getMetadata(function(err, meta) { - if (err) { - next(err); - } else { - // Select video stream with the highest resolution - var vstream = meta.streams.reduce(function(biggest, stream) { - if (stream.codec_type === 'video' && stream.width * stream.height > biggest.width * biggest.height) { - return stream; - } else { - return biggest; - } - }, { width: 0, height: 0 }); - - if (vstream.width === 0) { - return next(new Error('No video stream in input, cannot take screenshots')); - } - - var duration = Number(vstream.duration); - if (isNaN(duration)) { - duration = Number(meta.format.duration); - } - - if (isNaN(duration)) { - return next(new Error('Could not get input duration, please specify fixed timemarks')); - } - - config.timemarks = config.timemarks.map(function(mark) { - if (('' + mark).match(/^([\d.]+)%$/)) { - return duration * parseFloat(mark) / 100; - } else { - return mark; - } - }); - - next(); - } - }); - } else { - next(); - } - }, - - // Turn all timemarks into numbers and sort them - function normalizeTimemarks(next) { - config.timemarks = config.timemarks.map(function(mark) { - return utils.timemarkToSeconds(mark); - }).sort(function(a, b) { return a - b; }); - - next(); - }, - - // Add '_%i' to pattern when requesting multiple screenshots and no variable token is present - function fixPattern(next) { - var pattern = config.filename || 'tn.png'; - - if (pattern.indexOf('.') === -1) { - pattern += '.png'; - } - - if (config.timemarks.length > 1 && !pattern.match(/%(s|0*i)/)) { - var ext = path.extname(pattern); - pattern = path.join(path.dirname(pattern), path.basename(pattern, ext) + '_%i' + ext); - } - - next(null, pattern); - }, - - // Replace filename tokens (%f, %b) in pattern - function replaceFilenameTokens(pattern, next) { - if (pattern.match(/%[bf]/)) { - if (typeof source !== 'string') { - return next(new Error('Cannot replace %f or %b when using an input stream')); - } - - pattern = pattern - .replace(/%f/g, path.basename(source)) - .replace(/%b/g, path.basename(source, path.extname(source))); - } - - next(null, pattern); - }, - - // Compute size if needed - function getSize(pattern, next) { - if (pattern.match(/%[whr]/)) { - if (fixedSize) { - return next(null, pattern, fixedSize[1], fixedSize[2]); - } - - getMetadata(function(err, meta) { - if (err) { - return next(new Error('Could not determine video resolution to replace %w, %h or %r')); - } - - var vstream = meta.streams.reduce(function(biggest, stream) { - if (stream.codec_type === 'video' && stream.width * stream.height > biggest.width * biggest.height) { - return stream; - } else { - return biggest; - } - }, { width: 0, height: 0 }); - - if (vstream.width === 0) { - return next(new Error('No video stream in input, cannot replace %w, %h or %r')); - } - - var width = vstream.width; - var height = vstream.height; - - if (fixedWidth) { - height = height * Number(fixedWidth[1]) / width; - width = Number(fixedWidth[1]); - } else if (fixedHeight) { - width = width * Number(fixedHeight[1]) / height; - height = Number(fixedHeight[1]); - } else if (percentSize) { - width = width * Number(percentSize[1]) / 100; - height = height * Number(percentSize[1]) / 100; - } - - next(null, pattern, Math.round(width / 2) * 2, Math.round(height / 2) * 2); - }); - } else { - next(null, pattern, -1, -1); - } - }, - - // Replace size tokens (%w, %h, %r) in pattern - function replaceSizeTokens(pattern, width, height, next) { - pattern = pattern - .replace(/%r/g, '%wx%h') - .replace(/%w/g, width) - .replace(/%h/g, height); - - next(null, pattern); - }, - - // Replace variable tokens in pattern (%s, %i) and generate filename list - function replaceVariableTokens(pattern, next) { - var filenames = config.timemarks.map(function(t, i) { - return pattern - .replace(/%s/g, utils.timemarkToSeconds(t)) - .replace(/%(0*)i/g, function(match, padding) { - var idx = '' + (i + 1); - return padding.substr(0, Math.max(0, padding.length + 1 - idx.length)) + idx; - }); - }); - - self.emit('filenames', filenames); - next(null, filenames); - }, - - // Create output directory - function createDirectory(filenames, next) { - fs.exists(config.folder, function(exists) { - if (!exists) { - fs.mkdir(config.folder, function(err) { - if (err) { - next(err); - } else { - next(null, filenames); - } - }); - } else { - next(null, filenames); - } - }); - } - ], function runCommand(err, filenames) { - if (err) { - return self.emit('error', err); - } - - var count = config.timemarks.length; - var split; - var filters = [split = { - filter: 'split', - options: count, - outputs: [] - }]; - - if ('size' in config) { - // Set size to generate size filters - self.size(config.size); - - // Get size filters and chain them with 'sizeN' stream names - var sizeFilters = self._currentOutput.sizeFilters.get().map(function(f, i) { - if (i > 0) { - f.inputs = 'size' + (i - 1); - } - - f.outputs = 'size' + i; - - return f; - }); - - // Input last size filter output into split filter - split.inputs = 'size' + (sizeFilters.length - 1); - - // Add size filters in front of split filter - filters = sizeFilters.concat(filters); - - // Remove size filters - self._currentOutput.sizeFilters.clear(); - } - - var first = 0; - for (var i = 0; i < count; i++) { - var stream = 'screen' + i; - split.outputs.push(stream); - - if (i === 0) { - first = config.timemarks[i]; - self.seekInput(first); - } - - self.output(path.join(config.folder, filenames[i])) - .frames(1) - .map(stream); - - if (i > 0) { - self.seek(config.timemarks[i] - first); - } - } - - self.complexFilter(filters); - self.run(); - }); - - return this; - }; - - - /** - * Merge (concatenate) inputs to a single file - * - * @method FfmpegCommand#concat - * @category Processing - * @aliases concatenate,mergeToFile - * - * @param {String|Writable} target output file or writable stream - * @param {Object} [options] pipe options (only used when outputting to a writable stream) - * @return FfmpegCommand - */ - proto.mergeToFile = - proto.concatenate = - proto.concat = function(target, options) { - // Find out which streams are present in the first non-stream input - var fileInput = this._inputs.filter(function(input) { - return !input.isStream; - })[0]; - - var self = this; - this.ffprobe(this._inputs.indexOf(fileInput), function(err, data) { - if (err) { - return self.emit('error', err); - } - - var hasAudioStreams = data.streams.some(function(stream) { - return stream.codec_type === 'audio'; - }); - - var hasVideoStreams = data.streams.some(function(stream) { - return stream.codec_type === 'video'; - }); - - // Setup concat filter and start processing - self.output(target, options) - .complexFilter({ - filter: 'concat', - options: { - n: self._inputs.length, - v: hasVideoStreams ? 1 : 0, - a: hasAudioStreams ? 1 : 0 - } - }) - .run(); - }); - - return this; - }; -}; diff --git a/lib/utils.js b/lib/utils.js deleted file mode 100644 index 96909dbd..00000000 --- a/lib/utils.js +++ /dev/null @@ -1,455 +0,0 @@ -/*jshint node:true*/ -'use strict'; - -var exec = require('child_process').exec; -var isWindows = require('os').platform().match(/win(32|64)/); -var which = require('which'); - -var nlRegexp = /\r\n|\r|\n/g; -var streamRegexp = /^\[?(.*?)\]?$/; -var filterEscapeRegexp = /[,]/; -var whichCache = {}; - -/** - * Parse progress line from ffmpeg stderr - * - * @param {String} line progress line - * @return progress object - * @private - */ -function parseProgressLine(line) { - var progress = {}; - - // Remove all spaces after = and trim - line = line.replace(/=\s+/g, '=').trim(); - var progressParts = line.split(' '); - - // Split every progress part by "=" to get key and value - for(var i = 0; i < progressParts.length; i++) { - var progressSplit = progressParts[i].split('=', 2); - var key = progressSplit[0]; - var value = progressSplit[1]; - - // This is not a progress line - if(typeof value === 'undefined') - return null; - - progress[key] = value; - } - - return progress; -} - - -var utils = module.exports = { - isWindows: isWindows, - streamRegexp: streamRegexp, - - - /** - * Copy an object keys into another one - * - * @param {Object} source source object - * @param {Object} dest destination object - * @private - */ - copy: function(source, dest) { - Object.keys(source).forEach(function(key) { - dest[key] = source[key]; - }); - }, - - - /** - * Create an argument list - * - * Returns a function that adds new arguments to the list. - * It also has the following methods: - * - clear() empties the argument list - * - get() returns the argument list - * - find(arg, count) finds 'arg' in the list and return the following 'count' items, or undefined if not found - * - remove(arg, count) remove 'arg' in the list as well as the following 'count' items - * - * @private - */ - args: function() { - var list = []; - - // Append argument(s) to the list - var argfunc = function() { - if (arguments.length === 1 && Array.isArray(arguments[0])) { - list = list.concat(arguments[0]); - } else { - list = list.concat([].slice.call(arguments)); - } - }; - - // Clear argument list - argfunc.clear = function() { - list = []; - }; - - // Return argument list - argfunc.get = function() { - return list; - }; - - // Find argument 'arg' in list, and if found, return an array of the 'count' items that follow it - argfunc.find = function(arg, count) { - var index = list.indexOf(arg); - if (index !== -1) { - return list.slice(index + 1, index + 1 + (count || 0)); - } - }; - - // Find argument 'arg' in list, and if found, remove it as well as the 'count' items that follow it - argfunc.remove = function(arg, count) { - var index = list.indexOf(arg); - if (index !== -1) { - list.splice(index, (count || 0) + 1); - } - }; - - // Clone argument list - argfunc.clone = function() { - var cloned = utils.args(); - cloned(list); - return cloned; - }; - - return argfunc; - }, - - - /** - * Generate filter strings - * - * @param {String[]|Object[]} filters filter specifications. When using objects, - * each must have the following properties: - * @param {String} filters.filter filter name - * @param {String|Array} [filters.inputs] (array of) input stream specifier(s) for the filter, - * defaults to ffmpeg automatically choosing the first unused matching streams - * @param {String|Array} [filters.outputs] (array of) output stream specifier(s) for the filter, - * defaults to ffmpeg automatically assigning the output to the output file - * @param {Object|String|Array} [filters.options] filter options, can be omitted to not set any options - * @return String[] - * @private - */ - makeFilterStrings: function(filters) { - return filters.map(function(filterSpec) { - if (typeof filterSpec === 'string') { - return filterSpec; - } - - var filterString = ''; - - // Filter string format is: - // [input1][input2]...filter[output1][output2]... - // The 'filter' part can optionaly have arguments: - // filter=arg1:arg2:arg3 - // filter=arg1=v1:arg2=v2:arg3=v3 - - // Add inputs - if (Array.isArray(filterSpec.inputs)) { - filterString += filterSpec.inputs.map(function(streamSpec) { - return streamSpec.replace(streamRegexp, '[$1]'); - }).join(''); - } else if (typeof filterSpec.inputs === 'string') { - filterString += filterSpec.inputs.replace(streamRegexp, '[$1]'); - } - - // Add filter - filterString += filterSpec.filter; - - // Add options - if (filterSpec.options) { - if (typeof filterSpec.options === 'string' || typeof filterSpec.options === 'number') { - // Option string - filterString += '=' + filterSpec.options; - } else if (Array.isArray(filterSpec.options)) { - // Option array (unnamed options) - filterString += '=' + filterSpec.options.map(function(option) { - if (typeof option === 'string' && option.match(filterEscapeRegexp)) { - return '\'' + option + '\''; - } else { - return option; - } - }).join(':'); - } else if (Object.keys(filterSpec.options).length) { - // Option object (named options) - filterString += '=' + Object.keys(filterSpec.options).map(function(option) { - var value = filterSpec.options[option]; - - if (typeof value === 'string' && value.match(filterEscapeRegexp)) { - value = '\'' + value + '\''; - } - - return option + '=' + value; - }).join(':'); - } - } - - // Add outputs - if (Array.isArray(filterSpec.outputs)) { - filterString += filterSpec.outputs.map(function(streamSpec) { - return streamSpec.replace(streamRegexp, '[$1]'); - }).join(''); - } else if (typeof filterSpec.outputs === 'string') { - filterString += filterSpec.outputs.replace(streamRegexp, '[$1]'); - } - - return filterString; - }); - }, - - - /** - * Search for an executable - * - * Uses 'which' or 'where' depending on platform - * - * @param {String} name executable name - * @param {Function} callback callback with signature (err, path) - * @private - */ - which: function(name, callback) { - if (name in whichCache) { - return callback(null, whichCache[name]); - } - - which(name, function(err, result){ - if (err) { - // Treat errors as not found - return callback(null, whichCache[name] = ''); - } - callback(null, whichCache[name] = result); - }); - }, - - - /** - * Convert a [[hh:]mm:]ss[.xxx] timemark into seconds - * - * @param {String} timemark timemark string - * @return Number - * @private - */ - timemarkToSeconds: function(timemark) { - if (typeof timemark === 'number') { - return timemark; - } - - if (timemark.indexOf(':') === -1 && timemark.indexOf('.') >= 0) { - return Number(timemark); - } - - var parts = timemark.split(':'); - - // add seconds - var secs = Number(parts.pop()); - - if (parts.length) { - // add minutes - secs += Number(parts.pop()) * 60; - } - - if (parts.length) { - // add hours - secs += Number(parts.pop()) * 3600; - } - - return secs; - }, - - - /** - * Extract codec data from ffmpeg stderr and emit 'codecData' event if appropriate - * Call it with an initially empty codec object once with each line of stderr output until it returns true - * - * @param {FfmpegCommand} command event emitter - * @param {String} stderrLine ffmpeg stderr output line - * @param {Object} codecObject object used to accumulate codec data between calls - * @return {Boolean} true if codec data is complete (and event was emitted), false otherwise - * @private - */ - extractCodecData: function(command, stderrLine, codecsObject) { - var inputPattern = /Input #[0-9]+, ([^ ]+),/; - var durPattern = /Duration\: ([^,]+)/; - var audioPattern = /Audio\: (.*)/; - var videoPattern = /Video\: (.*)/; - - if (!('inputStack' in codecsObject)) { - codecsObject.inputStack = []; - codecsObject.inputIndex = -1; - codecsObject.inInput = false; - } - - var inputStack = codecsObject.inputStack; - var inputIndex = codecsObject.inputIndex; - var inInput = codecsObject.inInput; - - var format, dur, audio, video; - - if (format = stderrLine.match(inputPattern)) { - inInput = codecsObject.inInput = true; - inputIndex = codecsObject.inputIndex = codecsObject.inputIndex + 1; - - inputStack[inputIndex] = { format: format[1], audio: '', video: '', duration: '' }; - } else if (inInput && (dur = stderrLine.match(durPattern))) { - inputStack[inputIndex].duration = dur[1]; - } else if (inInput && (audio = stderrLine.match(audioPattern))) { - audio = audio[1].split(', '); - inputStack[inputIndex].audio = audio[0]; - inputStack[inputIndex].audio_details = audio; - } else if (inInput && (video = stderrLine.match(videoPattern))) { - video = video[1].split(', '); - inputStack[inputIndex].video = video[0]; - inputStack[inputIndex].video_details = video; - } else if (/Output #\d+/.test(stderrLine)) { - inInput = codecsObject.inInput = false; - } else if (/Stream mapping:|Press (\[q\]|ctrl-c) to stop/.test(stderrLine)) { - command.emit.apply(command, ['codecData'].concat(inputStack)); - return true; - } - - return false; - }, - - - /** - * Extract progress data from ffmpeg stderr and emit 'progress' event if appropriate - * - * @param {FfmpegCommand} command event emitter - * @param {String} stderrLine ffmpeg stderr data - * @private - */ - extractProgress: function(command, stderrLine) { - var progress = parseProgressLine(stderrLine); - - if (progress) { - // build progress report object - var ret = { - frames: parseInt(progress.frame, 10), - currentFps: parseInt(progress.fps, 10), - currentKbps: progress.bitrate ? parseFloat(progress.bitrate.replace('kbits/s', '')) : 0, - targetSize: parseInt(progress.size || progress.Lsize, 10), - timemark: progress.time - }; - - // calculate percent progress using duration - if (command._ffprobeData && command._ffprobeData.format && command._ffprobeData.format.duration) { - var duration = Number(command._ffprobeData.format.duration); - if (!isNaN(duration)) - ret.percent = (utils.timemarkToSeconds(ret.timemark) / duration) * 100; - } - command.emit('progress', ret); - } - }, - - - /** - * Extract error message(s) from ffmpeg stderr - * - * @param {String} stderr ffmpeg stderr data - * @return {String} - * @private - */ - extractError: function(stderr) { - // Only return the last stderr lines that don't start with a space or a square bracket - return stderr.split(nlRegexp).reduce(function(messages, message) { - if (message.charAt(0) === ' ' || message.charAt(0) === '[') { - return []; - } else { - messages.push(message); - return messages; - } - }, []).join('\n'); - }, - - - /** - * Creates a line ring buffer object with the following methods: - * - append(str) : appends a string or buffer - * - get() : returns the whole string - * - close() : prevents further append() calls and does a last call to callbacks - * - callback(cb) : calls cb for each line (incl. those already in the ring) - * - * @param {Number} maxLines maximum number of lines to store (<= 0 for unlimited) - */ - linesRing: function(maxLines) { - var cbs = []; - var lines = []; - var current = null; - var closed = false - var max = maxLines - 1; - - function emit(line) { - cbs.forEach(function(cb) { cb(line); }); - } - - return { - callback: function(cb) { - lines.forEach(function(l) { cb(l); }); - cbs.push(cb); - }, - - append: function(str) { - if (closed) return; - if (str instanceof Buffer) str = '' + str; - if (!str || str.length === 0) return; - - var newLines = str.split(nlRegexp); - - if (newLines.length === 1) { - if (current !== null) { - current = current + newLines.shift(); - } else { - current = newLines.shift(); - } - } else { - if (current !== null) { - current = current + newLines.shift(); - emit(current); - lines.push(current); - } - - current = newLines.pop(); - - newLines.forEach(function(l) { - emit(l); - lines.push(l); - }); - - if (max > -1 && lines.length > max) { - lines.splice(0, lines.length - max); - } - } - }, - - get: function() { - if (current !== null) { - return lines.concat([current]).join('\n'); - } else { - return lines.join('\n'); - } - }, - - close: function() { - if (closed) return; - - if (current !== null) { - emit(current); - lines.push(current); - - if (max > -1 && lines.length > max) { - lines.shift(); - } - - current = null; - } - - closed = true; - } - }; - } -}; diff --git a/package.json b/package.json index 9b191028..c95149d4 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,16 @@ { "name": "fluent-ffmpeg", - "version": "2.1.2", + "version": "3.0.0-alpha", "description": "A fluent API to FFMPEG (http://www.ffmpeg.org)", "keywords": [ "ffmpeg" ], - "author": "Stefan Schaermeli ", + "author": "Nicolas Joyard ", "contributors": [ + { + "name": "Stefan Schaermeli", + "email": "schaermu@gmail.com" + }, { "name": "Felix Fichte", "email": "spruce@space-ships.de" @@ -14,26 +18,51 @@ ], "license": "MIT", "bugs": { - "mail": "schaermu@gmail.com", "url": "http://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues" }, "repository": "git://github.com/fluent-ffmpeg/node-fluent-ffmpeg.git", "devDependencies": { - "jsdoc": "^4.0.0", - "mocha": "^10.0.0", - "nyc": "^15.1.0", - "should": "^13.0.0" - }, - "dependencies": { - "async": "^0.2.9", - "which": "^1.1.1" + "@ava/typescript": "^4.1.0", + "@tsconfig/node18": "^18.2.2", + "@types/node": "^20.9.0", + "@types/sinon": "^17.0.1", + "ava": "^5.3.1", + "c8": "^8.0.1", + "prettier": "^3.1.0", + "sinon": "^17.0.1", + "typescript": "^5.2.2" }, + "dependencies": {}, "engines": { "node": ">=18" }, - "main": "index", + "main": "build/src/main.js", + "types": "types/main.d.ts", "scripts": { - "test": "NODE_ENV=test nyc mocha --require should --reporter spec", - "coverage": "nyc report --reporter=lcov" + "build": "tsc", + "test": "c8 ava", + "lint": "prettier --check ." + }, + "ava": { + "files": [ + "tests/**/*" + ], + "typescript": { + "rewritePaths": { + "src/": "build/src/", + "tests/": "build/tests/" + }, + "compile": false + } + }, + "c8": { + "all": true, + "src": [ + "src" + ], + "reporter": [ + "text", + "lcov" + ] } -} \ No newline at end of file +} diff --git a/src/capabilities.ts b/src/capabilities.ts new file mode 100644 index 00000000..89ee30f3 --- /dev/null +++ b/src/capabilities.ts @@ -0,0 +1,133 @@ +import { FfmpegProcess } from './process' +import { + capCodecDecodersRegexp, + capCodecEncodersRegexp, + capCodecRegexp, + capFormatRegexp, + nlRegexp +} from './utils/regexp' + +interface FfmpegFormat { + description: string + canMux: boolean + canDemux: boolean +} + +interface FfmpegFormats { + [key: string]: FfmpegFormat +} + +interface FfmpegCodec { + description: string + type: 'audio' | 'video' | 'subtitle' | 'data' | 'attachment' + canEncode: boolean + canDecode: boolean + encoders?: string[] + decoders?: string[] + intraFrame: boolean + lossy: boolean + lossless: boolean +} + +interface FfmpegCodecs { + [key: string]: FfmpegCodec +} + +const codecTypes: { [key: string]: FfmpegCodec['type'] } = { + A: 'audio', + V: 'video', + S: 'subtitle', + D: 'data', + T: 'attachment' +} + +export class FfmpegCapabilities { + #codecs: FfmpegCodecs | null = null + #formats: FfmpegFormats | null = null + + async #getLines(arg: string): Promise { + let command = new FfmpegProcess({ args: [arg], captureStdout: true }) + let { stdout } = await command.run() + + return stdout.split(nlRegexp) || [] + } + + async codecs() { + if (!this.#codecs) { + let lines = await this.#getLines('-codecs') + this.#codecs = {} + + for (let line of lines) { + let match = line.match(capCodecRegexp) + if (match) { + let [ + , + decode, + encode, + type, + intra, + lossy, + lossless, + name, + description + ] = match + + let codec: FfmpegCodec = { + description, + type: codecTypes[type], + canEncode: encode === 'E', + canDecode: decode === 'D', + intraFrame: intra === 'I', + lossy: lossy === 'L', + lossless: lossless === 'S' + } + + if (decode === 'D') { + let decoders = description.match(capCodecDecodersRegexp) + if (decoders) { + codec.decoders = decoders[1].trim().split(' ') + codec.description = codec.description + .replace(capCodecDecodersRegexp, '') + .trim() + } + } + + if (encode === 'E') { + let encoders = description.match(capCodecEncodersRegexp) + if (encoders) { + codec.encoders = encoders[1].trim().split(' ') + codec.description = codec.description + .replace(capCodecEncodersRegexp, '') + .trim() + } + } + + this.#codecs[name] = codec + } + } + } + + return this.#codecs + } + + async formats() { + if (!this.#formats) { + let lines = await this.#getLines('-formats') + this.#formats = {} + + for (let line of lines) { + let match = line.match(capFormatRegexp) + if (match) { + let [, demux, mux, name, description] = match + this.#formats[name] = { + description, + canMux: mux === 'E', + canDemux: demux === 'D' + } + } + } + } + + return this.#formats + } +} diff --git a/src/command.ts b/src/command.ts new file mode 100644 index 00000000..c251d2f2 --- /dev/null +++ b/src/command.ts @@ -0,0 +1,73 @@ +import { FfmpegInput, InputOptions } from './input' +import { FfmpegOutput, OutputOptions } from './output' +import { FfmpegProcess, RunResult, RunOptions } from './process' + +type CommandOptions = { + input?: InputOptions + inputs?: InputOptions[] + output?: OutputOptions + outputs?: OutputOptions[] +} + +export class FfmpegCommand implements CommandOptions { + inputs: FfmpegInput[] + outputs: FfmpegOutput[] + + constructor(options: CommandOptions) { + if (options.input) { + options.inputs = [options.input] + } + + if (options.output) { + options.outputs = [options.output] + } + + this.inputs = (options.inputs || []).map( + (inputOptions) => new FfmpegInput(inputOptions) + ) + this.outputs = (options.outputs || []).map( + (outputOptions) => new FfmpegOutput(outputOptions) + ) + + this.validateIO() + } + + validateIO(): void { + if (this.inputs.filter((i) => i.isStream).length > 1) { + throw new Error(`At most one stream input is supported`) + } + + if (this.outputs.filter((o) => o.isStream).length > 1) { + throw new Error(`At most one stream output is supported`) + } + } + + getFfmpegArguments(): string[] { + let args: string[] = [] + + for (let input of this.inputs) { + args.push(...input.getFfmpegArguments()) + } + + // TODO complex filters + + if (this.outputs.some((o) => o.isLocalFile)) { + // Force overwrite outputs + args.push('-y') + } + + for (let output of this.outputs) { + args.push(...output.getFfmpegArguments()) + } + + return args + } + + run(options: RunOptions): Promise { + let proc = new FfmpegProcess({ + args: this.getFfmpegArguments(), + ...options + }) + return proc.run() + } +} diff --git a/src/input.ts b/src/input.ts new file mode 100644 index 00000000..fdd6df29 --- /dev/null +++ b/src/input.ts @@ -0,0 +1,82 @@ +import { Readable } from 'stream' + +import { protocolRegexp } from './utils/regexp' + +type InputSource = string | Readable + +export interface InputOptions { + source: InputSource + format?: string + fps?: 'native' | number + seek?: string | number + loop?: boolean +} + +export class FfmpegInput implements InputOptions { + source: InputSource + format?: string + fps?: 'native' | number + seek?: string | number + loop?: boolean + + constructor(options: InputOptions | InputSource) { + if (typeof options === 'string' || options instanceof Readable) { + options = { source: options } + } + + this.source = options.source + this.format = options.format + this.fps = options.fps + this.seek = options.seek + this.loop = options.loop + } + + get isStream(): boolean { + return this.source instanceof Readable + } + + get isLocalFile(): boolean { + if (this.source instanceof Readable) { + return false + } else { + let protocol = this.source.match(protocolRegexp) + return !protocol || protocol[1] === 'file' + } + } + + #getSourceString(): string { + if (typeof this.source === 'string') { + return this.source + } else { + return 'pipe:0' + } + } + + #getOptions(): string[] { + let options: string[] = [] + + if (this.format) { + options.push('-f', this.format) + } + + if (this.fps === 'native') { + options.push('-re') + } else if (this.fps) { + options.push('-r', this.fps.toString()) + } + + if (this.seek) { + options.push('-ss', this.seek.toString()) + } + + if (this.loop) { + options.push('-loop', '1') + } + + return options + } + + getFfmpegArguments(): string[] { + return [...this.#getOptions(), '-i', this.#getSourceString()] + } +} diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 00000000..b914518a --- /dev/null +++ b/src/main.ts @@ -0,0 +1,19 @@ +import { FfmpegCapabilities } from './capabilities' +import { FfmpegCommand } from './command' +import { FfmpegInput, InputOptions } from './input' +import { FfmpegOutput, OutputOptions } from './output' +import { FfmpegProcess, ProcessOptions, RunResult } from './process' +import { ProgressInfo } from './utils/parsing' + +export { + FfmpegCapabilities, + FfmpegCommand, + FfmpegInput, + FfmpegOutput, + FfmpegProcess, + InputOptions, + OutputOptions, + ProcessOptions, + ProgressInfo, + RunResult +} diff --git a/src/output.ts b/src/output.ts new file mode 100644 index 00000000..f31bd54c --- /dev/null +++ b/src/output.ts @@ -0,0 +1,223 @@ +import { Writable } from 'stream' + +import { protocolRegexp, streamRegexp } from './utils/regexp' +import { OutputFilter, formatBitrate, formatFilters } from './utils/formatting' + +interface OutputAudioOptions { + codec?: string + bitrate?: string | number + channels?: number + frequency?: number + quality?: number + filter?: OutputFilter + filters?: OutputFilter[] +} + +interface OutputVideoOptions { + codec?: string + bitrate?: string | number + constantBitrate?: boolean + fps?: number + frames?: number + filter?: OutputFilter + filters?: OutputFilter[] +} + +type OutputSpec = string | Writable + +export interface OutputOptions { + output: OutputSpec + seek?: string | number + duration?: string | number + format?: string + map?: string + + audio?: false | OutputAudioOptions + video?: false | OutputVideoOptions +} + +export class FfmpegOutput implements OutputOptions { + output: OutputSpec + seek?: string | number + duration?: string | number + format?: string + map?: string + + audio?: false | OutputAudioOptions + video?: false | OutputVideoOptions + + constructor(options: OutputSpec | OutputOptions) { + if (typeof options === 'string' || options instanceof Writable) { + options = { output: options } + } + + this.output = options.output + this.seek = options.seek + this.duration = options.duration + this.format = options.format + this.map = options.map + + this.audio = options.audio + this.video = options.video + + this.validateOptions() + } + + validateOptions() { + if (this.audio && this.audio.filter) { + if (this.audio.filters) { + throw new Error(`Cannot specify both audio 'filter' and 'filters'`) + } else { + this.audio.filters = [this.audio.filter] + delete this.audio.filter + } + } + + if (this.video && this.video.filter) { + if (this.video.filters) { + throw new Error(`Cannot specify both video 'filter' and 'filters'`) + } else { + this.video.filters = [this.video.filter] + delete this.video.filter + } + } + } + + get isStream(): boolean { + return this.output instanceof Writable + } + + get isLocalFile(): boolean { + if (this.output instanceof Writable) { + return false + } else { + let protocol = this.output.match(protocolRegexp) + return !protocol || protocol[1] === 'file' + } + } + + #getAudioOptions(): string[] { + let options: string[] = [] + + if (this.audio === false) { + options.push('-an') + } else if (this.audio) { + if (this.audio.codec) { + options.push('-acodec', this.audio.codec) + } + + if (this.audio.bitrate) { + options.push('-b:a', formatBitrate(this.audio.bitrate)) + } + + if (this.audio.channels) { + options.push('-ac', this.audio.channels.toString()) + } + + if (this.audio.frequency) { + options.push('-ar', this.audio.frequency.toString()) + } + + if (this.audio.quality) { + options.push('-aq', this.audio.quality.toString()) + } + + if (this.audio.filters) { + // todo make formatFilters handle the join + options.push('-filter:a', formatFilters(this.audio.filters).join(',')) + } + } + + return options + } + + #getVideoOptions(): string[] { + let options: string[] = [] + + if (this.video === false) { + options.push('-vn') + } else if (this.video) { + if (this.video.codec) { + options.push('-vcodec', this.video.codec) + } + + if (this.video.bitrate) { + let bitrate = formatBitrate(this.video.bitrate) + options.push('-b:v', bitrate) + + if (this.video.constantBitrate) { + options.push( + '-minrate', + bitrate, + '-maxrate', + bitrate, + '-bufsize', + bitrate + ) + } + } + + if (this.video.fps) { + options.push('-r', this.video.fps.toString()) + } + + if (this.video.frames) { + options.push('-vframes', this.video.frames.toString()) + } + + if (this.video.filters) { + options.push('-filter:v', formatFilters(this.video.filters).join(',')) + } + + // todo size filters + } + + return options + } + + #getOptions(): string[] { + let options: string[] = [] + + if (this.seek) { + options.push('-ss', this.seek.toString()) + } + + if (this.duration) { + options.push('-t', this.duration.toString()) + } + + if (this.format) { + options.push('-f', this.format) + } + + if (this.map) { + options.push('-map', this.map.replace(streamRegexp, '[$1]')) + } + + return options + } + + #getOutputString(): string { + if (typeof this.output === 'string') { + return this.output + } else { + return 'pipe:1' + } + } + + getFfmpegArguments(): string[] { + /* Order + - audio + filters + - video + filters + size filters + - options + - output + */ + + return [ + ...this.#getAudioOptions(), + ...this.#getVideoOptions(), + ...this.#getOptions(), + this.#getOutputString() + ] + } +} diff --git a/src/process.ts b/src/process.ts new file mode 100644 index 00000000..2d1f6033 --- /dev/null +++ b/src/process.ts @@ -0,0 +1,132 @@ +import { spawn } from 'child_process' + +import { isWindows } from './utils/platform' +import { + extractErrorMessage, + extractProgress, + ProgressInfo, + CodecData, + CodecDataExtractor +} from './utils/parsing' +import LineBuffer from './utils/line-buffer' + +export interface RunResult { + stderr: string + stdout: string +} + +export interface RunOptions { + nice?: number + cwd?: string + onProgress?: (progress: ProgressInfo) => void + onCodecData?: (data: CodecData) => void + onStderr?: (line: string) => void +} + +export interface ProcessOptions extends RunOptions { + args: string[] + captureStdout?: boolean +} + +export class FfmpegProcess implements ProcessOptions { + args: string[] + nice?: number + cwd?: string + captureStdout?: boolean + onProgress?: (progress: ProgressInfo) => void + onCodecData?: (data: CodecData) => void + onStderr?: (line: string) => void + + constructor(options: ProcessOptions) { + this.args = options.args + this.nice = options.nice + this.cwd = options.cwd + this.captureStdout = options.captureStdout + this.onProgress = options.onProgress + this.onCodecData = options.onCodecData + this.onStderr = options.onStderr + } + + run(callback?: (err: any, result?: any) => any): Promise { + let cmd = process.env.FFMPEG_PATH || 'ffmpeg' + let args: string[] = [...this.args] + + let { onProgress, onCodecData, onStderr } = this + + if (this.nice && this.nice !== 0 && !isWindows) { + args = ['-n', this.nice.toString(), cmd, ...args] + cmd = 'nice' + } + + let promise: Promise = new Promise((resolve, reject) => { + let child = spawn(cmd, args, { + cwd: this.cwd, + windowsHide: true + }) + + let stderr = new LineBuffer() + let stdout = new LineBuffer() + + if (onStderr) { + stderr.on('line', onStderr) + } + + if (onProgress) { + stderr.on('line', (line: string) => { + let progress = extractProgress(line) + if (progress) { + onProgress?.(progress) + } + }) + } + + if (onCodecData) { + let extractor = new CodecDataExtractor(onCodecData) + stderr.on('line', (line: string) => { + if (!extractor.done) { + extractor.processLine(line) + } + }) + } + + child.on('error', (err) => reject(err)) + + child.on('close', (code, signal) => { + stderr.close() + stdout.close() + + if (signal) { + reject(new Error(`ffmpeg was killed with signal ${signal}`)) + } else if (code) { + reject( + new Error( + `ffmpeg exited with code ${code}:\n ${extractErrorMessage( + stderr.lines + )}` + ) + ) + } else { + resolve({ + stdout: stdout.toString(), + stderr: stderr.toString() + }) + } + }) + + if (this.captureStdout) { + child.stdout.on('data', (data) => stdout.append(data.toString())) + } + + child.stderr.on('data', (data) => stderr.append(data.toString())) + }) + + if (callback) { + promise.then( + (value) => callback(null, value), + (reason) => callback(reason) + ) + } + + return promise + } +} diff --git a/src/utils/formatting.ts b/src/utils/formatting.ts new file mode 100644 index 00000000..e836668e --- /dev/null +++ b/src/utils/formatting.ts @@ -0,0 +1,99 @@ +import { filterNeedsEscapeRegexp, streamRegexp } from './regexp' + +export function formatBitrate(bitrate: number | string): string { + if (typeof bitrate === 'number') { + if (bitrate < 1024) { + // Assume the user means kbps + return `${bitrate}k` + } else { + return `${bitrate}` + } + } else { + return bitrate + } +} + +interface OutputFilterSpec { + filter: string + options?: string | string[] | { [key: string]: string } + input?: string + inputs?: string[] + output?: string + outputs?: string[] +} + +export type OutputFilter = string | OutputFilterSpec + +// TODO format filtergraph with multi-level escaping +// see http://ffmpeg.org/ffmpeg-filters.html#Notes-on-filtergraph-escaping + +export function formatFilters(specs: OutputFilter[]): string[] { + /* Filter syntax: + + filter := inputs? filterspec outputs? + + inputs := input inputs? + input := '[' input-name ']' + + outputs := output outputs? + output := '[' output-name ']' + + filterspec := filter-name ('=' filterargs)? + filterargs := filterarg (':' filterargs)? + filterarg := arg-value | (arg-name '=' arg-value) + */ + + return specs.map((spec) => { + if (typeof spec === 'string') { + return spec + } + + if (spec.input) { + spec.inputs = [spec.input] + } + + let inputs = (spec.inputs || []) + .map((stream) => stream.replace(streamRegexp, '[$1]')) + .join('') + + let options = '' + + if (spec.options) { + if (typeof spec.options === 'string') { + options = `=${spec.options}` + } else if (Array.isArray(spec.options)) { + let optionStrings = spec.options.map((option) => { + if (option.match(filterNeedsEscapeRegexp)) { + return `'${option}'` + } else { + return option + } + }) + + options = `=${optionStrings.join(':')}` + } else { + let optionStrings = Object.entries(spec.options).map(([key, value]) => { + if (value.match(filterNeedsEscapeRegexp)) { + value = `'${value}'` + } + + return `${key}=${value}` + }) + + options = `=${optionStrings.join(':')}` + } + } + + let filter = `${spec.filter}${options}` + + if (spec.output) { + spec.outputs = [spec.output] + } + + let outputs = (spec.outputs || []) + .map((stream) => stream.replace(streamRegexp, '[$1]')) + .join('') + + return `${inputs}${filter}${outputs}` + }) +} diff --git a/src/utils/line-buffer.ts b/src/utils/line-buffer.ts new file mode 100644 index 00000000..c034d917 --- /dev/null +++ b/src/utils/line-buffer.ts @@ -0,0 +1,61 @@ +import EventEmitter from 'events' + +import { nlRegexp } from './regexp' + +export default class LineBuffer extends EventEmitter { + lines: string[] + closed: boolean + partialLine: string + + constructor() { + super() + + this.lines = [] + this.closed = false + this.partialLine = '' + } + + append(data: string): void { + if (this.closed) { + throw new Error('LineBuffer is closed') + } + + if (data.length) { + let appendLines = data.split(nlRegexp) + + if (appendLines.length === 1) { + let [appendLine] = appendLines + this.partialLine = `${this.partialLine}${appendLine}` + } else { + if (this.partialLine) { + let appendLine = `${this.partialLine}${appendLines.shift()}` + this.emit('line', appendLine) + this.lines.push(appendLine) + } + + this.partialLine = appendLines.pop() as string + for (let appendLine of appendLines) { + this.emit('line', appendLine) + this.lines.push(appendLine) + } + } + } + } + + close(): void { + if (this.closed) { + throw new Error('LineBuffer is closed') + } + + if (this.partialLine) { + this.emit('line', this.partialLine) + this.lines.push(this.partialLine) + } + + this.closed = true + } + + toString(): string { + return this.lines.join('\n') + } +} diff --git a/src/utils/parsing.ts b/src/utils/parsing.ts new file mode 100644 index 00000000..308d226e --- /dev/null +++ b/src/utils/parsing.ts @@ -0,0 +1,132 @@ +import { + codecAudioRegexp, + codecDurRegexp, + codecEndRegexp, + codecInputRegexp, + codecOutputRegexp, + codecVideoRegexp +} from './regexp' + +export function extractErrorMessage(stderrLines: string[]): string { + // Return the last block of lines that don't start with a space or square bracket + return stderrLines + .reduce((messages: string[], message: string): string[] => { + if (message.charAt(0) === ' ' || message.charAt(0) === '[') { + return [] + } else { + messages.push(message) + return messages + } + }, []) + .join('\n') +} + +export interface ProgressInfo { + frame?: number + fps?: number + bitrate?: number + size?: number + time?: string + speed?: number +} + +export function extractProgress(stderrLine: string): ProgressInfo | undefined { + let parts = stderrLine.replace(/=\s+/g, '=').trim().split(' ') + let progress: ProgressInfo = {} + + for (let part of parts) { + let [key, value] = part.split('=', 2) + + if (value === undefined) { + // Not a progress line + return + } + + if (key === 'frame' || key === 'fps') { + progress[key] = Number(value) + } else if (key === 'bitrate') { + progress.bitrate = Number(value.replace('kbits/s', '')) + } else if (key === 'size' || key === 'Lsize') { + progress.size = Number(value.replace('kB', '')) + } else if (key === 'time') { + progress.time = value + } else if (key === 'speed') { + progress.speed = Number(value.replace('x', '')) + } + } + + return progress +} + +interface InputCodecData { + format?: string + duration?: string + audio?: string + audioDetails?: string + video?: string + videoDetails?: string +} + +export type CodecData = InputCodecData[] + +export class CodecDataExtractor { + inputs: InputCodecData[] + index: number + inInput: boolean + done: boolean + callback: (data: CodecData) => any + + constructor(callback: (data: CodecData) => any) { + this.inputs = [] + this.index = -1 + this.inInput = false + this.done = false + this.callback = callback + } + + processLine(line: string) { + let matchFormat = line.match(codecInputRegexp) + if (matchFormat) { + this.inInput = true + this.index++ + this.inputs[this.index] = { + format: matchFormat[1] + } + + return + } + + if (this.inInput) { + let durationMatch = line.match(codecDurRegexp) + if (durationMatch) { + this.inputs[this.index].duration = durationMatch[1] + return + } + + let audioMatch = line.match(codecAudioRegexp) + if (audioMatch) { + this.inputs[this.index].audio = audioMatch[1].split(', ')[0] + this.inputs[this.index].audioDetails = audioMatch[1] + return + } + + let videoMatch = line.match(codecVideoRegexp) + if (videoMatch) { + this.inputs[this.index].video = videoMatch[1].split(', ')[0] + this.inputs[this.index].videoDetails = videoMatch[1] + return + } + } + + if (codecOutputRegexp.test(line)) { + this.inInput = false + } + + if (codecEndRegexp.test(line)) { + this.done = true + let { callback } = this + + callback(this.inputs) + } + } +} diff --git a/src/utils/platform.ts b/src/utils/platform.ts new file mode 100644 index 00000000..d05e67b7 --- /dev/null +++ b/src/utils/platform.ts @@ -0,0 +1,3 @@ +export const isWindows: boolean = !!require('os') + .platform() + .match(/win(32|64)/) diff --git a/src/utils/regexp.ts b/src/utils/regexp.ts new file mode 100644 index 00000000..1a46f7b5 --- /dev/null +++ b/src/utils/regexp.ts @@ -0,0 +1,20 @@ +export const streamRegexp = /^\[?(.*?)\]?$/ + +export const protocolRegexp = /^([a-z]{2,}):/i + +export const nlRegexp = /\r\n|\r|\n/g + +export const codecInputRegexp = /Input #[0-9]+, ([^ ]+),/ +export const codecDurRegexp = /Duration\: ([^,]+)/ +export const codecAudioRegexp = /Audio\: (.*)/ +export const codecVideoRegexp = /Video\: (.*)/ +export const codecOutputRegexp = /Output #\d+/ +export const codecEndRegexp = /Stream mapping:|Press (\[q\]|ctrl-c) to stop/ + +export const filterNeedsEscapeRegexp = /[,]/ + +export const capFormatRegexp = /^\s*([D ])([E ]) ([^ ]+) +(.*)$/ +export const capCodecRegexp = + /^\s*([D\.])([E\.])([VASDT])([I\.])([L\.])([S\.]) ([^ ]+) +(.*)$/ +export const capCodecEncodersRegexp = /\(encoders:([^\)]+)\)/ +export const capCodecDecodersRegexp = /\(decoders:([^\)]+)\)/ diff --git a/test/aliases.test.js b/test/aliases.test.js deleted file mode 100644 index 3bfe7f90..00000000 --- a/test/aliases.test.js +++ /dev/null @@ -1,86 +0,0 @@ -/*jshint node:true*/ -/*global describe,it*/ -'use strict'; - -var Ffmpeg = require('../index'); - -var aliases = { - audio: { - withNoAudio: ['noAudio'], - withAudioCodec: ['audioCodec'], - withAudioBitrate: ['audioBitrate'], - withAudioChannels: ['audioChannels'], - withAudioFrequency: ['audioFrequency'], - withAudioQuality: ['audioQuality'], - withAudioFilter: ['withAudioFilters','audioFilter','audioFilters'] - }, - - custom: { - addInputOption: ['addInputOptions','withInputOption','withInputOptions','inputOption','inputOptions'], - addOutputOption: ['addOutputOptions','addOption','addOptions','withOutputOption','withOutputOptions','withOption','withOptions','outputOption','outputOptions'], - complexFilter: ['filterGraph'] - }, - - inputs: { - addInput: ['input','mergeAdd'], - fromFormat: ['withInputFormat','inputFormat'], - withInputFps: ['withInputFPS','withFpsInput','withFPSInput','inputFPS','inputFps','fpsInput','FPSInput'], - native: ['withNativeFramerate','nativeFramerate'], - setStartTime: ['seekInput'] - }, - - misc: { - usingPreset: ['preset'] - }, - - output: { - addOutput: ['output'], - withDuration: ['duration','setDuration'], - toFormat: ['withOutputFormat','outputFormat','format'], - seek: ['seekOutput'], - updateFlvMetadata: ['flvmeta'] - }, - - video: { - withNoVideo: ['noVideo'], - withVideoCodec: ['videoCodec'], - withVideoBitrate: ['videoBitrate'], - withVideoFilter: ['withVideoFilters','videoFilter','videoFilters'], - withOutputFps: ['withOutputFPS','withFpsOutput','withFPSOutput','withFps','withFPS','outputFPS','outputFps','fpsOutput','FPSOutput','fps','FPS'], - takeFrames: ['withFrames','frames'] - }, - - videosize: { - keepPixelAspect: ['keepDisplayAspect','keepDisplayAspectRatio','keepDAR'], - withSize: ['setSize', 'size'], - withAspect: ['withAspectRatio','setAspect','setAspectRatio','aspect','aspectRatio'], - applyAutopadding: ['applyAutoPadding','applyAutopad','applyAutoPad','withAutopadding','withAutoPadding','withAutopad','withAutoPad','autoPad','autopad'] - }, - - processing: { - saveToFile: ['save'], - writeToStream: ['stream', 'pipe'], - run: ['exec', 'execute'], - concat: ['concatenate', 'mergeToFile'], - screenshots: ['screenshot', 'thumbnails', 'thumbnail', 'takeScreenshots'] - } -}; - -describe('Method aliases', function() { - Object.keys(aliases).forEach(function(category) { - describe(category + ' methods', function() { - Object.keys(aliases[category]).forEach(function(method) { - describe('FfmpegCommand#' + method, function() { - aliases[category][method].forEach(function(alias) { - it('should have a \'' + alias + '\' alias', function() { - var ff = new Ffmpeg(); - - (typeof ff[method]).should.equal('function'); - ff[method].should.equal(ff[alias]); - }); - }); - }); - }); - }); - }); -}); \ No newline at end of file diff --git a/test/args.test.js b/test/args.test.js deleted file mode 100644 index a57f0d73..00000000 --- a/test/args.test.js +++ /dev/null @@ -1,1122 +0,0 @@ -/*jshint node:true*/ -/*global describe,it,before*/ -'use strict'; - -var Ffmpeg = require('../index'), - utils = require('../lib/utils'), - path = require('path'), - fs = require('fs'), - assert = require('assert'), - exec = require('child_process').exec, - testhelper = require('./helpers'); - -Ffmpeg.prototype._test_getArgs = function(callback) { - var args; - - try { - args = this._getArguments(); - } catch(e) { - return callback(null, e); - } - - callback(args); -}; - -Ffmpeg.prototype._test_getSizeFilters = function() { - return utils.makeFilterStrings(this._currentOutput.sizeFilters.get()) - .concat(this._currentOutput.videoFilters.get()); -}; - - -describe('Command', function() { - before(function(done) { - // check for ffmpeg installation - this.testfile = path.join(__dirname, 'assets', 'testvideo-43.avi'); - this.testfilewide = path.join(__dirname, 'assets', 'testvideo-169.avi'); - - var self = this; - exec(testhelper.getFfmpegCheck(), function(err) { - if (!err) { - // check if file exists - fs.exists(self.testfile, function(exists) { - if (exists) { - done(); - } else { - done(new Error('test video file does not exist, check path (' + self.testfile + ')')); - } - }); - } else { - done(new Error('cannot run test without ffmpeg installed, aborting test...')); - } - }); - }); - - describe('Constructor', function() { - it('should enable calling the constructor without new', function() { - (Ffmpeg()).should.instanceof(Ffmpeg); - }); - }); - - describe('usingPreset', function() { - it('should properly generate the command for the requested preset', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .usingPreset('podcast') - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.length.should.equal(42); - done(); - }); - }); - - it('should properly generate the command for the requested preset in custom folder', function(done) { - new Ffmpeg({ source: this.testfile, nolog: true, preset: path.join(__dirname, 'assets', 'presets') }) - .usingPreset('custompreset') - ._test_getArgs(function(args) { - args.length.should.equal(42); - - done(); - }); - }); - - it('should allow using functions as presets', function(done) { - var presetArg; - - function presetFunc(command) { - presetArg = command; - command.withVideoCodec('libx264'); - command.withAudioFrequency(22050); - } - - var cmd = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }); - - cmd - .usingPreset(presetFunc) - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - presetArg.should.equal(cmd); - args.join(' ').indexOf('-vcodec libx264').should.not.equal(-1); - args.join(' ').indexOf('-ar 22050').should.not.equal(-1); - - done(); - }); - }); - - it('should throw an exception when a preset is not found', function() { - var self = this; - - (function() { - new Ffmpeg({ source: self.testfile, logger: testhelper.logger }) - .usingPreset('NOTFOUND'); - }).should.throw(/NOTFOUND could not be loaded/); - }); - - it('should throw an exception when a preset has no load function', function() { - (function() { - new Ffmpeg({ presets: '../../lib' }).usingPreset('utils'); - }).should.throw(/has no load\(\) function/); - }); - }); - - describe('withNoVideo', function() { - it('should apply the skip video argument', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withNoVideo() - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-vn').should.above(-1); - done(); - }); - }); - it('should skip any video transformation options', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('320x?') - .withNoVideo() - .withAudioBitrate('256k') - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-vn').should.above(-1); - args.indexOf('-s').should.equal(-1); - args.indexOf('-b:a').should.above(-1); - done(); - }); - }); - }); - - describe('withNoAudio', function() { - it('should apply the skip audio argument', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withNoAudio() - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-an').should.above(-1); - done(); - }); - }); - it('should skip any audio transformation options', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withAudioChannels(2) - .withNoAudio() - .withSize('320x?') - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-an').should.above(-1); - args.indexOf('-ac').should.equal(-1); - args.indexOf('scale=w=320:h=trunc(ow/a/2)*2').should.above(-1); - done(); - }); - }); - }); - - describe('withVideoBitrate', function() { - it('should apply default bitrate argument by default', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withVideoBitrate('256k') - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-b:v').should.above(-1); - done(); - }); - }); - it('should apply additional bitrate arguments for constant bitrate', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withVideoBitrate('256k', true) - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-b:v').should.above(-1); - args.indexOf('-maxrate').should.above(-1); - args.indexOf('-minrate').should.above(-1); - args.indexOf('-bufsize').should.above(-1); - done(); - }); - }); - }); - - describe('withMultiFile', function() { - it('should allow image2 multi-file input format', function(done) { - new Ffmpeg({ source: 'image-%05d.png', logger: testhelper.logger }) - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-i').should.above(-1); - args.indexOf('image-%05d.png').should.above(-1); - done(); - }); - }); - }); - - describe('withFps', function() { - it('should apply the rate argument', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withFps(27.77) - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-r').should.above(-1); - args.indexOf(27.77).should.above(-1); - done(); - }); - }); - }); - - describe('withInputFPS', function() { - it('should apply the rate argument', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withInputFPS(27.77) - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-r').should.above(-1).and.below(args.indexOf('-i')); - args.indexOf(27.77).should.above(-1).and.below(args.indexOf('-i')); - done(); - }); - }); - }); - - describe('native', function() { - it('should apply the native framerate argument', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .native() - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-re').should.above(-1).and.below(args.indexOf('-i')); - done(); - }); - }); - }); - - describe('addingAdditionalInput', function() { - it('should allow for additional inputs', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .addInput('soundtrack.mp3') - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-i').should.above(-1); - args.indexOf('soundtrack.mp3').should.above(-1); - done(); - }); - }); - - it('should fail to add invalid inputs', function() { - (function() { - new Ffmpeg().addInput({}); - }).should.throw(/Invalid input/); - }); - - it('should refuse to add more than 1 input stream', function() { - var stream1 = fs.createReadStream(this.testfile); - var stream2 = fs.createReadStream(this.testfilewide); - var command = new Ffmpeg().addInput(stream1); - - (function() { - command.addInput(stream2); - }).should.throw(/Only one input stream is supported/); - }); - - it('should fail on input-related options when no input was added', function() { - (function() { - new Ffmpeg().inputFormat('avi'); - }).should.throw(/No input specified/); - - (function() { - new Ffmpeg().inputFps(24); - }).should.throw(/No input specified/); - - (function() { - new Ffmpeg().seekInput(1); - }).should.throw(/No input specified/); - - (function() { - new Ffmpeg().loop(); - }).should.throw(/No input specified/); - - (function() { - new Ffmpeg().inputOptions('-anoption'); - }).should.throw(/No input specified/); - }); - }); - - describe('withVideoCodec', function() { - it('should apply the video codec argument', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withVideoCodec('libx264') - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-vcodec').should.above(-1); - args.indexOf('libx264').should.above(-1); - done(); - }); - }); - }); - - describe('withVideoFilter', function() { - it('should apply the video filter argument', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withVideoFilter('scale=123:456') - .withVideoFilter('pad=1230:4560:100:100:yellow') - .withVideoFilter('multiple=1', 'filters=2') - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-filter:v').should.above(-1); - args.indexOf('scale=123:456,pad=1230:4560:100:100:yellow,multiple=1,filters=2').should.above(-1); - done(); - }); - }); - - it('should accept filter arrays', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withVideoFilter(['multiple=1', 'filters=2']) - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-filter:v').should.above(-1); - args.indexOf('multiple=1,filters=2').should.above(-1); - done(); - }); - }); - - it('should enable using filter objects', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withVideoFilter( - { - filter: 'option_string', - options: 'opt1=value1:opt2=value2' - }, - { - filter: 'unnamed_options', - options: ['opt1', 'opt2'] - }, - { - filter: 'named_options', - options: { - opt1: 'value1', - opt2: 'value2' - } - } - ) - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-filter:v').should.above(-1); - args.indexOf('option_string=opt1=value1:opt2=value2,unnamed_options=opt1:opt2,named_options=opt1=value1:opt2=value2').should.above(-1); - done(); - }); - }); - }); - - describe('withAudioBitrate', function() { - it('should apply the audio bitrate argument', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withAudioBitrate(256) - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-b:a').should.above(-1); - args.indexOf('256k').should.above(-1); - done(); - }); - }); - }); - - describe('loop', function() { - it('should add the -loop 1 argument', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .loop() - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - if(args.indexOf('-loop') != -1 || args.indexOf('-loop_output') != -1){ - done(); - } - else{ - done(new Error('args should contain loop or loop_output')); - } - }); - }); - it('should add the -loop 1 and a time argument (seconds)', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .loop(120) - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - if(args.indexOf('-loop') != -1 || args.indexOf('-loop_output') != -1){ - args.indexOf('-t').should.above(-1); - args.indexOf(120).should.above(-1); - done(); - } - else{ - done(new Error('args should contain loop or loop_output')); - } - - }); - }); - it('should add the -loop 1 and a time argument (timemark)', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .loop('00:06:46.81') - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - if(args.indexOf('-loop') != -1 || args.indexOf('-loop_output') != -1){ - args.indexOf('-t').should.above(-1); - args.indexOf('00:06:46.81').should.above(-1); - done(); - } - else{ - done(new Error('args should contain loop or loop_output')); - } - }); - }); - }); - - describe('takeFrames', function() { - it('should add the -vframes argument', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .takeFrames(250) - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-vframes').should.above(-1); - args.indexOf(250).should.above(-1); - done(); - }); - }); - }); - - describe('withAudioCodec', function() { - it('should apply the audio codec argument', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withAudioCodec('mp3') - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-acodec').should.above(-1); - args.indexOf('mp3').should.above(-1); - done(); - }); - }); - }); - - describe('withAudioFilter', function() { - it('should apply the audio filter argument', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withAudioFilter('silencedetect=n=-50dB:d=5') - .withAudioFilter('volume=0.5') - .withAudioFilter('multiple=1', 'filters=2') - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-filter:a').should.above(-1); - args.indexOf('silencedetect=n=-50dB:d=5,volume=0.5,multiple=1,filters=2').should.above(-1); - done(); - }); - }); - - it('should accept filter arrays', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withAudioFilter(['multiple=1', 'filters=2']) - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-filter:a').should.above(-1); - args.indexOf('multiple=1,filters=2').should.above(-1); - done(); - }); - }); - - it('should enable using filter objects', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withAudioFilter( - { - filter: 'option_string', - options: 'opt1=value1:opt2=value2' - }, - { - filter: 'unnamed_options', - options: ['opt1', 'opt2'] - }, - { - filter: 'named_options', - options: { - opt1: 'value1', - opt2: 'value2' - } - } - ) - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-filter:a').should.above(-1); - args.indexOf('option_string=opt1=value1:opt2=value2,unnamed_options=opt1:opt2,named_options=opt1=value1:opt2=value2').should.above(-1); - done(); - }); - }); - }); - - describe('withAudioChannels', function() { - it('should apply the audio channels argument', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withAudioChannels(1) - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-ac').should.above(-1); - args.indexOf(1).should.above(-1); - done(); - }); - }); - }); - - describe('withAudioFrequency', function() { - it('should apply the audio frequency argument', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withAudioFrequency(22500) - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-ar').should.above(-1); - args.indexOf(22500).should.above(-1); - done(); - }); - }); - }); - - describe('withAudioQuality', function() { - it('should apply the audio quality argument', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withAudioQuality(5) - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-aq').should.above(-1); - args.indexOf(5).should.above(-1); - done(); - }); - }); - }); - - describe('setStartTime', function() { - it('should apply the start time offset argument', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .setStartTime('00:00:10') - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-ss').should.above(-1).and.below(args.indexOf('-i')); - args.indexOf('00:00:10').should.above(args.indexOf('-ss')).and.below(args.indexOf('-i')); - done(); - }); - }); - }); - - describe('setDuration', function() { - it('should apply the record duration argument', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .setDuration(10) - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-t').should.above(-1); - args.indexOf(10).should.above(-1); - done(); - }); - }); - }); - - describe('addOption(s)', function() { - it('should apply a single option', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .addOption('-ab', '256k') - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-ab').should.above(-1); - args.indexOf('256k').should.above(-1); - done(); - }); - }); - it('should apply supplied extra options', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .addOptions(['-flags', '+loop', '-cmp', '+chroma', '-partitions','+parti4x4+partp8x8+partb8x8']) - .addOptions('-single option') - .addOptions('-multiple', '-options') - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-flags').should.above(-1); - args.indexOf('+loop').should.above(-1); - args.indexOf('-cmp').should.above(-1); - args.indexOf('+chroma').should.above(-1); - args.indexOf('-partitions').should.above(-1); - args.indexOf('+parti4x4+partp8x8+partb8x8').should.above(-1); - args.indexOf('-single').should.above(-1); - args.indexOf('option').should.above(-1); - args.indexOf('-multiple').should.above(-1); - args.indexOf('-options').should.above(-1); - done(); - }); - }); - it('should apply a single input option', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .addInputOption('-r', '29.97') - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - var joined = args.join(' '); - joined.indexOf('-r 29.97').should.above(-1).and.below(joined.indexOf('-i ')); - done(); - }); - }); - it('should apply multiple input options', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .addInputOptions(['-r 29.97', '-f ogg']) - .addInputOptions('-single option') - .addInputOptions('-multiple', '-options') - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - var joined = args.join(' '); - joined.indexOf('-r 29.97').should.above(-1).and.below(joined.indexOf('-i')); - joined.indexOf('-f ogg').should.above(-1).and.below(joined.indexOf('-i')); - joined.indexOf('-single option').should.above(-1).and.below(joined.indexOf('-i')); - joined.indexOf('-multiple').should.above(-1).and.below(joined.indexOf('-i')); - joined.indexOf('-options').should.above(-1).and.below(joined.indexOf('-i')); - done(); - }); - }); - }); - - describe('toFormat', function() { - it('should apply the target format', function(done) { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .toFormat('mp4') - ._test_getArgs(function(args, err) { - testhelper.logArgError(err); - assert.ok(!err); - - args.indexOf('-f').should.above(-1); - args.indexOf('mp4').should.above(-1); - done(); - }); - }); - }); - - describe('Size calculations', function() { - it('Should throw an error when an invalid aspect ratio is passed', function() { - (function() { - new Ffmpeg().aspect('blah'); - }).should.throw(/Invalid aspect ratio/); - }); - - it('Should add scale and setsar filters when keepPixelAspect was called', function() { - var filters; - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .keepPixelAspect(true) - ._test_getSizeFilters(); - filters.length.should.equal(2); - filters[0].should.equal('scale=w=\'if(gt(sar,1),iw*sar,iw)\':h=\'if(lt(sar,1),ih/sar,ih)\''); - filters[1].should.equal('setsar=1'); - }); - - it('Should throw an error when an invalid size was requested', function() { - (function() { - new Ffmpeg().withSize('aslkdbasd'); - }).should.throw(/^Invalid size specified/); - }); - - it('Should not add scale filters when withSize was not called', function() { - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - ._test_getSizeFilters().length.should.equal(0); - - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withAspect(4/3) - ._test_getSizeFilters().length.should.equal(0); - - new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .applyAutopadding(true, 'white') - ._test_getSizeFilters().length.should.equal(0); - }); - - it('Should add proper scale filter when withSize was called with a percent value', function() { - var filters; - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('42%') - ._test_getSizeFilters(); - filters.length.should.equal(1); - filters[0].should.equal('scale=w=trunc(iw*0.42/2)*2:h=trunc(ih*0.42/2)*2'); - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('42%') - .withAspect(4/3) - ._test_getSizeFilters(); - filters.length.should.equal(1); - filters[0].should.equal('scale=w=trunc(iw*0.42/2)*2:h=trunc(ih*0.42/2)*2'); - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('42%') - .applyAutopadding(true, 'white') - ._test_getSizeFilters(); - filters.length.should.equal(1); - filters[0].should.equal('scale=w=trunc(iw*0.42/2)*2:h=trunc(ih*0.42/2)*2'); - }); - - it('Should add proper scale filter when withSize was called with a fixed size', function() { - var filters; - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('100x200') - ._test_getSizeFilters(); - filters.length.should.equal(1); - filters[0].should.equal('scale=w=100:h=200'); - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('100x200') - .withAspect(4/3) - ._test_getSizeFilters(); - filters.length.should.equal(1); - filters[0].should.equal('scale=w=100:h=200'); - }); - - it('Should add proper scale filter when withSize was called with a "?" and no aspect ratio is specified', function() { - var filters; - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('100x?') - ._test_getSizeFilters(); - filters.length.should.equal(1); - filters[0].should.equal('scale=w=100:h=trunc(ow/a/2)*2'); - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('100x?') - .applyAutopadding(true, 'white') - ._test_getSizeFilters(); - filters.length.should.equal(1); - filters[0].should.equal('scale=w=100:h=trunc(ow/a/2)*2'); - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('?x200') - ._test_getSizeFilters(); - filters.length.should.equal(1); - filters[0].should.equal('scale=w=trunc(oh*a/2)*2:h=200'); - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('?x200') - .applyAutopadding(true, 'white') - ._test_getSizeFilters(); - filters.length.should.equal(1); - filters[0].should.equal('scale=w=trunc(oh*a/2)*2:h=200'); - }); - - it('Should add proper scale filter when withSize was called with a "?" and an aspect ratio is specified', function() { - var filters; - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('100x?') - .withAspect(0.5) - ._test_getSizeFilters(); - filters.length.should.equal(1); - filters[0].should.equal('scale=w=100:h=200'); - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('?x100') - .withAspect(2) - ._test_getSizeFilters(); - filters.length.should.equal(1); - filters[0].should.equal('scale=w=200:h=100'); - }); - - it('Should add scale and pad filters when withSize was called with a "?", aspect ratio and auto padding are specified', function() { - var filters; - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('100x?') - .withAspect(0.5) - .applyAutopadding(true, 'white') - ._test_getSizeFilters(); - filters.length.should.equal(2); - filters[0].should.equal('scale=w=\'if(gt(a,0.5),100,trunc(200*a/2)*2)\':h=\'if(lt(a,0.5),200,trunc(100/a/2)*2)\''); - filters[1].should.equal('pad=w=100:h=200:x=\'if(gt(a,0.5),0,(100-iw)/2)\':y=\'if(lt(a,0.5),0,(200-ih)/2)\':color=white'); - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('?x100') - .withAspect(2) - .applyAutopadding(true, 'white') - ._test_getSizeFilters(); - filters.length.should.equal(2); - filters[0].should.equal('scale=w=\'if(gt(a,2),200,trunc(100*a/2)*2)\':h=\'if(lt(a,2),100,trunc(200/a/2)*2)\''); - filters[1].should.equal('pad=w=200:h=100:x=\'if(gt(a,2),0,(200-iw)/2)\':y=\'if(lt(a,2),0,(100-ih)/2)\':color=white'); - }); - - it('Should add scale and pad filters when withSize was called with a fixed size and auto padding is specified', function() { - var filters; - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('100x200') - .applyAutopadding(true, 'white') - ._test_getSizeFilters(); - filters.length.should.equal(2); - filters[0].should.equal('scale=w=\'if(gt(a,0.5),100,trunc(200*a/2)*2)\':h=\'if(lt(a,0.5),200,trunc(100/a/2)*2)\''); - filters[1].should.equal('pad=w=100:h=200:x=\'if(gt(a,0.5),0,(100-iw)/2)\':y=\'if(lt(a,0.5),0,(200-ih)/2)\':color=white'); - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('100x200') - .withAspect(4/3) - .applyAutopadding(true, 'white') - ._test_getSizeFilters(); - filters.length.should.equal(2); - filters[0].should.equal('scale=w=\'if(gt(a,0.5),100,trunc(200*a/2)*2)\':h=\'if(lt(a,0.5),200,trunc(100/a/2)*2)\''); - filters[1].should.equal('pad=w=100:h=200:x=\'if(gt(a,0.5),0,(100-iw)/2)\':y=\'if(lt(a,0.5),0,(200-ih)/2)\':color=white'); - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('200x100') - .applyAutopadding(true, 'white') - ._test_getSizeFilters(); - filters.length.should.equal(2); - filters[0].should.equal('scale=w=\'if(gt(a,2),200,trunc(100*a/2)*2)\':h=\'if(lt(a,2),100,trunc(200/a/2)*2)\''); - filters[1].should.equal('pad=w=200:h=100:x=\'if(gt(a,2),0,(200-iw)/2)\':y=\'if(lt(a,2),0,(100-ih)/2)\':color=white'); - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('200x100') - .withAspect(4/3) - .applyAutopadding(true, 'white') - ._test_getSizeFilters(); - filters.length.should.equal(2); - filters[0].should.equal('scale=w=\'if(gt(a,2),200,trunc(100*a/2)*2)\':h=\'if(lt(a,2),100,trunc(200/a/2)*2)\''); - filters[1].should.equal('pad=w=200:h=100:x=\'if(gt(a,2),0,(200-iw)/2)\':y=\'if(lt(a,2),0,(100-ih)/2)\':color=white'); - }); - - it('Should round sizes to multiples of 2', function() { - var filters; - var aspect = 102/202; - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('101x201') - ._test_getSizeFilters(); - filters.length.should.equal(1); - filters[0].should.equal('scale=w=102:h=202'); - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('101x201') - .applyAutopadding(true, 'white') - ._test_getSizeFilters(); - filters.length.should.equal(2); - filters[0].should.equal('scale=w=\'if(gt(a,' + aspect + '),102,trunc(202*a/2)*2)\':h=\'if(lt(a,' + aspect + '),202,trunc(102/a/2)*2)\''); - filters[1].should.equal('pad=w=102:h=202:x=\'if(gt(a,' + aspect + '),0,(102-iw)/2)\':y=\'if(lt(a,' + aspect + '),0,(202-ih)/2)\':color=white'); - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('101x?') - .withAspect('1:2') - ._test_getSizeFilters(); - filters.length.should.equal(1); - filters[0].should.equal('scale=w=102:h=202'); - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('?x201') - .withAspect('1:2') - ._test_getSizeFilters(); - filters.length.should.equal(1); - filters[0].should.equal('scale=w=102:h=202'); - }); - - it('Should apply autopadding when no boolean argument was passed to applyAutopadding', function() { - var filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('100x?') - .withAspect(0.5) - .applyAutopadding('white') - ._test_getSizeFilters(); - filters.length.should.equal(2); - filters[1].should.equal('pad=w=100:h=200:x=\'if(gt(a,0.5),0,(100-iw)/2)\':y=\'if(lt(a,0.5),0,(200-ih)/2)\':color=white'); - }); - - it('Should default to black padding', function() { - var filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('100x?') - .withAspect(0.5) - .applyAutopadding() - ._test_getSizeFilters(); - filters.length.should.equal(2); - filters[1].should.equal('pad=w=100:h=200:x=\'if(gt(a,0.5),0,(100-iw)/2)\':y=\'if(lt(a,0.5),0,(200-ih)/2)\':color=black'); - - filters = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .withSize('100x?') - .withAspect(0.5) - .applyAutopadding(true) - ._test_getSizeFilters(); - filters.length.should.equal(2); - filters[1].should.equal('pad=w=100:h=200:x=\'if(gt(a,0.5),0,(100-iw)/2)\':y=\'if(lt(a,0.5),0,(200-ih)/2)\':color=black'); - }); - }); - - describe('complexFilter', function() { - it('should generate a complex filter from a single filter', function() { - var filters = new Ffmpeg() - .complexFilter('filterstring') - ._getArguments(); - - filters.length.should.equal(2); - filters[0].should.equal('-filter_complex'); - filters[1].should.equal('filterstring'); - }); - - it('should generate a complex filter from a filter array', function() { - var filters = new Ffmpeg() - .complexFilter(['filter1', 'filter2']) - ._getArguments(); - - filters.length.should.equal(2); - filters[1].should.equal('filter1;filter2'); - }); - - it('should support filter objects', function() { - var filters = new Ffmpeg() - .complexFilter([ - 'filter1', - { filter: 'filter2' } - ]) - ._getArguments(); - - filters.length.should.equal(2); - filters[1].should.equal('filter1;filter2'); - }); - - it('should support filter options', function() { - var filters = new Ffmpeg() - .complexFilter([ - { filter: 'filter1', options: 'optionstring' }, - { filter: 'filter2', options: ['opt1', 'opt2', 'opt3'] }, - { filter: 'filter3', options: { opt1: 'value1', opt2: 'value2' } } - ]) - ._getArguments(); - - filters.length.should.equal(2); - filters[1].should.equal('filter1=optionstring;filter2=opt1:opt2:opt3;filter3=opt1=value1:opt2=value2'); - }); - - it('should escape filter options with ambiguous characters', function() { - var filters = new Ffmpeg() - .complexFilter([ - { filter: 'filter1', options: 'optionstring' }, - { filter: 'filter2', options: ['op,t1', 'op,t2', 'op,t3'] }, - { filter: 'filter3', options: { opt1: 'val,ue1', opt2: 'val,ue2' } } - ]) - ._getArguments(); - - filters.length.should.equal(2); - filters[1].should.equal('filter1=optionstring;filter2=\'op,t1\':\'op,t2\':\'op,t3\';filter3=opt1=\'val,ue1\':opt2=\'val,ue2\''); - }); - - it('should support filter input streams', function() { - var filters = new Ffmpeg() - .complexFilter([ - { filter: 'filter1', inputs: 'input' }, - { filter: 'filter2', inputs: '[input]' }, - { filter: 'filter3', inputs: ['[input1]', 'input2'] } - ]) - ._getArguments(); - - filters.length.should.equal(2); - filters[1].should.equal('[input]filter1;[input]filter2;[input1][input2]filter3'); - }); - - it('should support filter output streams', function() { - var filters = new Ffmpeg() - .complexFilter([ - { filter: 'filter1', options: 'opt', outputs: 'output' }, - { filter: 'filter2', options: 'opt', outputs: '[output]' }, - { filter: 'filter3', options: 'opt', outputs: ['[output1]', 'output2'] } - ]) - ._getArguments(); - - filters.length.should.equal(2); - filters[1].should.equal('filter1=opt[output];filter2=opt[output];filter3=opt[output1][output2]'); - }); - - it('should support an additional mapping argument', function() { - var filters = new Ffmpeg() - .complexFilter(['filter1', 'filter2'], 'output') - ._getArguments(); - - filters.length.should.equal(4); - filters[2].should.equal('-map'); - filters[3].should.equal('[output]'); - - filters = new Ffmpeg() - .complexFilter(['filter1', 'filter2'], '[output]') - ._getArguments(); - - filters.length.should.equal(4); - filters[2].should.equal('-map'); - filters[3].should.equal('[output]'); - - filters = new Ffmpeg() - .complexFilter(['filter1', 'filter2'], ['[output1]', 'output2']) - ._getArguments(); - - filters.length.should.equal(6); - filters[2].should.equal('-map'); - filters[3].should.equal('[output1]'); - filters[4].should.equal('-map'); - filters[5].should.equal('[output2]'); - }); - - it('should override any previously set complex filtergraphs', function() { - var filters = new Ffmpeg() - .complexFilter(['filter1a', 'filter1b'], 'output1') - .complexFilter(['filter2a', 'filter2b'], 'output2') - ._getArguments(); - - filters.length.should.equal(4); - filters[1].should.equal('filter2a;filter2b'); - filters[2].should.equal('-map'); - filters[3].should.equal('[output2]'); - }); - }); - - describe('clone', function() { - it('should return a new FfmpegCommand instance', function() { - var command = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }); - var clone = command.clone(); - - clone.should.instanceof(Ffmpeg); - clone.should.not.equal(command); - }); - - it('should duplicate FfmpegCommand options at the time of the call', function(done) { - var command = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .preset('flashvideo'); - - var clone = command.clone(); - - command._test_getArgs(function(originalArgs) { - clone._test_getArgs(function(cloneArgs) { - cloneArgs.length.should.equal(originalArgs.length); - originalArgs.forEach(function(arg, index) { - cloneArgs[index].should.equal(arg); - }); - done(); - }); - }); - }); - - it('should have separate argument lists', function(done) { - var command = new Ffmpeg({ source: this.testfile, logger: testhelper.logger }) - .preset('flashvideo'); - - var clone = command.clone().audioFrequency(22050); - - command._test_getArgs(function(originalArgs) { - clone._test_getArgs(function(cloneArgs) { - cloneArgs.length.should.equal(originalArgs.length + 2); - done(); - }); - }); - }); - }); -}); diff --git a/test/assets/ffserver.conf b/test/assets/ffserver.conf deleted file mode 100644 index c65bc2ff..00000000 --- a/test/assets/ffserver.conf +++ /dev/null @@ -1,29 +0,0 @@ -Port 8090 -BindAddress 127.0.0.1 -RTSPPort 5540 -RTSPBindAddress 127.0.0.1 -MaxHTTPConnections 1000 -MaxClients 10 -MaxBandwidth 1000000 - - -ReadOnlyFile teststream.ffm -ACL allow 127.0.0.1 -Format mpegts -AudioCodec mp2 -VideoCodec libx264 - - - -ReadOnlyFile teststream.ffm -ACL allow 127.0.0.1 -Format rtp - - - -File testinput.ffm -ACL allow 127.0.0.1 -Format mpegts -AudioCodec mp2 -VideoCodec libx264 - diff --git a/test/assets/presets/custompreset.js b/test/assets/presets/custompreset.js deleted file mode 100644 index febce615..00000000 --- a/test/assets/presets/custompreset.js +++ /dev/null @@ -1,14 +0,0 @@ -exports.load = function(ffmpeg) { - ffmpeg - .toFormat('m4v') - .withVideoBitrate('512k') - .withVideoCodec('libx264') - .withSize('320x176') - .withAudioBitrate('128k') - .withAudioCodec('aac') - .withAudioChannels(1) - .addOptions(['-flags', '+loop', '-cmp', '+chroma', '-partitions','+parti4x4+partp8x8+partb8x8', '-flags2', - '+mixed_refs', '-me_method umh', '-subq 5', '-bufsize 2M', '-rc_eq \'blurCplx^(1-qComp)\'', - '-qcomp 0.6', '-qmin 10', '-qmax 51', '-qdiff 4', '-level 13' ]); - return ffmpeg; -}; diff --git a/test/assets/te[s]t_ video ' _ .flv b/test/assets/te[s]t_ video ' _ .flv deleted file mode 100644 index 82f34d07..00000000 Binary files a/test/assets/te[s]t_ video ' _ .flv and /dev/null differ diff --git a/test/assets/testaudio-one.wav b/test/assets/testaudio-one.wav deleted file mode 100644 index a0763e96..00000000 Binary files a/test/assets/testaudio-one.wav and /dev/null differ diff --git a/test/assets/testaudio-three.wav b/test/assets/testaudio-three.wav deleted file mode 100644 index df55d28f..00000000 Binary files a/test/assets/testaudio-three.wav and /dev/null differ diff --git a/test/assets/testaudio-two.wav b/test/assets/testaudio-two.wav deleted file mode 100644 index 83d06acd..00000000 Binary files a/test/assets/testaudio-two.wav and /dev/null differ diff --git a/test/assets/teststream.ffm b/test/assets/teststream.ffm deleted file mode 100644 index ba300b68..00000000 Binary files a/test/assets/teststream.ffm and /dev/null differ diff --git a/test/assets/testvideo-169.avi b/test/assets/testvideo-169.avi deleted file mode 100644 index 9f78d106..00000000 Binary files a/test/assets/testvideo-169.avi and /dev/null differ diff --git a/test/assets/testvideo-43.avi b/test/assets/testvideo-43.avi deleted file mode 100644 index 6291cf12..00000000 Binary files a/test/assets/testvideo-43.avi and /dev/null differ diff --git a/test/capabilities.test.js b/test/capabilities.test.js deleted file mode 100644 index c8855f1e..00000000 --- a/test/capabilities.test.js +++ /dev/null @@ -1,672 +0,0 @@ -/*jshint node:true*/ -/*global describe,it,beforeEach,afterEach,after*/ -'use strict'; - -var Ffmpeg = require('../index'), - path = require('path'), - assert = require('assert'), - testhelper = require('./helpers'), - async = require('async'); - -// delimiter fallback for node 0.8 -var PATH_DELIMITER = path.delimiter || (require('os').platform().match(/win(32|64)/) ? ';' : ':'); - - -describe('Capabilities', function() { - describe('ffmpeg capabilities', function() { - it('should enable querying for available codecs', function(done) { - new Ffmpeg({ source: '' }).getAvailableCodecs(function(err, codecs) { - testhelper.logError(err); - assert.ok(!err); - - (typeof codecs).should.equal('object'); - Object.keys(codecs).length.should.not.equal(0); - - ('pcm_s16le' in codecs).should.equal(true); - ('type' in codecs.pcm_s16le).should.equal(true); - (typeof codecs.pcm_s16le.type).should.equal('string'); - ('description' in codecs.pcm_s16le).should.equal(true); - (typeof codecs.pcm_s16le.description).should.equal('string'); - ('canEncode' in codecs.pcm_s16le).should.equal(true); - (typeof codecs.pcm_s16le.canEncode).should.equal('boolean'); - ('canDecode' in codecs.pcm_s16le).should.equal(true); - (typeof codecs.pcm_s16le.canDecode).should.equal('boolean'); - - done(); - }); - }); - - it('should enable querying for available encoders', function(done) { - new Ffmpeg({ source: '' }).getAvailableEncoders(function(err, encoders) { - testhelper.logError(err); - assert.ok(!err); - - (typeof encoders).should.equal('object'); - Object.keys(encoders).length.should.not.equal(0); - - ('pcm_s16le' in encoders).should.equal(true); - ('type' in encoders.pcm_s16le).should.equal(true); - (typeof encoders.pcm_s16le.type).should.equal('string'); - ('description' in encoders.pcm_s16le).should.equal(true); - (typeof encoders.pcm_s16le.description).should.equal('string'); - ('experimental' in encoders.pcm_s16le).should.equal(true); - (typeof encoders.pcm_s16le.experimental).should.equal('boolean'); - - done(); - }); - }); - - it('should enable querying for available formats', function(done) { - new Ffmpeg({ source: '' }).getAvailableFormats(function(err, formats) { - testhelper.logError(err); - assert.ok(!err); - - (typeof formats).should.equal('object'); - Object.keys(formats).length.should.not.equal(0); - - ('wav' in formats).should.equal(true); - ('description' in formats.wav).should.equal(true); - (typeof formats.wav.description).should.equal('string'); - ('canMux' in formats.wav).should.equal(true); - (typeof formats.wav.canMux).should.equal('boolean'); - ('canDemux' in formats.wav).should.equal(true); - (typeof formats.wav.canDemux).should.equal('boolean'); - - done(); - }); - }); - - it('should enable querying for available filters', function(done) { - new Ffmpeg({ source: '' }).getAvailableFilters(function(err, filters) { - testhelper.logError(err); - assert.ok(!err); - - (typeof filters).should.equal('object'); - Object.keys(filters).length.should.not.equal(0); - - ('anull' in filters).should.equal(true); - ('description' in filters.anull).should.equal(true); - (typeof filters.anull.description).should.equal('string'); - ('input' in filters.anull).should.equal(true); - (typeof filters.anull.input).should.equal('string'); - ('output' in filters.anull).should.equal(true); - (typeof filters.anull.output).should.equal('string'); - ('multipleInputs' in filters.anull).should.equal(true); - (typeof filters.anull.multipleInputs).should.equal('boolean'); - ('multipleOutputs' in filters.anull).should.equal(true); - (typeof filters.anull.multipleOutputs).should.equal('boolean'); - - done(); - }); - }); - - it('should enable querying capabilities without instanciating a command', function(done) { - Ffmpeg.getAvailableCodecs(function(err, codecs) { - testhelper.logError(err); - assert.ok(!err); - - (typeof codecs).should.equal('object'); - Object.keys(codecs).length.should.not.equal(0); - - Ffmpeg.getAvailableFilters(function(err, filters) { - testhelper.logError(err); - assert.ok(!err); - - (typeof filters).should.equal('object'); - Object.keys(filters).length.should.not.equal(0); - - Ffmpeg.getAvailableFormats(function(err, formats) { - testhelper.logError(err); - assert.ok(!err); - - (typeof formats).should.equal('object'); - Object.keys(formats).length.should.not.equal(0); - - done(); - }); - }); - }); - }); - - it('should enable checking command arguments for available codecs, formats and encoders', function(done) { - async.waterfall([ - // Check with everything available - function(cb) { - new Ffmpeg('/path/to/file.avi') - .fromFormat('avi') - .audioCodec('pcm_u16le') - .videoCodec('png') - .toFormat('mp4') - ._checkCapabilities(cb); - }, - - // Invalid input format - function(cb) { - new Ffmpeg('/path/to/file.avi') - .fromFormat('invalid-input-format') - .audioCodec('pcm_u16le') - .videoCodec('png') - .toFormat('mp4') - ._checkCapabilities(function(err) { - assert.ok(!!err); - err.message.should.match(/Input format invalid-input-format is not available/); - - cb(); - }); - }, - - // Invalid output format - function(cb) { - new Ffmpeg('/path/to/file.avi') - .fromFormat('avi') - .audioCodec('pcm_u16le') - .videoCodec('png') - .toFormat('invalid-output-format') - ._checkCapabilities(function(err) { - assert.ok(!!err); - err.message.should.match(/Output format invalid-output-format is not available/); - - cb(); - }); - }, - - // Invalid audio codec - function(cb) { - new Ffmpeg('/path/to/file.avi') - .fromFormat('avi') - .audioCodec('invalid-audio-codec') - .videoCodec('png') - .toFormat('mp4') - ._checkCapabilities(function(err) { - assert.ok(!!err); - err.message.should.match(/Audio codec invalid-audio-codec is not available/); - - cb(); - }); - }, - - // Invalid video codec - function(cb) { - new Ffmpeg('/path/to/file.avi') - .fromFormat('avi') - .audioCodec('pcm_u16le') - .videoCodec('invalid-video-codec') - .toFormat('mp4') - ._checkCapabilities(function(err) { - assert.ok(!!err); - err.message.should.match(/Video codec invalid-video-codec is not available/); - - cb(); - }); - }, - - // Invalid audio encoder - function(cb) { - new Ffmpeg('/path/to/file.avi') - .fromFormat('avi') - // Valid codec, but not a valid encoder for audio - .audioCodec('png') - .videoCodec('png') - .toFormat('mp4') - ._checkCapabilities(function(err) { - assert.ok(!!err); - err.message.should.match(/Audio codec png is not available/); - - cb(); - }); - }, - - // Invalid video encoder - function(cb) { - new Ffmpeg('/path/to/file.avi') - .fromFormat('avi') - .audioCodec('pcm_u16le') - // Valid codec, but not a valid encoder for video - .videoCodec('pcm_u16le') - .toFormat('mp4') - ._checkCapabilities(function(err) { - assert.ok(!!err); - err.message.should.match(/Video codec pcm_u16le is not available/); - - cb(); - }); - } - ], function(err) { - testhelper.logError(err); - assert.ok(!err); - - done(); - }); - }); - - it('should check capabilities before running a command', function(done) { - new Ffmpeg('/path/to/file.avi') - .on('error', function(err) { - err.message.should.match(/Output format invalid-output-format is not available/); - done(); - }) - .toFormat('invalid-output-format') - .saveToFile('/tmp/will-not-be-created.mp4'); - }); - }); - - describe('ffmpeg path', function() { - var FFMPEG_PATH; - var ALT_FFMPEG_PATH; - var skipAltTest = false; - - // Only test with FFMPEG_PATH when we actually have an alternative path - if (process.env.ALT_FFMPEG_PATH) { - ALT_FFMPEG_PATH = process.env.ALT_FFMPEG_PATH; - } else { - skipAltTest = true; - } - - beforeEach(function() { - // Save environment before each test - FFMPEG_PATH = process.env.FFMPEG_PATH; - }); - - afterEach(function() { - // Restore environment after each test - process.env.FFMPEG_PATH = FFMPEG_PATH; - }); - - after(function() { - // Forget paths after all tests - (new Ffmpeg())._forgetPaths(); - }); - - it('should allow manual definition of ffmpeg binary path', function(done) { - var ff = new Ffmpeg(); - - ff.setFfmpegPath('/doom/di/dom'); - ff._getFfmpegPath(function(err, ffmpeg) { - testhelper.logError(err); - assert.ok(!err); - - ffmpeg.should.equal('/doom/di/dom'); - done(); - }); - }); - - it('should allow static manual definition of ffmpeg binary path', function(done) { - var ff = new Ffmpeg(); - - Ffmpeg.setFfmpegPath('/doom/di/dom2'); - ff._getFfmpegPath(function(err, ffmpeg) { - testhelper.logError(err); - assert.ok(!err); - - ffmpeg.should.equal('/doom/di/dom2'); - done(); - }); - }); - - it('should look for ffmpeg in the PATH if FFMPEG_PATH is not defined', function(done) { - var ff = new Ffmpeg(); - - delete process.env.FFMPEG_PATH; - - ff._forgetPaths(); - ff._getFfmpegPath(function(err, ffmpeg) { - testhelper.logError(err); - assert.ok(!err); - - ffmpeg.should.instanceOf(String); - ffmpeg.length.should.above(0); - - var paths = process.env.PATH.split(PATH_DELIMITER); - paths.indexOf(path.dirname(ffmpeg)).should.above(-1); - done(); - }); - }); - - (skipAltTest ? it.skip : it)('should use FFMPEG_PATH if defined and valid', function(done) { - var ff = new Ffmpeg(); - - process.env.FFMPEG_PATH = ALT_FFMPEG_PATH; - - ff._forgetPaths(); - ff._getFfmpegPath(function(err, ffmpeg) { - testhelper.logError(err); - assert.ok(!err); - - ffmpeg.should.equal(ALT_FFMPEG_PATH); - done(); - }); - }); - - it('should fall back to searching in the PATH if FFMPEG_PATH is invalid', function(done) { - var ff = new Ffmpeg(); - - process.env.FFMPEG_PATH = '/nope/not-here/nothing-to-see-here'; - - ff._forgetPaths(); - ff._getFfmpegPath(function(err, ffmpeg) { - testhelper.logError(err); - assert.ok(!err); - - ffmpeg.should.instanceOf(String); - ffmpeg.length.should.above(0); - - var paths = process.env.PATH.split(PATH_DELIMITER); - paths.indexOf(path.dirname(ffmpeg)).should.above(-1); - done(); - }); - }); - - it('should remember ffmpeg path', function(done) { - var ff = new Ffmpeg(); - - delete process.env.FFMPEG_PATH; - - ff._forgetPaths(); - ff._getFfmpegPath(function(err, ffmpeg) { - testhelper.logError(err); - assert.ok(!err); - - ffmpeg.should.instanceOf(String); - ffmpeg.length.should.above(0); - - // Just check that the callback is actually called synchronously - // (which indicates no which call was made) - var after = 0; - ff._getFfmpegPath(function(err, ffmpeg) { - testhelper.logError(err); - assert.ok(!err); - - ffmpeg.should.instanceOf(String); - ffmpeg.length.should.above(0); - after.should.equal(0); - - done(); - }); - - after = 1; - }); - }); - }); - - describe('ffprobe path', function() { - var FFPROBE_PATH; - var ALT_FFPROBE_PATH; - var skipAltTest = false; - - // Only test with FFPROBE_PATH when we actually have an alternative path - if (process.env.ALT_FFPROBE_PATH) { - ALT_FFPROBE_PATH = process.env.ALT_FFPROBE_PATH; - } else { - skipAltTest = true; - } - - beforeEach(function() { - // Save environment before each test - FFPROBE_PATH = process.env.FFPROBE_PATH; - }); - - afterEach(function() { - // Restore environment after each test - process.env.FFPROBE_PATH = FFPROBE_PATH; - }); - - after(function() { - // Forget paths after all tests - (new Ffmpeg())._forgetPaths(); - }); - - it('should allow manual definition of ffprobe binary path', function(done) { - var ff = new Ffmpeg(); - - ff.setFfprobePath('/doom/di/dom'); - ff._getFfprobePath(function(err, ffprobe) { - testhelper.logError(err); - assert.ok(!err); - - ffprobe.should.equal('/doom/di/dom'); - done(); - }); - }); - - it('should allow static manual definition of ffprobe binary path', function(done) { - var ff = new Ffmpeg(); - - Ffmpeg.setFfprobePath('/doom/di/dom2'); - ff._getFfprobePath(function(err, ffprobe) { - testhelper.logError(err); - assert.ok(!err); - - ffprobe.should.equal('/doom/di/dom2'); - done(); - }); - }); - - it('should look for ffprobe in the PATH if FFPROBE_PATH is not defined', function(done) { - var ff = new Ffmpeg(); - - delete process.env.FFPROBE_PATH; - - ff._forgetPaths(); - ff._getFfprobePath(function(err, ffprobe) { - testhelper.logError(err); - assert.ok(!err); - - ffprobe.should.instanceOf(String); - ffprobe.length.should.above(0); - - var paths = process.env.PATH.split(PATH_DELIMITER); - paths.indexOf(path.dirname(ffprobe)).should.above(-1); - done(); - }); - }); - - (skipAltTest ? it.skip : it)('should use FFPROBE_PATH if defined and valid', function(done) { - var ff = new Ffmpeg(); - - process.env.FFPROBE_PATH = ALT_FFPROBE_PATH; - - ff._forgetPaths(); - ff._getFfprobePath(function(err, ffprobe) { - testhelper.logError(err); - assert.ok(!err); - - ffprobe.should.equal(ALT_FFPROBE_PATH); - done(); - }); - }); - - it('should fall back to searching in the PATH if FFPROBE_PATH is invalid', function(done) { - var ff = new Ffmpeg(); - - process.env.FFPROBE_PATH = '/nope/not-here/nothing-to-see-here'; - - ff._forgetPaths(); - ff._getFfprobePath(function(err, ffprobe) { - testhelper.logError(err); - assert.ok(!err); - - ffprobe.should.instanceOf(String); - ffprobe.length.should.above(0); - - var paths = process.env.PATH.split(PATH_DELIMITER); - paths.indexOf(path.dirname(ffprobe)).should.above(-1); - done(); - }); - }); - - it('should remember ffprobe path', function(done) { - var ff = new Ffmpeg(); - - delete process.env.FFPROBE_PATH; - - ff._forgetPaths(); - ff._getFfprobePath(function(err, ffprobe) { - testhelper.logError(err); - assert.ok(!err); - - ffprobe.should.instanceOf(String); - ffprobe.length.should.above(0); - - // Just check that the callback is actually called synchronously - // (which indicates no which call was made) - var after = 0; - ff._getFfprobePath(function(err, ffprobe) { - testhelper.logError(err); - assert.ok(!err); - - ffprobe.should.instanceOf(String); - ffprobe.length.should.above(0); - after.should.equal(0); - - done(); - }); - - after = 1; - }); - }); - }); - - describe('flvtool path', function() { - var FLVTOOL2_PATH; - var ALT_FLVTOOL_PATH; - var skipAltTest = false; - var skipTest = false; - - if (process.env.FLVTOOL2_PRESENT === 'no') { - skipTest = true; - } - - // Only test with FLVTOOL2_PATH when we actually have an alternative path - if (process.env.ALT_FLVTOOL_PATH) { - ALT_FLVTOOL_PATH = process.env.ALT_FLVTOOL_PATH; - } else { - skipAltTest = true; - } - - beforeEach(function() { - // Save environment before each test - FLVTOOL2_PATH = process.env.FLVTOOL2_PATH; - }); - - afterEach(function() { - // Restore environment after each test - process.env.FLVTOOL2_PATH = FLVTOOL2_PATH; - }); - - after(function() { - // Forget paths after all tests - (new Ffmpeg())._forgetPaths(); - }); - - (skipTest ? it.skip : it)('should allow manual definition of fflvtool binary path', function(done) { - var ff = new Ffmpeg(); - - ff.setFlvtoolPath('/doom/di/dom'); - ff._getFlvtoolPath(function(err, fflvtool) { - testhelper.logError(err); - assert.ok(!err); - - fflvtool.should.equal('/doom/di/dom'); - done(); - }); - }); - - (skipTest ? it.skip : it)('should allow static manual definition of fflvtool binary path', function(done) { - var ff = new Ffmpeg(); - - Ffmpeg.setFlvtoolPath('/doom/di/dom2'); - ff._getFlvtoolPath(function(err, fflvtool) { - testhelper.logError(err); - assert.ok(!err); - - fflvtool.should.equal('/doom/di/dom2'); - done(); - }); - }); - - (skipTest ? it.skip : it)('should look for fflvtool in the PATH if FLVTOOL2_PATH is not defined', function(done) { - var ff = new Ffmpeg(); - - delete process.env.FLVTOOL2_PATH; - - ff._forgetPaths(); - ff._getFlvtoolPath(function(err, fflvtool) { - testhelper.logError(err); - assert.ok(!err); - - fflvtool.should.instanceOf(String); - fflvtool.length.should.above(0); - - var paths = process.env.PATH.split(PATH_DELIMITER); - paths.indexOf(path.dirname(fflvtool)).should.above(-1); - done(); - }); - }); - - (skipTest || skipAltTest ? it.skip : it)('should use FLVTOOL2_PATH if defined and valid', function(done) { - var ff = new Ffmpeg(); - - process.env.FLVTOOL2_PATH = ALT_FLVTOOL_PATH; - - ff._forgetPaths(); - ff._getFlvtoolPath(function(err, fflvtool) { - testhelper.logError(err); - assert.ok(!err); - - fflvtool.should.equal(ALT_FLVTOOL_PATH); - done(); - }); - }); - - (skipTest ? it.skip : it)('should fall back to searching in the PATH if FLVTOOL2_PATH is invalid', function(done) { - var ff = new Ffmpeg(); - - process.env.FLVTOOL2_PATH = '/nope/not-here/nothing-to-see-here'; - - ff._forgetPaths(); - ff._getFlvtoolPath(function(err, fflvtool) { - testhelper.logError(err); - assert.ok(!err); - - fflvtool.should.instanceOf(String); - fflvtool.length.should.above(0); - - var paths = process.env.PATH.split(PATH_DELIMITER); - paths.indexOf(path.dirname(fflvtool)).should.above(-1); - done(); - }); - }); - - (skipTest ? it.skip : it)('should remember fflvtool path', function(done) { - var ff = new Ffmpeg(); - - delete process.env.FLVTOOL2_PATH; - - ff._forgetPaths(); - ff._getFlvtoolPath(function(err, fflvtool) { - testhelper.logError(err); - assert.ok(!err); - - fflvtool.should.instanceOf(String); - fflvtool.length.should.above(0); - - // Just check that the callback is actually called synchronously - // (which indicates no which call was made) - var after = 0; - ff._getFlvtoolPath(function(err, fflvtool) { - testhelper.logError(err); - assert.ok(!err); - - fflvtool.should.instanceOf(String); - fflvtool.length.should.above(0); - after.should.equal(0); - - done(); - }); - - after = 1; - }); - }); - }); - -}); diff --git a/test/helpers.js b/test/helpers.js deleted file mode 100644 index 430266c1..00000000 --- a/test/helpers.js +++ /dev/null @@ -1,80 +0,0 @@ -/*jshint node:true*/ -'use strict'; - -var TestHelpers; - -exports = module.exports = TestHelpers = { - getFfmpegCheck: function() { - var platform = require('os').platform(); - - if (!platform.match(/win(32|64)/)) { - // linux/mac, use which - return 'which ffmpeg'; - } else { - // windows, use where (> windows server 2003 / windows 7) - return 'where /Q ffmpeg'; - } - }, - - logger: { - debug: function(arg) { if (process.env.FLUENTFFMPEG_COV !== '1') console.log(' [DEBUG] ' + arg); }, - info: function(arg) { if (process.env.FLUENTFFMPEG_COV !== '1') console.log(' [INFO] ' + arg); }, - warn: function(arg) { if (process.env.FLUENTFFMPEG_COV !== '1') console.log(' [WARN] ' + arg); }, - error: function(arg) { if (process.env.FLUENTFFMPEG_COV !== '1') console.log(' [ERROR] ' + arg); } - }, - - logArgError: function(err) { - if (err) { - console.log('got error: ' + (err.stack || err)); - if (err.ffmpegOut) { - console.log('---stdout---'); - console.log(err.ffmpegOut); - } - if (err.ffmpegErr) { - console.log('---stderr---'); - console.log(err.ffmpegErr); - } - if (err.spawnErr) { - console.log('---spawn error---'); - console.log(err.spawnErr.stack || err.spawnErr); - } - } - }, - - logError: function(err, stdout, stderr) { - if (err) { - console.log('got error: ' + (err.stack || err)); - if (err.ffmpegOut) { - console.log('---metadata stdout---'); - console.log(err.ffmpegOut); - } - if (err.ffmpegErr) { - console.log('---metadata stderr---'); - console.log(err.ffmpegErr); - } - if (err.spawnErr) { - console.log('---metadata spawn error---'); - console.log(err.spawnErr.stack || err.spawnErr); - } - if (stdout) { - console.log('---stdout---'); - console.log(stdout); - } - if (stderr) { - console.log('---stderr---'); - console.log(stderr); - } - } - }, - - logOutput: function(stdout, stderr) { - if (stdout) { - console.log('---stdout---'); - console.log(stdout); - } - if (stderr) { - console.log('---stderr---'); - console.log(stderr); - } - } -}; diff --git a/test/metadata.test.js b/test/metadata.test.js deleted file mode 100644 index ad879f97..00000000 --- a/test/metadata.test.js +++ /dev/null @@ -1,137 +0,0 @@ -/*jshint node:true*/ -/*global describe,it,before*/ -'use strict'; - -var Ffmpeg = require('../index'), - path = require('path'), - fs = require('fs'), - Readable = require('stream').Readable, - assert = require('assert'), - exec = require('child_process').exec, - testhelper = require('./helpers'); - - -describe('Metadata', function() { - before(function(done) { - // check for ffmpeg installation - this.testfile = path.join(__dirname, 'assets', 'testvideo-43.avi'); - - var self = this; - exec(testhelper.getFfmpegCheck(), function(err) { - if (!err) { - // check if file exists - fs.exists(self.testfile, function(exists) { - if (exists) { - done(); - } else { - done(new Error('test video file does not exist, check path (' + self.testfile + ')')); - } - }); - } else { - done(new Error('cannot run test without ffmpeg installed, aborting test...')); - } - }); - }); - - it('should provide an ffprobe entry point', function(done) { - (typeof Ffmpeg.ffprobe).should.equal('function'); - done(); - }); - - it('should return ffprobe data as an object', function(done) { - Ffmpeg.ffprobe(this.testfile, function(err, data) { - testhelper.logError(err); - assert.ok(!err); - - (typeof data).should.equal('object'); - done(); - }); - }); - - it('should provide ffprobe format information', function(done) { - Ffmpeg.ffprobe(this.testfile, function(err, data) { - testhelper.logError(err); - assert.ok(!err); - - ('format' in data).should.equal(true); - (typeof data.format).should.equal('object'); - Number(data.format.duration).should.equal(2); - data.format.format_name.should.equal('avi'); - - done(); - }); - }); - - it('should provide ffprobe stream information', function(done) { - Ffmpeg.ffprobe(this.testfile, function(err, data) { - testhelper.logError(err); - assert.ok(!err); - - ('streams' in data).should.equal(true); - Array.isArray(data.streams).should.equal(true); - data.streams.length.should.equal(1); - data.streams[0].codec_type.should.equal('video'); - data.streams[0].codec_name.should.equal('mpeg4'); - Number(data.streams[0].width).should.equal(1024); - - done(); - }); - }); - - it('should provide ffprobe stream information with units', function(done) { - Ffmpeg.ffprobe(this.testfile, ['-unit'], function(err, data) { - testhelper.logError(err); - assert.ok(!err); - - ('streams' in data).should.equal(true); - Array.isArray(data.streams).should.equal(true); - data.streams.length.should.equal(1); - data.streams[0].bit_rate.should.equal('322427 bit/s'); - done(); - }); - }); - - it('should return ffprobe errors', function(done) { - Ffmpeg.ffprobe('/path/to/missing/file', function(err) { - assert.ok(!!err); - done(); - }); - }); - - it('should enable calling ffprobe on a command with an input file', function(done) { - new Ffmpeg({ source: this.testfile }) - .ffprobe(function(err, data) { - testhelper.logError(err); - assert.ok(!err); - - (typeof data).should.equal('object'); - ('format' in data).should.equal(true); - (typeof data.format).should.equal('object'); - ('streams' in data).should.equal(true); - Array.isArray(data.streams).should.equal(true); - - done(); - }); - }); - - it('should fail calling ffprobe on a command without input', function(done) { - new Ffmpeg().ffprobe(function(err) { - assert.ok(!!err); - err.message.should.match(/No input specified/); - done(); - }); - }); - - it('should allow calling ffprobe on stream input', function(done) { - var stream = fs.createReadStream(this.testfile); - - new Ffmpeg() - .addInput(stream) - .ffprobe(function(err, data) { - assert.ok(!err); - data.streams.length.should.equal(1); - data.format.filename.should.equal('pipe:0'); - done(); - }); - }); -}); diff --git a/test/processor.test.js b/test/processor.test.js deleted file mode 100644 index 6b0f7a3a..00000000 --- a/test/processor.test.js +++ /dev/null @@ -1,1243 +0,0 @@ -/*jshint node:true*/ -/*global describe,it,before,after,beforeEach,afterEach*/ -'use strict'; - -var FfmpegCommand = require('../index'), - path = require('path'), - fs = require('fs'), - assert = require('assert'), - os = require('os').platform(), - exec = require('child_process').exec, - spawn = require('child_process').spawn, - async = require('async'), - stream = require('stream'), - testhelper = require('./helpers'); - - -var testHTTP = 'http://127.0.0.1:8090/test.mpg'; -var testRTSP = 'rtsp://127.0.0.1:5540/test-rtp.mpg'; -var testRTPOut = 'rtp://127.0.0.1:5540/input.mpg'; - - -/***************************************************************** - - IMPORTANT NOTE ABOUT PROCESSOR TESTS - - To ensure tests run reliably, you should do the following: - - * Any input file you use must be tested for existence before - running the tests. Use the 'prerequisite' function below and - add any new file there. - - * FfmpegCommands should be created using 'this.getCommand(args)' - in the test definition, not using 'new Ffmpegcommand(args)'. - This enables ensuring the command is finished before starting - the next test. - - * Any file your test is expected to create should have their full - path pushed to the 'this.files' array in the test definition, - and your test should *not* remove them on completion. The - cleanup hook will check all those files for existence and remove - them. - - * Same thing with directories in the 'this.dirs' array. - - * If you use intervals or timeouts, please ensure they have been - canceled (for intervals) or called (for timeouts) before - calling the test 'done()' callback. - - Not abiding by those rules is BAD. You have been warned :) - - *****************************************************************/ - - -describe('Processor', function() { - // check prerequisites once before all tests - before(function prerequisites(done) { - // check for ffmpeg installation - this.testdir = path.join(__dirname, 'assets'); - this.testfileName = 'testvideo-43.avi'; - this.testfile = path.join(this.testdir, this.testfileName); - this.testfilewide = path.join(this.testdir, 'testvideo-169.avi'); - this.testfilebig = path.join(this.testdir, 'testvideo-5m.mpg'); - this.testfilespecial = path.join(this.testdir, 'te[s]t_ video \' _ .flv'); - this.testfileaudio1 = path.join(this.testdir, 'testaudio-one.wav'); - this.testfileaudio2 = path.join(this.testdir, 'testaudio-two.wav'); - this.testfileaudio3 = path.join(this.testdir, 'testaudio-three.wav'); - - var self = this; - - exec(testhelper.getFfmpegCheck(), function(err) { - if (!err) { - // check if all test files exist - async.each([ - self.testfile, - self.testfilewide, - self.testfilebig, - self.testfilespecial, - self.testfileaudio1, - self.testfileaudio2, - self.testfileaudio3 - ], function(file, cb) { - fs.exists(file, function(exists) { - cb(exists ? null : new Error('test video file does not exist, check path (' + file + ')')); - }); - }, - done - ); - } else { - done(new Error('cannot run test without ffmpeg installed, aborting test...')); - } - }); - }); - - // cleanup helpers before and after all tests - beforeEach(function setup(done) { - var processes = this.processes = []; - var outputs = this.outputs = []; - - // Tests should call this so that created processes are watched - // for exit and checked during test cleanup - this.getCommand = function(args) { - var cmd = new FfmpegCommand(args); - cmd.on('start', function() { - processes.push(cmd.ffmpegProc); - - // Remove process when it exits - cmd.ffmpegProc.on('exit', function() { - processes.splice(processes.indexOf(cmd.ffmpegProc), 1); - }); - }); - - return cmd; - }; - - // Tests should call this to display stdout/stderr in case of error - this.saveOutput = function(stdout, stderr) { - outputs.unshift([stdout, stderr]); - }; - - this.files = []; - this.dirs = []; - - done(); - }); - - afterEach(function cleanup(done) { - var self = this; - - async.series([ - // Ensure every process has finished - function(cb) { - if (self.processes.length) { - if (self.outputs.length) { - testhelper.logOutput(self.outputs[0][0], self.outputs[0][1]); - } - - self.test.error(new Error(self.processes.length + ' processes still running after "' + self.currentTest.title + '"')); - cb(); - } else { - cb(); - } - }, - - // Ensure all created files are removed - function(cb) { - async.each(self.files, function(file, cb) { - fs.exists(file, function(exists) { - if (exists) { - fs.unlink(file, cb); - } else { - if (self.outputs.length) { - testhelper.logOutput(self.outputs[0][0], self.outputs[0][1]); - } - - self.test.error(new Error('Expected created file ' + file + ' by "' + self.currentTest.title + '"')); - cb(); - } - }); - }, cb); - }, - - // Ensure all created dirs are removed - function(cb) { - async.each(self.dirs, function(dir, cb) { - fs.exists(dir, function(exists) { - if (exists) { - fs.rmdir(dir, cb); - } else { - if (self.outputs.length) { - testhelper.logOutput(self.outputs[0][0], self.outputs[0][1]); - } - - self.test.error(new Error('Expected created directory ' + dir + ' by "' + self.currentTest.title + '"')); - cb(); - } - }); - }, cb); - } - ], - - done - ); - }); - - describe('Process controls', function() { - // Skip all niceness tests on windows - var skipNiceness = os.match(/win(32|64)/); - - var skipRenice = false; - - (skipNiceness ? it.skip : it)('should properly limit niceness', function() { - this.getCommand({ source: this.testfile, logger: testhelper.logger, timeout: 0.02 }) - .renice(100).options.niceness.should.equal(20); - }); - - ((skipNiceness || skipRenice) ? it.skip : it)('should dynamically renice process', function(done) { - this.timeout(60000); - - var testFile = path.join(__dirname, 'assets', 'testProcessRenice.avi'); - this.files.push(testFile); - - var ffmpegJob = this.getCommand({ source: this.testfilebig, logger: testhelper.logger, timeout: 2 }) - .usingPreset('divx'); - - var startCalled = false; - var reniced = false; - - ffmpegJob - .on('start', function() { - startCalled = true; - setTimeout(function() { - ffmpegJob.renice(5); - - setTimeout(function() { - exec('ps -p ' + ffmpegJob.ffmpegProc.pid + ' -o ni=', function(err, stdout) { - assert.ok(!err); - parseInt(stdout, 10).should.equal(5); - reniced = true; - }); - }, 500); - }, 500); - - ffmpegJob.ffmpegProc.on('exit', function() { - reniced.should.equal(true); - done(); - }); - }) - .on('error', function() { - reniced.should.equal(true); - startCalled.should.equal(true); - }) - .on('end', function() { - console.log('end was called, expected a timeout'); - assert.ok(false); - done(); - }) - .saveToFile(testFile); - }); - - it('should change the working directory', function(done) { - var testFile = path.join(this.testdir, 'testvideo.avi'); - this.files.push(testFile); - - this.getCommand({ source: this.testfileName, logger: testhelper.logger, cwd: this.testdir }) - .usingPreset('divx') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function() { - done(); - }) - .saveToFile(testFile); - }); - - it('should kill the process on timeout', function(done) { - var testFile = path.join(__dirname, 'assets', 'testProcessKillTimeout.avi'); - this.files.push(testFile); - - var command = this.getCommand({ source: this.testfilebig, logger: testhelper.logger, timeout: 1}); - var self = this; - - command - .usingPreset('divx') - .on('start', function() { - command.ffmpegProc.on('exit', function() { - done(); - }); - }) - .on('error', function(err, stdout, stderr) { - self.saveOutput(stdout, stderr); - err.message.indexOf('timeout').should.not.equal(-1); - }) - .on('end', function() { - console.log('end was called, expected a timeout'); - assert.ok(false); - done(); - }) - .saveToFile(testFile); - }); - - it('should not keep node process running on completion', function(done) { - var script = ` - var ffmpeg = require('.'); - ffmpeg('${this.testfilebig}', { timeout: 60 }) - .addOption('-t', 1) - .addOption('-f', 'null') - .saveToFile('/dev/null'); - `; - - exec(`node -e "${script}"`, { timeout: 1000 }, done); - }); - - it('should kill the process with .kill', function(done) { - var testFile = path.join(__dirname, 'assets', 'testProcessKill.avi'); - this.files.push(testFile); - - var ffmpegJob = this.getCommand({ source: this.testfilebig, logger: testhelper.logger }) - .usingPreset('divx'); - - var startCalled = false; - var errorCalled = false; - - ffmpegJob - .on('start', function() { - startCalled = true; - setTimeout(function() { ffmpegJob.kill(); }, 500); - ffmpegJob.ffmpegProc.on('exit', function() { - setTimeout(function() { - errorCalled.should.equal(true); - done(); - }, 1000); - }); - }) - .on('error', function(err) { - err.message.indexOf('ffmpeg was killed with signal SIGKILL').should.not.equal(-1); - startCalled.should.equal(true); - errorCalled = true; - }) - .on('end', function() { - console.log('end was called, expected an error'); - assert.ok(false); - done(); - }) - .saveToFile(testFile); - }); - - it('should send the process custom signals with .kill(signal)', function(done) { - this.timeout(60000); - - var testFile = path.join(__dirname, 'assets', 'testProcessKillCustom.avi'); - this.files.push(testFile); - - var ffmpegJob = this.getCommand({ source: this.testfilebig, logger: testhelper.logger, timeout: 2 }) - .usingPreset('divx'); - - var startCalled = true; - var errorCalled = false; - ffmpegJob - .on('start', function() { - startCalled = true; - - setTimeout(function() { ffmpegJob.kill('SIGSTOP'); }, 500); - - ffmpegJob.ffmpegProc.on('exit', function() { - errorCalled.should.equal(true); - done(); - }); - }) - .on('error', function(err) { - startCalled.should.equal(true); - err.message.indexOf('timeout').should.not.equal(-1); - - errorCalled = true; - ffmpegJob.kill('SIGCONT'); - }) - .on('end', function() { - console.log('end was called, expected a timeout'); - assert.ok(false); - done(); - }) - .saveToFile(testFile); - - }); - }); - - describe('Events', function() { - it('should report codec data through \'codecData\' event', function(done) { - this.timeout(60000); - - var testFile = path.join(__dirname, 'assets', 'testOnCodecData.avi'); - this.files.push(testFile); - - this.getCommand({ source: this.testfilebig, logger: testhelper.logger }) - .on('codecData', function(data) { - data.should.have.property('audio'); - data.should.have.property('video'); - }) - .usingPreset('divx') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function() { - done(); - }) - .saveToFile(testFile); - }); - - it('should report codec data through \'codecData\' event on piped inputs', function(done) { - this.timeout(60000); - - var testFile = path.join(__dirname, 'assets', 'testOnCodecData.avi') - this.files.push(testFile); - - this.getCommand({ source: fs.createReadStream(this.testfilebig), logger: testhelper.logger }) - .on('codecData', function(data) { - data.should.have.property('audio'); - data.should.have.property('video'); - }) - .usingPreset('divx') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function() { - done(); - }) - .saveToFile(testFile); - }); - - it('should report codec data through \'codecData\' for multiple inputs', function(done) { - this.timeout(60000); - - var testFile = path.join(__dirname, 'assets', 'testOnCodecData.wav') - this.files.push(testFile); - - this.getCommand({ logger: testhelper.logger }) - .input(this.testfileaudio1) - .input(this.testfileaudio2) - .on('codecData', function(data1, data2) { - data1.should.have.property('audio'); - data2.should.have.property('audio'); - }) - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function() { - done(); - }) - .mergeToFile(testFile); - }); - - it('should report progress through \'progress\' event', function(done) { - this.timeout(60000); - - var testFile = path.join(__dirname, 'assets', 'testOnProgress.avi'); - var gotProgress = false; - - this.files.push(testFile); - - this.getCommand({ source: this.testfilebig, logger: testhelper.logger }) - .on('progress', function() { - gotProgress = true; - }) - .usingPreset('divx') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function() { - gotProgress.should.equal(true); - done(); - }) - .saveToFile(testFile); - }); - - it('should report start of ffmpeg process through \'start\' event', function(done) { - this.timeout(60000); - - var testFile = path.join(__dirname, 'assets', 'testStart.avi'); - var startCalled = false; - - this.files.push(testFile); - - this.getCommand({ source: this.testfilebig, logger: testhelper.logger }) - .on('start', function(cmdline) { - startCalled = true; - - // Only test a subset of command line - cmdline.indexOf('ffmpeg').should.equal(0); - cmdline.indexOf('testvideo-5m').should.not.equal(-1); - cmdline.indexOf('-b:a 128k').should.not.equal(-1); - }) - .usingPreset('divx') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function() { - startCalled.should.equal(true); - done(); - }) - .saveToFile(testFile); - }); - - it('should report output lines through \'stderr\' event', function(done) { - this.timeout(60000); - - var testFile = path.join(__dirname, 'assets', 'testStderr.avi'); - var lines = []; - - this.files.push(testFile); - - this.getCommand({ source: this.testfile, logger: testhelper.logger }) - .on('stderr', function(line) { - lines.push(line); - }) - .usingPreset('divx') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function() { - lines.length.should.above(0); - lines[0].should.startWith('ffmpeg version'); - lines.filter(function(l) { return l.indexOf('Press [q]') === 0. }).length.should.above(0); - done(); - }) - .saveToFile(testFile); - }); - }); - - describe('Output limiting', function() { - it('should limit stdout/stderr lines', function(done) { - this.timeout(60000); - - var testFile = path.join(__dirname, 'assets', 'testLimit10.avi'); - - this.files.push(testFile); - - this.getCommand({ stdoutLines: 10, source: this.testfile, logger: testhelper.logger }) - .usingPreset('divx') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function(stdout, stderr) { - stdout.split('\n').length.should.below(11); - stderr.split('\n').length.should.below(11); - done(); - }) - .saveToFile(testFile); - }); - }); - - describe('takeScreenshots', function() { - function testScreenshots(title, name, config, files) { - it(title, function(done) { - var filenamesCalled = false; - var testFolder = path.join(__dirname, 'assets', 'screenshots_' + name); - - var context = this; - files.forEach(function(file) { - context.files.push(path.join(testFolder, file)); - }); - this.dirs.push(testFolder); - - this.getCommand({ source: this.testfile, logger: testhelper.logger }) - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('filenames', function(filenames) { - filenamesCalled = true; - filenames.length.should.equal(files.length); - filenames.forEach(function(file, index) { - file.should.equal(files[index]); - }); - }) - .on('end', function() { - filenamesCalled.should.equal(true); - fs.readdir(testFolder, function(err, content) { - var tnCount = 0; - content.forEach(function(file) { - if (file.indexOf('.png') > -1) { - tnCount++; - } - }); - tnCount.should.equal(files.length); - files.forEach(function(file) { - content.indexOf(file).should.not.equal(-1); - }); - done(); - }); - }) - .takeScreenshots(config, testFolder); - }); - } - - testScreenshots( - 'should take screenshots from a list of number timemarks', - 'timemarks_num', - { timemarks: [ 0.5, 1 ] }, - ['tn_1.png', 'tn_2.png'] - ); - - testScreenshots( - 'should take screenshots from a list of string timemarks', - 'timemarks_string', - { timemarks: [ '0.5', '1' ] }, - ['tn_1.png', 'tn_2.png'] - ); - - testScreenshots( - 'should take screenshots from a list of string timemarks', - 'timemarks_hms', - { timemarks: [ '00:00:00.500', '00:01' ] }, - ['tn_1.png', 'tn_2.png'] - ); - - testScreenshots( - 'should support "timestamps" instead of "timemarks"', - 'timestamps', - { timestamps: [ 0.5, 1 ] }, - ['tn_1.png', 'tn_2.png'] - ); - - testScreenshots( - 'should replace %i with the screenshot index', - 'filename_i', - { timemarks: [ 0.5, 1 ], filename: 'shot_%i.png' }, - ['shot_1.png', 'shot_2.png'] - ); - - testScreenshots( - 'should replace %000i with the padded screenshot index', - 'filename_0i', - { timemarks: [ 0.5, 1 ], filename: 'shot_%000i.png' }, - ['shot_0001.png', 'shot_0002.png'] - ); - - testScreenshots( - 'should replace %s with the screenshot timestamp', - 'filename_s', - { timemarks: [ 0.5, '40%', 1 ], filename: 'shot_%s.png' }, - ['shot_0.5.png', 'shot_0.8.png', 'shot_1.png'] - ); - - testScreenshots( - 'should replace %f with the input filename', - 'filename_f', - { timemarks: [ 0.5, 1 ], filename: 'shot_%f_%i.png' }, - ['shot_testvideo-43.avi_1.png', 'shot_testvideo-43.avi_2.png'] - ); - - testScreenshots( - 'should replace %b with the input basename', - 'filename_b', - { timemarks: [ 0.5, 1 ], filename: 'shot_%b_%i.png' }, - ['shot_testvideo-43_1.png', 'shot_testvideo-43_2.png'] - ); - - testScreenshots( - 'should replace %r with the output resolution', - 'filename_r', - { timemarks: [ 0.5, 1 ], filename: 'shot_%r_%i.png' }, - ['shot_1024x768_1.png', 'shot_1024x768_2.png'] - ); - - testScreenshots( - 'should replace %w and %h with the output resolution', - 'filename_wh', - { timemarks: [ 0.5, 1 ], filename: 'shot_%wx%h_%i.png' }, - ['shot_1024x768_1.png', 'shot_1024x768_2.png'] - ); - - testScreenshots( - 'should automatically add %i when no variable replacement is present', - 'filename_add_i', - { timemarks: [ 0.5, 1 ], filename: 'shot_%b.png' }, - ['shot_testvideo-43_1.png', 'shot_testvideo-43_2.png'] - ); - - testScreenshots( - 'should automatically compute timestamps from the "count" option', - 'count', - { count: 3, filename: 'shot_%s.png' }, - ['shot_0.5.png', 'shot_1.png', 'shot_1.5.png'] - ); - - testScreenshots( - 'should enable setting screenshot size', - 'size', - { count: 3, filename: 'shot_%r.png', size: '150x?' }, - ['shot_150x112_1.png', 'shot_150x112_2.png', 'shot_150x112_3.png'] - ); - - testScreenshots( - 'a single screenshot should not have a _1 file name suffix', - 'no_suffix', - { timemarks: [ 0.5 ] }, - ['tn.png'] - ); - }); - - describe('saveToFile', function() { - it('should save the output file properly to disk', function(done) { - var testFile = path.join(__dirname, 'assets', 'testConvertToFile.avi'); - this.files.push(testFile); - - this.getCommand({ source: this.testfile, logger: testhelper.logger }) - .usingPreset('divx') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function() { - fs.exists(testFile, function(exist) { - exist.should.equal(true); - // check filesize to make sure conversion actually worked - fs.stat(testFile, function(err, stats) { - assert.ok(!err && stats); - - stats.size.should.above(0); - stats.isFile().should.equal(true); - - done(); - }); - }); - }) - .saveToFile(testFile); - }); - - it('should save an output file with special characters properly to disk', function(done) { - var testFile = path.join(__dirname, 'assets', 'te[s]t video \' " .avi'); - this.files.push(testFile); - - this.getCommand({ source: this.testfile, logger: testhelper.logger }) - .usingPreset('divx') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function() { - done(); - }) - .saveToFile(testFile); - }); - - it('should save output files with special characters', function(done) { - var testFile = path.join(__dirname, 'assets', '[test "special \' char*cters \n.avi'); - this.files.push(testFile); - - this.getCommand({ source: this.testfile, logger: testhelper.logger }) - .usingPreset('divx') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function() { - fs.exists(testFile, function(exist) { - exist.should.equal(true); - // check filesize to make sure conversion actually worked - fs.stat(testFile, function(err, stats) { - assert.ok(!err && stats); - stats.size.should.above(0); - stats.isFile().should.equal(true); - - done(); - }); - }); - }) - .saveToFile(testFile); - }); - - it('should accept a stream as its source', function(done) { - var testFile = path.join(__dirname, 'assets', 'testConvertFromStreamToFile.avi'); - this.files.push(testFile); - - var instream = fs.createReadStream(this.testfile); - this.getCommand({ source: instream, logger: testhelper.logger }) - .usingPreset('divx') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function() { - fs.exists(testFile, function(exist) { - exist.should.equal(true); - // check filesize to make sure conversion actually worked - fs.stat(testFile, function(err, stats) { - assert.ok(!err && stats); - stats.size.should.above(0); - stats.isFile().should.equal(true); - - done(); - }); - }); - }) - .saveToFile(testFile); - }); - - it('should pass input stream errors through to error handler', function(done) { - var testFile = path.join(__dirname, 'assets', 'testConvertFromStream.avi') - - const readError = new Error('Read Error') - const instream = new (require('stream').Readable)({ - read() { - process.nextTick(() => this.emit('error', readError)) - } - }) - - const command = this.getCommand({ source: instream, logger: testhelper.logger }) - - let startCalled = false - const self = this - - command - .usingPreset('divx') - .on('start', function() { - startCalled = true - command.ffmpegProc.on('exit', function() { - fs.exists(testFile, (exists) => { - exists.should.be.false() - done() - }) - }) - }) - .on('error', function(err, stdout, stderr) { - self.saveOutput(stdout, stderr) - startCalled.should.be.true() - assert.ok(err) - err.message.indexOf('Input stream error: ').should.equal(0) - assert.strictEqual(err.inputStreamError, readError) - }) - .on('end', function(stdout, stderr) { - testhelper.logOutput(stdout, stderr) - console.log('end was called, expected a error') - assert.ok(false) - done() - }) - .saveToFile(testFile) - }) - }); - - describe('mergeToFile', function() { - - it('should merge multiple files', function(done) { - var testFile = path.join(__dirname, 'assets', 'testMergeAddOption.wav'); - this.files.push(testFile); - - this.getCommand({source: this.testfileaudio1, logger: testhelper.logger}) - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function() { - fs.exists(testFile, function(exist) { - exist.should.equal(true); - // check filesize to make sure conversion actually worked - fs.stat(testFile, function(err, stats) { - assert.ok(!err && stats); - stats.size.should.above(0); - stats.isFile().should.equal(true); - - done(); - }); - }); - }) - .mergeAdd(this.testfileaudio2) - .mergeAdd(this.testfileaudio3) - .mergeToFile(testFile); - }); - }); - - describe('writeToStream', function() { - it('should save the output file properly to disk using a stream', function(done) { - var testFile = path.join(__dirname, 'assets', 'testConvertToStream.avi'); - this.files.push(testFile); - - var outstream = fs.createWriteStream(testFile); - this.getCommand({ source: this.testfile, logger: testhelper.logger }) - .usingPreset('divx') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function(stdout, stderr) { - fs.exists(testFile, function(exist) { - if (!exist) { - console.log(stderr); - } - - exist.should.equal(true); - - // check filesize to make sure conversion actually worked - fs.stat(testFile, function(err, stats) { - assert.ok(!err && stats); - stats.size.should.above(0); - stats.isFile().should.equal(true); - - done(); - }); - }); - }) - .writeToStream(outstream, {end:true}); - }); - - it('should accept a stream as its source', function(done) { - var testFile = path.join(__dirname, 'assets', 'testConvertFromStreamToStream.avi'); - this.files.push(testFile); - - var instream = fs.createReadStream(this.testfile); - var outstream = fs.createWriteStream(testFile); - - this.getCommand({ source: instream, logger: testhelper.logger }) - .usingPreset('divx') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function(stdout,stderr) { - fs.exists(testFile, function(exist) { - if (!exist) { - console.log(stderr); - } - - exist.should.equal(true); - // check filesize to make sure conversion actually worked - fs.stat(testFile, function(err, stats) { - assert.ok(!err && stats); - stats.size.should.above(0); - stats.isFile().should.equal(true); - - done(); - }); - }); - }) - .writeToStream(outstream); - }); - - (process.version.match(/v0\.8\./) ? it.skip : it)('should return a PassThrough stream when called with no arguments on node >=0.10', function(done) { - var testFile = path.join(__dirname, 'assets', 'testConvertToStream.avi'); - this.files.push(testFile); - - var outstream = fs.createWriteStream(testFile); - var command = this.getCommand({ source: this.testfile, logger: testhelper.logger }); - - command - .usingPreset('divx') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function(stdout, stderr) { - fs.exists(testFile, function(exist) { - if (!exist) { - console.log(stderr); - } - - exist.should.equal(true); - - // check filesize to make sure conversion actually worked - fs.stat(testFile, function(err, stats) { - assert.ok(!err && stats); - stats.size.should.above(0); - stats.isFile().should.equal(true); - - done(); - }); - }); - }); - - var passthrough = command.writeToStream({end: true}); - - passthrough.should.instanceof(stream.PassThrough); - passthrough.pipe(outstream); - }); - - (process.version.match(/v0\.8\./) ? it : it.skip)('should throw an error when called with no arguments on node 0.8', function() { - (function() { - new FfmpegCommand().writeToStream({end: true}); - }).should.throw(/PassThrough stream is not supported on node v0.8/); - }); - - it('should pass output stream errors through to error handler', function(done) { - - const writeError = new Error('Write Error') - const outstream = new (require('stream').Writable)({ - write(chunk, encoding, callback) { - callback(writeError) - } - }) - - const command = this.getCommand({ source: this.testfile, logger: testhelper.logger }) - - let startCalled = false - const self = this - - command - .usingPreset('divx') - .on('start', function() { - startCalled = true - command.ffmpegProc.on('exit', function() { - done() - }) - }) - .on('error', function(err, stdout, stderr) { - self.saveOutput(stdout, stderr) - startCalled.should.be.true() - assert.ok(err) - err.message.indexOf('Output stream error: ').should.equal(0) - assert.strictEqual(err.outputStreamError, writeError) - }) - .on('end', function(stdout, stderr) { - console.log('end was called, expected a error') - testhelper.logOutput(stdout, stderr) - assert.ok(false) - done() - }) - .writeToStream(outstream) - }) - }); - - describe('Outputs', function() { - it('should create multiple outputs', function(done) { - this.timeout(30000); - - var testFile1 = path.join(__dirname, 'assets', 'testMultipleOutput1.avi'); - this.files.push(testFile1); - var testFile2 = path.join(__dirname, 'assets', 'testMultipleOutput2.avi'); - this.files.push(testFile2); - var testFile3 = path.join(__dirname, 'assets', 'testMultipleOutput3.mp4'); - this.files.push(testFile3); - - this.getCommand({ source: this.testfilebig, logger: testhelper.logger }) - .output(testFile1) - .withAudioCodec('vorbis') - .withVideoCodec('copy') - .output(testFile2) - .withAudioCodec('libmp3lame') - .withVideoCodec('copy') - .output(testFile3) - .withSize('160x120') - .withAudioCodec('aac') - .withVideoCodec('libx264') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function() { - async.map( - [testFile1, testFile2, testFile3], - function(file, cb) { - fs.exists(file, function(exist) { - exist.should.equal(true); - - // check filesize to make sure conversion actually worked - fs.stat(file, function(err, stats) { - assert.ok(!err && stats); - stats.size.should.above(0); - stats.isFile().should.equal(true); - - cb(err); - }); - }); - }, - function(err) { - testhelper.logError(err); - assert.ok(!err); - done(); - } - ); - }) - .run(); - }); - }); - - describe('Inputs', function() { - it('should take input from a file with special characters', function(done) { - var testFile = path.join(__dirname, 'assets', 'testSpecialInput.avi'); - this.files.push(testFile); - - this.getCommand({ source: this.testfilespecial, logger: testhelper.logger, timeout: 10 }) - .takeFrames(50) - .usingPreset('divx') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function() { - fs.exists(testFile, function(exist) { - exist.should.equal(true); - // check filesize to make sure conversion actually worked - fs.stat(testFile, function(err, stats) { - assert.ok(!err && stats); - stats.size.should.above(0); - stats.isFile().should.equal(true); - - done(); - }); - }); - }) - .saveToFile(testFile); - }); - }); - - describe.skip('Remote I/O', function() { - this.timeout(60000); - - var ffserver; - - before(function(done) { - testhelper.logger.debug('spawning ffserver'); - ffserver = spawn( - 'ffserver', - ['-d','-f', path.join(__dirname, 'assets', 'ffserver.conf')], - { cwd: path.join(__dirname, 'assets') } - ); - - // Wait for ffserver to be ready - var isready = false; - function ready() { - if (!isready) { - testhelper.logger.debug('ffserver is ready'); - isready = true; - done(); - } - } - - ffserver.stdout.on('data', function(d) { - if (d.toString().match(/server started/i)) { - ready(); - } - }); - - ffserver.stderr.on('data', function(d) { - if (d.toString().match(/server started/i)) { - ready(); - } - }); - - }); - - beforeEach(function(done) { - setTimeout(done, 5000); - }); - - after(function(done) { - ffserver.kill(); - setTimeout(done, 1000); - }); - - it('should take input from a RTSP stream', function(done) { - var testFile = path.join(__dirname, 'assets', 'testRTSPInput.avi'); - this.files.push(testFile); - - this.getCommand({ source: encodeURI(testRTSP), logger: testhelper.logger, timeout: 0 }) - .takeFrames(10) - .usingPreset('divx') - .withSize('320x240') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function() { - fs.exists(testFile, function(exist) { - exist.should.equal(true); - // check filesize to make sure conversion actually worked - fs.stat(testFile, function(err, stats) { - assert.ok(!err && stats); - stats.size.should.above(0); - stats.isFile().should.equal(true); - - done(); - }); - }); - }) - .saveToFile(testFile); - }); - - it('should take input from an URL', function(done) { - var testFile = path.join(__dirname, 'assets', 'testURLInput.avi'); - this.files.push(testFile); - - this.getCommand({ source: testHTTP, logger: testhelper.logger, timeout: 0 }) - .takeFrames(5) - .usingPreset('divx') - .withSize('320x240') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function() { - fs.exists(testFile, function(exist) { - exist.should.equal(true); - // check filesize to make sure conversion actually worked - fs.stat(testFile, function(err, stats) { - assert.ok(!err && stats); - stats.size.should.above(0); - stats.isFile().should.equal(true); - - done(); - }); - }); - }) - .saveToFile(testFile); - }); - - it('should output to a RTP stream', function(done) { - this.getCommand({ source: this.testfilebig, logger: testhelper.logger }) - .videoCodec('libx264') - .audioCodec('copy') - .on('error', function(err, stdout, stderr) { - testhelper.logError(err, stdout, stderr); - assert.ok(!err); - }) - .on('end', function() { - done(); - }) - .save(testRTPOut); - }); - }); - - describe('Errors', function() { - it('should report an error when ffmpeg has been killed', function(done) { - this.timeout(10000); - - var testFile = path.join(__dirname, 'assets', 'testErrorKill.avi'); - this.files.push(testFile); - - var command = this.getCommand({ source: this.testfilebig, logger: testhelper.logger }); - - command - .usingPreset('divx') - .on('start', function() { - setTimeout(function() { - command.kill('SIGKILL'); - }, 1000); - }) - .on('error', function(err) { - err.message.should.match(/ffmpeg was killed with signal SIGKILL/); - done(); - }) - .on('end', function() { - assert.ok(false); - }) - .saveToFile(testFile); - }); - - it('should report ffmpeg errors', function(done) { - this.getCommand({ source: this.testfilebig, logger: testhelper.logger }) - .addOption('-invalidoption') - .on('error', function(err) { - setTimeout(done, 1000); - err.message.should.match(/Unrecognized option 'invalidoption'/); - }) - .saveToFile('/will/not/be/created/anyway'); - }); - }); -}); diff --git a/test/utils.test.js b/test/utils.test.js deleted file mode 100644 index 5c987404..00000000 --- a/test/utils.test.js +++ /dev/null @@ -1,206 +0,0 @@ -/*jshint node:true*/ -/*global describe,it*/ -'use strict'; - -var utils = require('../lib/utils'); - -describe('Utilities', function() { - - describe('Argument list helper', function() { - it('Should add arguments to the list', function() { - var args = utils.args(); - - args('-one'); - args('-two', 'two-param'); - args('-three', 'three-param1', 'three-param2'); - args(['-four', 'four-param', '-five', '-five-param']); - - args.get().length.should.equal(10); - }); - - it('Should return the argument list', function() { - var args = utils.args(); - - args('-one'); - args('-two', 'two-param'); - args('-three', 'three-param1', 'three-param2'); - args(['-four', 'four-param', '-five', '-five-param']); - - var arr = args.get(); - Array.isArray(arr).should.equal(true); - arr.length.should.equal(10); - arr.indexOf('-three').should.equal(3); - arr.indexOf('four-param').should.equal(7); - }); - - it('Should clear the argument list', function() { - var args = utils.args(); - - args('-one'); - args('-two', 'two-param'); - args('-three', 'three-param1', 'three-param2'); - args(['-four', 'four-param', '-five', '-five-param']); - args.clear(); - - args.get().length.should.equal(0); - }); - - it('Should retrieve arguments from the list', function() { - var args = utils.args(); - - args('-one'); - args('-two', 'two-param'); - args('-three', 'three-param1', 'three-param2'); - args(['-four', 'four-param', '-five', '-five-param']); - - var one = args.find('-one'); - Array.isArray(one).should.equal(true); - one.length.should.equal(0); - - var two = args.find('-two', 1); - Array.isArray(two).should.equal(true); - two.length.should.equal(1); - two[0].should.equal('two-param'); - - var three = args.find('-three', 2); - Array.isArray(three).should.equal(true); - three.length.should.equal(2); - three[0].should.equal('three-param1'); - three[1].should.equal('three-param2'); - - var nope = args.find('-nope', 2); - (typeof nope).should.equal('undefined'); - }); - - it('Should remove arguments from the list', function() { - var args = utils.args(); - - args('-one'); - args('-two', 'two-param'); - args('-three', 'three-param1', 'three-param2'); - args(['-four', 'four-param', '-five', '-five-param']); - - args.remove('-four', 1); - var arr = args.get(); - arr.length.should.equal(8); - arr[5].should.equal('three-param2'); - arr[6].should.equal('-five'); - - args.remove('-one'); - arr = args.get(); - arr.length.should.equal(7); - arr[0].should.equal('-two'); - - args.remove('-three', 2); - arr = args.get(); - arr.length.should.equal(4); - arr[1].should.equal('two-param'); - arr[2].should.equal('-five'); - }); - }); - - describe('timemarkToSeconds', function() { - it('should correctly convert a simple timestamp', function() { - utils.timemarkToSeconds('00:02:00.00').should.be.equal(120); - }); - it('should correctly convert a complex timestamp', function() { - utils.timemarkToSeconds('00:08:09.10').should.be.equal(489.1); - }); - it('should correclty convert a simple float string timestamp', function() { - utils.timemarkToSeconds('132.44').should.be.equal(132.44); - }); - it('should correclty convert a simple float timestamp', function() { - utils.timemarkToSeconds(132.44).should.be.equal(132.44); - }); - }); - - describe('Lines ring buffer', function() { - it('should append lines', function() { - var ring = utils.linesRing(100); - ring.append('foo\nbar\nbaz\n'); - ring.append('foo\nbar\nbaz\n'); - ring.get().should.equal('foo\nbar\nbaz\nfoo\nbar\nbaz\n'); - }); - - it('should append partial lines', function() { - var ring = utils.linesRing(100); - ring.append('foo'); - ring.append('bar\nbaz'); - ring.append('moo'); - ring.get().should.equal('foobar\nbazmoo'); - }); - - it('should call line callbacks', function() { - var lines = []; - function cb(l) { - lines.push(l); - } - - var lines2 = []; - function cb2(l) { - lines2.push(l); - } - - var ring = utils.linesRing(100); - ring.callback(cb); - ring.callback(cb2); - - ring.append('foo\nbar\nbaz'); - lines.length.should.equal(2); - lines[0].should.equal('foo'); - lines[1].should.equal('bar'); - - lines2.length.should.equal(2); - lines2[0].should.equal('foo'); - lines2[1].should.equal('bar'); - - ring.append('moo\nmeow\n'); - lines.length.should.equal(4); - lines[2].should.equal('bazmoo'); - lines[3].should.equal('meow'); - - lines2.length.should.equal(4); - lines2[2].should.equal('bazmoo'); - lines2[3].should.equal('meow'); - }); - - it('should close correctly', function() { - var lines = []; - function cb(l) { - lines.push(l); - } - - var ring = utils.linesRing(100); - ring.callback(cb); - - ring.append('foo\nbar\nbaz'); - lines.length.should.equal(2); - lines[0].should.equal('foo'); - lines[1].should.equal('bar'); - - ring.close(); - lines.length.should.equal(3); - lines[2].should.equal('baz'); - - ring.append('moo\nmeow\n'); - lines.length.should.equal(3); - ring.get().should.equal('foo\nbar\nbaz'); - }); - - it('should limit lines', function() { - var ring = utils.linesRing(2); - ring.append('foo\nbar\nbaz'); - ring.get().should.equal('bar\nbaz'); - ring.append('foo\nbar'); - ring.get().should.equal('bazfoo\nbar'); - }); - - it('should allow unlimited lines', function() { - var ring = utils.linesRing(0); - ring.append('foo\nbar\nbaz'); - ring.get().should.equal('foo\nbar\nbaz'); - ring.append('foo\nbar'); - ring.get().should.equal('foo\nbar\nbazfoo\nbar'); - }); - }); -}); diff --git a/tests/assets/output.mp4 b/tests/assets/output.mp4 new file mode 100644 index 00000000..e69de29b diff --git a/test/assets/testvideo-5m.mpg b/tests/assets/testvideo-5m.mpg similarity index 100% rename from test/assets/testvideo-5m.mpg rename to tests/assets/testvideo-5m.mpg diff --git a/tests/integration/dummy.ts b/tests/integration/dummy.ts new file mode 100644 index 00000000..21bf89c0 --- /dev/null +++ b/tests/integration/dummy.ts @@ -0,0 +1,3 @@ +import test from 'ava' + +test('dummy', (t) => t.pass()) diff --git a/tests/unit/capabilities-test.ts b/tests/unit/capabilities-test.ts new file mode 100644 index 00000000..1ca7a169 --- /dev/null +++ b/tests/unit/capabilities-test.ts @@ -0,0 +1,144 @@ +import test from 'ava' +import sinon from 'sinon' + +import { FfmpegCapabilities } from '../../src/capabilities' +import * as processModule from '../../src/process' + +const FfmpegProcessStub = sinon.stub(processModule, 'FfmpegProcess') + +test.afterEach(() => { + FfmpegProcessStub.reset() +}) + +test.serial('FfmpegCapabilities codecs', async (t) => { + FfmpegProcessStub.returns({ + async run() { + return { + stdout: [ + 'not a codecs line', + 'DEVILS codec1 first codec', + '.EA.L. codec2 encode only audio lossy', + 'D.S..S codec3 decode only subtitle lossless', + '.ED... codec4 stuff (encoders: foo bar)', + 'D.T... codec5 things (decoders: foo bar)', + 'not a codecs line either' + ].join('\n') + } + } + }) + + let caps = new FfmpegCapabilities() + let result = await caps.codecs() + + t.true( + FfmpegProcessStub.calledOnceWith({ args: ['-codecs'], captureStdout: true }) + ) + + let expected = { + codec1: { + canDecode: true, + canEncode: true, + description: 'first codec', + intraFrame: true, + lossless: true, + lossy: true, + type: 'video' + }, + codec2: { + canDecode: false, + canEncode: true, + description: 'encode only audio lossy', + intraFrame: false, + lossless: false, + lossy: true, + type: 'audio' + }, + codec3: { + canDecode: true, + canEncode: false, + description: 'decode only subtitle lossless', + intraFrame: false, + lossless: true, + lossy: false, + type: 'subtitle' + }, + codec4: { + canDecode: false, + canEncode: true, + encoders: ['foo', 'bar'], + description: 'stuff', + intraFrame: false, + lossless: false, + lossy: false, + type: 'data' + }, + codec5: { + canDecode: true, + decoders: ['foo', 'bar'], + canEncode: false, + description: 'things', + intraFrame: false, + lossless: false, + lossy: false, + type: 'attachment' + } + } + + t.deepEqual(result, expected) + + result = await caps.codecs() + + t.deepEqual(result, expected) + t.true(FfmpegProcessStub.calledOnce, 'results are cached') +}) + +test.serial('FfmpegCapabilities formats', async (t) => { + FfmpegProcessStub.returns({ + async run() { + return { + stdout: [ + 'not a format line', + 'DE format1 first format', + ' E format2 second format', + 'D format3 third format', + 'not a format line either' + ].join('\n') + } + } + }) + + let caps = new FfmpegCapabilities() + let result = await caps.formats() + + t.true( + FfmpegProcessStub.calledOnceWith({ + args: ['-formats'], + captureStdout: true + }) + ) + + let expected = { + format1: { + description: 'first format', + canMux: true, + canDemux: true + }, + format2: { + description: 'second format', + canMux: true, + canDemux: false + }, + format3: { + description: 'third format', + canMux: false, + canDemux: true + } + } + + t.deepEqual(result, expected) + + result = await caps.formats() + + t.deepEqual(result, expected) + t.true(FfmpegProcessStub.calledOnce, 'results are cached') +}) diff --git a/tests/unit/input-test.ts b/tests/unit/input-test.ts new file mode 100644 index 00000000..cf0c1f4f --- /dev/null +++ b/tests/unit/input-test.ts @@ -0,0 +1,116 @@ +import test from 'ava' +import { createReadStream } from 'fs' + +import { FfmpegInput } from '../../src/input' + +const stream = createReadStream('tests/assets/testvideo-5m.mpg') + +test('FfmpegInput from InputOptions', (t) => { + let input = new FfmpegInput({ + source: 'path/to/file.mp4' + }) + + t.deepEqual( + input.getFfmpegArguments(), + ['-i', 'path/to/file.mp4'], + 'source only' + ) + + input = new FfmpegInput({ + source: 'source', + fps: 'native' + }) + + t.deepEqual(input.getFfmpegArguments(), ['-re', '-i', 'source'], 'native fps') + + input = new FfmpegInput({ + source: 'source', + fps: 123 + }) + + t.deepEqual( + input.getFfmpegArguments(), + ['-r', '123', '-i', 'source'], + 'numeric fps' + ) + + input = new FfmpegInput({ + source: stream, + format: 'markdown' + }) + + t.deepEqual(input.getFfmpegArguments(), ['-f', 'markdown', '-i', 'pipe:0']) + + input = new FfmpegInput({ + source: 'path/to/file.mp4', + format: 'some-format', + fps: 123, + seek: 456, + loop: true + }) + + t.deepEqual( + input.getFfmpegArguments(), + [ + '-f', + 'some-format', + '-r', + '123', + '-ss', + '456', + '-loop', + '1', + '-i', + 'path/to/file.mp4' + ], + 'complete test' + ) +}) + +test('FfmpegInput from source', (t) => { + let input = new FfmpegInput('path/to/file.mp4') + + t.deepEqual(input.getFfmpegArguments(), ['-i', 'path/to/file.mp4']) +}) + +test('FfmpegInput type getters', (t) => { + let input = new FfmpegInput('path/to/file.mp4') + + t.true(input.isLocalFile) + t.false(input.isStream) + + input = new FfmpegInput({ source: 'path/to/file.mp4' }) + + t.true(input.isLocalFile) + t.false(input.isStream) + + input = new FfmpegInput('file:///path/to/file.mp4') + + t.true(input.isLocalFile) + t.false(input.isStream) + + input = new FfmpegInput({ source: 'file:///path/to/file.mp4' }) + + t.true(input.isLocalFile) + t.false(input.isStream) + + input = new FfmpegInput('https://example.com/file.mp4') + + t.false(input.isLocalFile) + t.false(input.isStream) + + input = new FfmpegInput({ source: 'https://example.com/file.mp4' }) + + t.false(input.isLocalFile) + t.false(input.isStream) + + input = new FfmpegInput(stream) + + t.false(input.isLocalFile) + t.true(input.isStream) + + input = new FfmpegInput({ source: stream }) + + t.false(input.isLocalFile) + t.true(input.isStream) +}) diff --git a/tests/unit/output-test.ts b/tests/unit/output-test.ts new file mode 100644 index 00000000..efb8d849 --- /dev/null +++ b/tests/unit/output-test.ts @@ -0,0 +1,331 @@ +import test from 'ava' +import { createWriteStream } from 'fs' +import sinon from 'sinon' + +import { FfmpegOutput } from '../../src/output' +import * as formattingModule from '../../src/utils/formatting' + +const stream = createWriteStream('tests/assets/output.mp4') + +test('FfmpegOutput from OutputOptions', (t) => { + let output = new FfmpegOutput({ + output: 'path/to/file.mp4' + }) + + t.deepEqual(output.getFfmpegArguments(), ['path/to/file.mp4'], 'output only') + + output = new FfmpegOutput({ + output: 'output', + map: 'stream' + }) + + t.deepEqual( + output.getFfmpegArguments(), + ['-map', '[stream]', 'output'], + 'map without brackets' + ) + + output = new FfmpegOutput({ + output: 'output', + map: '[stream]' + }) + + t.deepEqual( + output.getFfmpegArguments(), + ['-map', '[stream]', 'output'], + 'map with brackets' + ) + + output = new FfmpegOutput({ + output: stream, + format: 'mp4' + }) + + t.deepEqual( + output.getFfmpegArguments(), + ['-f', 'mp4', 'pipe:1'], + 'stream output' + ) + + output = new FfmpegOutput({ + output: 'path/to/file.mp4', + format: 'some-format', + duration: 123, + seek: 456 + }) + + t.deepEqual( + output.getFfmpegArguments(), + ['-ss', '456', '-t', '123', '-f', 'some-format', 'path/to/file.mp4'], + 'complete test' + ) +}) + +test('FfmpegOutput audio options', (t) => { + let output = new FfmpegOutput({ + output: 'path/to/output', + audio: false + }) + + t.deepEqual( + output.getFfmpegArguments(), + ['-an', 'path/to/output'], + 'no audio' + ) + + output = new FfmpegOutput({ + output: 'path/to/output', + audio: { + codec: 'mp3', + bitrate: '128k', + channels: 2, + frequency: 44100, + quality: 8 + } + }) + + t.deepEqual( + output.getFfmpegArguments(), + [ + '-acodec', + 'mp3', + '-b:a', + '128k', + '-ac', + '2', + '-ar', + '44100', + '-aq', + '8', + 'path/to/output' + ], + 'complete test' + ) +}) + +test.serial('FfmpegOutput audio filters', (t) => { + let filterStub = sinon + .stub(formattingModule, 'formatFilters') + .returns(['filter-output-1', 'filter-output-2']) + + t.teardown(() => filterStub.restore()) + + let output = new FfmpegOutput({ + output: 'path/to/output', + audio: { + filter: 'single-filter' + } + }) + + t.deepEqual( + output.getFfmpegArguments(), + ['-filter:a', 'filter-output-1,filter-output-2', 'path/to/output'], + 'formatFilter output insertion' + ) + + t.true( + filterStub.calledOnceWith(['single-filter']), + 'formatFilter call with single filter' + ) + + filterStub.resetHistory() + + output = new FfmpegOutput({ + output: 'path/to/output', + audio: { + filters: ['filter-1', 'filter-2'] + } + }) + + t.deepEqual( + output.getFfmpegArguments(), + ['-filter:a', 'filter-output-1,filter-output-2', 'path/to/output'], + 'formatFilter output insertion' + ) + + t.true( + filterStub.calledOnceWith(['filter-1', 'filter-2']), + 'formatFilter call with multiple filters' + ) + + t.throws( + () => + new FfmpegOutput({ + output: 'path/to/output', + audio: { + filter: 'foo', + filters: ['bar'] + } + }), + { message: "Cannot specify both audio 'filter' and 'filters'" } + ) +}) + +test('FfmpegOutput video options', (t) => { + let output = new FfmpegOutput({ + output: 'path/to/output', + video: false + }) + + t.deepEqual( + output.getFfmpegArguments(), + ['-vn', 'path/to/output'], + 'no video' + ) + + output = new FfmpegOutput({ + output: 'path/to/output', + video: { + bitrate: '1M', + constantBitrate: true + } + }) + + t.deepEqual( + output.getFfmpegArguments(), + [ + '-b:v', + '1M', + '-minrate', + '1M', + '-maxrate', + '1M', + '-bufsize', + '1M', + 'path/to/output' + ], + 'constant bitrate' + ) + + output = new FfmpegOutput({ + output: 'path/to/output', + video: { + codec: 'h264', + bitrate: '1024k', + fps: 25, + frames: 3100 + } + }) + + t.deepEqual( + output.getFfmpegArguments(), + [ + '-vcodec', + 'h264', + '-b:v', + '1024k', + '-r', + '25', + '-vframes', + '3100', + 'path/to/output' + ], + 'complete test' + ) +}) + +test.serial('FfmpegOutput video filters', (t) => { + let filterStub = sinon + .stub(formattingModule, 'formatFilters') + .returns(['filter-output-1', 'filter-output-2']) + + t.teardown(() => filterStub.restore()) + + let output = new FfmpegOutput({ + output: 'path/to/output', + video: { + filter: 'single-filter' + } + }) + + t.deepEqual( + output.getFfmpegArguments(), + ['-filter:v', 'filter-output-1,filter-output-2', 'path/to/output'], + 'formatFilter output insertion' + ) + + t.true( + filterStub.calledOnceWith(['single-filter']), + 'formatFilter call with single filter' + ) + + filterStub.resetHistory() + + output = new FfmpegOutput({ + output: 'path/to/output', + video: { + filters: ['filter-1', 'filter-2'] + } + }) + + t.deepEqual( + output.getFfmpegArguments(), + ['-filter:v', 'filter-output-1,filter-output-2', 'path/to/output'], + 'formatFilter output insertion' + ) + + t.true( + filterStub.calledOnceWith(['filter-1', 'filter-2']), + 'formatFilter call with multiple filters' + ) + + t.throws( + () => + new FfmpegOutput({ + output: 'path/to/output', + video: { + filter: 'foo', + filters: ['bar'] + } + }), + { message: "Cannot specify both video 'filter' and 'filters'" } + ) +}) + +test('FfmpegOutput from output', (t) => { + let output = new FfmpegOutput('path/to/file.mp4') + + t.deepEqual(output.getFfmpegArguments(), ['path/to/file.mp4']) +}) + +test('FfmpegOutput type getters', (t) => { + let output = new FfmpegOutput('path/to/file.mp4') + + t.true(output.isLocalFile) + t.false(output.isStream) + + output = new FfmpegOutput({ output: 'path/to/file.mp4' }) + + t.true(output.isLocalFile) + t.false(output.isStream) + + output = new FfmpegOutput('file:///path/to/file.mp4') + + t.true(output.isLocalFile) + t.false(output.isStream) + + output = new FfmpegOutput({ output: 'file:///path/to/file.mp4' }) + + t.true(output.isLocalFile) + t.false(output.isStream) + + output = new FfmpegOutput('https://example.com/file.mp4') + + t.false(output.isLocalFile) + t.false(output.isStream) + + output = new FfmpegOutput({ output: 'https://example.com/file.mp4' }) + + t.false(output.isLocalFile) + t.false(output.isStream) + + output = new FfmpegOutput(stream) + + t.false(output.isLocalFile) + t.true(output.isStream) + + output = new FfmpegOutput({ output: stream }) + + t.false(output.isLocalFile) + t.true(output.isStream) +}) diff --git a/tests/unit/utils/formatting-test.ts b/tests/unit/utils/formatting-test.ts new file mode 100644 index 00000000..79fd3fc7 --- /dev/null +++ b/tests/unit/utils/formatting-test.ts @@ -0,0 +1,64 @@ +import test from 'ava' + +import { formatBitrate, formatFilters } from '../../../src/utils/formatting' + +test('formatBitrate', (t) => { + t.is(formatBitrate(128), '128k', 'formats small numbers as kbps') + t.is(formatBitrate(128000), '128000', 'formats big numbers as bps') + t.is(formatBitrate('foobar'), 'foobar', 'keeps strings') +}) + +test('formatFilters', (t) => { + t.deepEqual( + formatFilters([ + 'filtername', + { filter: 'filtername' }, + { + filter: 'filtername', + options: 'option' + }, + { + filter: 'filtername', + options: ['option1', 'option2', 'needs,escaping'] + }, + { + filter: 'filtername', + options: { key1: 'value1', key2: 'value2', key3: 'needs,escaping' } + }, + { + filter: 'filtername', + input: 'input1' + }, + { + filter: 'filtername', + inputs: ['input1', 'input2'] + }, + { + filter: 'filtername', + output: 'output1' + }, + { + filter: 'filtername', + outputs: ['output1', 'output2'] + }, + { + filter: 'filtername', + inputs: ['input1', 'input2'], + outputs: ['output1', 'output2'], + options: { key1: 'value1', key2: 'value2' } + } + ]), + [ + 'filtername', + 'filtername', + 'filtername=option', + "filtername=option1:option2:'needs,escaping'", + "filtername=key1=value1:key2=value2:key3='needs,escaping'", + '[input1]filtername', + '[input1][input2]filtername', + 'filtername[output1]', + 'filtername[output1][output2]', + '[input1][input2]filtername=key1=value1:key2=value2[output1][output2]' + ] + ) +}) diff --git a/tests/unit/utils/line-buffer-test.ts b/tests/unit/utils/line-buffer-test.ts new file mode 100644 index 00000000..7000cd68 --- /dev/null +++ b/tests/unit/utils/line-buffer-test.ts @@ -0,0 +1,38 @@ +import test from 'ava' + +import LineBuffer from '../../../src/utils/line-buffer' + +test('LineBuffer', async (t) => { + t.plan(2) + + let batches = ['line one\nline ', 't', 'wo\n', 'line three\n', 'line four'] + let expected = ['line one', 'line two', 'line three', 'line four'] + + let result = await new Promise((resolve) => { + let buf = new LineBuffer() + let received: string[] = [] + + buf.on('line', (line) => { + received.push(line) + if (received.length === expected.length) resolve(received) + }) + + for (let batch of batches) { + buf.append(batch) + } + + buf.close() + + t.is(buf.toString(), expected.join('\n')) + }) + + t.deepEqual(result, expected) +}) + +test('LineBuffer errors', (t) => { + let buf = new LineBuffer() + buf.close() + + t.throws(() => buf.append('foo'), { message: 'LineBuffer is closed' }) + t.throws(() => buf.close(), { message: 'LineBuffer is closed' }) +}) diff --git a/tests/unit/utils/parsing-test.ts b/tests/unit/utils/parsing-test.ts new file mode 100644 index 00000000..92f7bcca --- /dev/null +++ b/tests/unit/utils/parsing-test.ts @@ -0,0 +1,77 @@ +import test from 'ava' + +import { + CodecData, + CodecDataExtractor, + extractErrorMessage, + extractProgress +} from '../../../src/utils/parsing' + +test('extractErrorMessage', (t) => { + let lines = [ + '[ square bracket', + ' spaces', + 'matching line 1', + 'matching line 2', + '[ square bracket', + 'matching line 3', + 'matching line 4' + ] + + t.is(extractErrorMessage(lines), 'matching line 3\nmatching line 4') +}) + +test('extractProgress', (t) => { + t.is(extractProgress('not a real progress line'), undefined) + + t.deepEqual( + extractProgress( + 'frame= 12 fps= 34 bitrate= 56kbits/s Lsize= 78kB time=00:11:22.33 speed=90.1x ' + ), + { + frame: 12, + fps: 34, + bitrate: 56, + size: 78, + time: '00:11:22.33', + speed: 90.1 + } + ) +}) + +test('CodecDataExtractor', async (t) => { + let result: CodecData = await new Promise((resolve) => { + let extractor = new CodecDataExtractor(resolve) + + let lines = [ + '[mpegts @ 0x557a964d3f80] DTS 6603 < 12609 out of order', + "Input #0, mpegts, from 'path/to/input':", + ' Duration: 00:01:06.40, start: 0.040000, bitrate: 584 kb/s', + ' Program 1', + ' Stream #0:0[0x3e9]: Audio: mp2 ([3][0][0][0] / 0x0003), 44100 Hz, stereo, fltp, 64 kb/s', + ' Stream #0:1[0x3ea]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 352x240 [SAR 1:1 DAR 22:15], 14.99 fps, 29.97 tbr, 90k tbn', + 'Stream mapping:', + ' Stream #0:1 -> #0:0 (h264 (native) -> h264 (libx264))', + ' Stream #0:0 -> #0:1 (mp2 (native) -> aac (native))', + "Output #0, mp4, to 'path/to/output':", + 'Press [q] to stop, [?] for help' + ] + + for (let line of lines) { + extractor.processLine(line) + } + }) + + t.deepEqual(result, [ + { + audio: 'mp2 ([3][0][0][0] / 0x0003)', + audioDetails: + 'mp2 ([3][0][0][0] / 0x0003), 44100 Hz, stereo, fltp, 64 kb/s', + duration: '00:01:06.40', + format: 'mpegts', + video: 'h264 (Main) ([27][0][0][0] / 0x001B)', + videoDetails: + 'h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 352x240 [SAR 1:1 DAR 22:15], 14.99 fps, 29.97 tbr, 90k tbn' + } + ]) +}) diff --git a/tools/jsdoc-aliases.js b/tools/jsdoc-aliases.js deleted file mode 100644 index 6c7e1e85..00000000 --- a/tools/jsdoc-aliases.js +++ /dev/null @@ -1,58 +0,0 @@ -/*jshint node:true*/ -'use strict'; - -function createAlias(doclet, alias) { - var clone = {}; - - Object.keys(doclet).forEach(function(key) { - clone[key] = doclet[key]; - }); - - if (alias.indexOf('#') !== -1) { - clone.longname = alias; - clone.memberof = alias.split('#')[0]; - clone.name = alias.split('#')[1]; - } else { - clone.longname = clone.memberof + '#' + alias; - clone.name = alias; - } - - delete clone.returns; - delete clone.examples; - delete clone.meta; - delete clone.aliases; - - clone.isAlias = true; - clone.description = 'Alias for ' + doclet.longname + ''; - - return clone; -} - -exports.handlers = { - parseComplete: function(e) { - var doclets = e.doclets.slice(); - - doclets.forEach(function(doclet) { - // Duplicate doclets with aliases - if (doclet.aliases) { - doclet.aliases.forEach(function(alias) { - e.doclets.push(createAlias(doclet, alias)); - }); - } - }); - } -}; - -exports.defineTags = function(dict) { - dict.defineTag('aliases', { - onTagged: function(doclet, tag) { - doclet.aliases = tag.text.split(','); - } - }); - - dict.defineTag('category', { - onTagged: function(doclet, tag) { - doclet.category = tag.text; - } - }); -}; \ No newline at end of file diff --git a/tools/jsdoc-conf.json b/tools/jsdoc-conf.json deleted file mode 100644 index 1189081d..00000000 --- a/tools/jsdoc-conf.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "opts": { - "recurse": true, - "verbose": true, - "destination": "doc", - "template": "tools/jsdoc-template" - }, - - "source": { - "include": ["README.md", "lib"], - "excludePattern": "lib\/presets" - }, - - "plugins": [ - "plugins/markdown", - "tools/jsdoc-aliases.js" - ], - - "markdown": { - "parser": "evilstreak", - "dialect": "Markuru" - } -} \ No newline at end of file diff --git a/tools/jsdoc-template/README.md b/tools/jsdoc-template/README.md deleted file mode 100644 index 52b1a5e1..00000000 --- a/tools/jsdoc-template/README.md +++ /dev/null @@ -1,3 +0,0 @@ -The default template for JSDoc 3 uses: [the Taffy Database library](http://taffydb.com/) and the [Underscore Template library](http://documentcloud.github.com/underscore/#template). - -Updated for node-fluent-ffmpeg to handle @aliases and @category tags. \ No newline at end of file diff --git a/tools/jsdoc-template/publish.js b/tools/jsdoc-template/publish.js deleted file mode 100644 index 3aefa374..00000000 --- a/tools/jsdoc-template/publish.js +++ /dev/null @@ -1,626 +0,0 @@ -/*global env: true */ -'use strict'; - -var template = require('jsdoc/template'), - fs = require('jsdoc/fs'), - path = require('jsdoc/path'), - taffy = require('taffydb').taffy, - logger = require('jsdoc/util/logger'), - helper = require('jsdoc/util/templateHelper'), - htmlsafe = helper.htmlsafe, - linkto = helper.linkto, - resolveAuthorLinks = helper.resolveAuthorLinks, - scopeToPunc = helper.scopeToPunc, - hasOwnProp = Object.prototype.hasOwnProperty, - data, - view, - outdir = env.opts.destination; - -function find(spec) { - return helper.find(data, spec); -} - -function tutoriallink(tutorial) { - return helper.toTutorial(tutorial, null, { tag: 'em', classname: 'disabled', prefix: 'Tutorial: ' }); -} - -function getAncestorLinks(doclet) { - return helper.getAncestorLinks(data, doclet); -} - -function getCategoryLink(className, cat) { - return '' + cat + ' methods'; -} - -function hashToLink(doclet, hash) { - if ( !/^(#.+)/.test(hash) ) { return hash; } - - var url = helper.createLink(doclet); - - url = url.replace(/(#.+|$)/, hash); - return '' + hash + ''; -} - -function needsSignature(doclet) { - var needsSig = false; - - // function and class definitions always get a signature - if (doclet.kind === 'function' || doclet.kind === 'class') { - needsSig = true; - } - // typedefs that contain functions get a signature, too - else if (doclet.kind === 'typedef' && doclet.type && doclet.type.names && - doclet.type.names.length) { - for (var i = 0, l = doclet.type.names.length; i < l; i++) { - if (doclet.type.names[i].toLowerCase() === 'function') { - needsSig = true; - break; - } - } - } - - return needsSig; -} - -function addSignatureParams(f) { - var params = helper.getSignatureParams(f, 'optional'); - - f.signature = (f.signature || '') + '('+params.join(', ')+')'; -} - -function addSignatureReturns(f) { - var returnTypes = helper.getSignatureReturns(f); - - f.signature = '' + (f.signature || '') + '' + - '' + - (returnTypes && returnTypes.length ? ' → {' + returnTypes.join('|') + '}' : '') + - ''; -} - -function addSignatureTypes(f) { - var types = helper.getSignatureTypes(f); - - f.signature = (f.signature || '') + ''+(types.length? ' :'+types.join('|') : '')+''; -} - -function addAttribs(f) { - var attribs = helper.getAttribs(f); - - f.attribs = '' + htmlsafe(attribs.length ? - // we want the template output to say 'abstract', not 'virtual' - '<' + attribs.join(', ').replace('virtual', 'abstract') + '> ' : '') + ''; -} - -function shortenPaths(files, commonPrefix) { - Object.keys(files).forEach(function(file) { - files[file].shortened = files[file].resolved.replace(commonPrefix, '') - // always use forward slashes - .replace(/\\/g, '/'); - }); - - return files; -} - -function getPathFromDoclet(doclet) { - if (!doclet.meta) { - return; - } - - return doclet.meta.path && doclet.meta.path !== 'null' ? - path.join(doclet.meta.path, doclet.meta.filename) : - doclet.meta.filename; -} - -function generate(title, docs, filename, resolveLinks) { - resolveLinks = resolveLinks === false ? false : true; - - var docData = { - title: title, - docs: docs - }; - - var outpath = path.join(outdir, filename), - html = view.render('container.tmpl', docData); - - if (resolveLinks) { - html = helper.resolveLinks(html); // turn {@link foo} into foo - } - - // Ensure
 tags have pretty print class
-    html = html.replace(/
/g, '
');
-
-    fs.writeFileSync(outpath, html, 'utf8');
-}
-
-function generateSourceFiles(sourceFiles, encoding) {
-    encoding = encoding || 'utf8';
-    Object.keys(sourceFiles).forEach(function(file) {
-        var source;
-        // links are keyed to the shortened path in each doclet's `meta.shortpath` property
-        var sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened);
-        helper.registerLink(sourceFiles[file].shortened, sourceOutfile);
-
-        try {
-            source = {
-                kind: 'source',
-                code: helper.htmlsafe( fs.readFileSync(sourceFiles[file].resolved, encoding) )
-            };
-        }
-        catch(e) {
-            logger.error('Error while generating source file %s: %s', file, e.message);
-        }
-
-        generate('Source: ' + sourceFiles[file].shortened, [source], sourceOutfile,
-            false);
-    });
-}
-
-/**
- * Look for classes or functions with the same name as modules (which indicates that the module
- * exports only that class or function), then attach the classes or functions to the `module`
- * property of the appropriate module doclets. The name of each class or function is also updated
- * for display purposes. This function mutates the original arrays.
- *
- * @private
- * @param {Array.} doclets - The array of classes and functions to
- * check.
- * @param {Array.} modules - The array of module doclets to search.
- */
-function attachModuleSymbols(doclets, modules) {
-    var symbols = {};
-
-    // build a lookup table
-    doclets.forEach(function(symbol) {
-        symbols[symbol.longname] = symbol;
-    });
-
-    return modules.map(function(module) {
-        if (symbols[module.longname]) {
-            module.module = symbols[module.longname];
-            module.module.name = module.module.name.replace('module:', 'require("') + '")';
-        }
-    });
-}
-
-function buildReadmeNav(readme) {
-    var nav = '';
-
-    var prevLevel = '0';
-    nav += '
    '; - - readme = readme.replace(/([^<]*)<\/h[23]>/g, function(match, level, title) { - if (title.trim().length > 0) { - var titlelink = title.toLowerCase().replace(/[^a-z]/g, '-'); - - if (level === '2') { - if (prevLevel === '2' || prevLevel === '3') { - nav += '
'; - } - - nav += '
  • ' + title + '
    • '; - } else { - nav += '
    • ' + title + '
    • '; - } - - prevLevel = level; - match = '' + match; - } - - return match; - }); - - nav += '
    '; - return { nav: nav, readme: readme }; -} - -/** - * Create the navigation sidebar. - * @param {String} readmeNav The readme TOC - * @param {object} members The members that will be used to create the sidebar. - * @param {array} members.classes - * @param {array} members.externals - * @param {array} members.globals - * @param {array} members.mixins - * @param {array} members.modules - * @param {array} members.namespaces - * @param {array} members.tutorials - * @param {array} members.events - * @return {string} The HTML for the navigation sidebar. - */ -function buildNav(readmeNav, members) { - var nav = '

    Index

    ' + readmeNav, - seen = {}, - hasClassList = false, - classNav = '', - globalNav = ''; - - - - if (members.modules.length) { - nav += '

    Modules

      '; - members.modules.forEach(function(m) { - if ( !hasOwnProp.call(seen, m.longname) ) { - nav += '
    • '+linkto(m.longname, m.name)+'
    • '; - } - seen[m.longname] = true; - }); - - nav += '
    '; - } - - if (members.externals.length) { - nav += '

    Externals

      '; - members.externals.forEach(function(e) { - if ( !hasOwnProp.call(seen, e.longname) ) { - nav += '
    • '+linkto( e.longname, e.name.replace(/(^"|"$)/g, '') )+'
    • '; - } - seen[e.longname] = true; - }); - - nav += '
    '; - } - - if (members.classes.length) { - members.classes.forEach(function(c) { - if ( !hasOwnProp.call(seen, c.longname) ) { - classNav += '
  • '+linkto(c.longname, c.name)+'
  • '; - if (c.longname in members.categories) { - classNav += '
      ' + members.categories[c.longname].reduce(function(nav, cat) { - return nav + '
    • ' + getCategoryLink(c.longname, cat) + '
    • '; - }, '') + '
    '; - } - } - seen[c.longname] = true; - }); - - if (classNav !== '') { - nav += '

    Classes

      '; - nav += classNav; - nav += '
    '; - } - } - - /*if (members.events.length) { - nav += '

    Events

      '; - members.events.forEach(function(e) { - if ( !hasOwnProp.call(seen, e.longname) ) { - nav += '
    • '+linkto(e.longname, e.name)+'
    • '; - } - seen[e.longname] = true; - }); - - nav += '
    '; - }*/ - - if (members.namespaces.length) { - nav += '

    Namespaces

      '; - members.namespaces.forEach(function(n) { - if ( !hasOwnProp.call(seen, n.longname) ) { - nav += '
    • '+linkto(n.longname, n.name)+'
    • '; - } - seen[n.longname] = true; - }); - - nav += '
    '; - } - - if (members.mixins.length) { - nav += '

    Mixins

      '; - members.mixins.forEach(function(m) { - if ( !hasOwnProp.call(seen, m.longname) ) { - nav += '
    • '+linkto(m.longname, m.name)+'
    • '; - } - seen[m.longname] = true; - }); - - nav += '
    '; - } - - if (members.tutorials.length) { - nav += '

    Tutorials

      '; - members.tutorials.forEach(function(t) { - nav += '
    • '+tutoriallink(t.name)+'
    • '; - }); - - nav += '
    '; - } - - if (members.globals.length) { - members.globals.forEach(function(g) { - if ( g.kind !== 'typedef' && !hasOwnProp.call(seen, g.longname) ) { - globalNav += '
  • ' + linkto(g.longname, g.name) + '
  • '; - } - seen[g.longname] = true; - }); - - if (!globalNav) { - // turn the heading into a link so you can actually get to the global page - nav += '

    ' + linkto('global', 'Global') + '

    '; - } - else { - nav += '

    Global

      ' + globalNav + '
    '; - } - } - - return nav; -} - -/** - @param {TAFFY} taffyData See . - @param {object} opts - @param {Tutorial} tutorials - */ -exports.publish = function(taffyData, opts, tutorials) { - data = taffyData; - - var conf = env.conf.templates || {}; - conf['default'] = conf['default'] || {}; - - var templatePath = opts.template; - view = new template.Template(templatePath + '/tmpl'); - - // claim some special filenames in advance, so the All-Powerful Overseer of Filename Uniqueness - // doesn't try to hand them out later - var indexUrl = helper.getUniqueFilename('index'); - // don't call registerLink() on this one! 'index' is also a valid longname - - var globalUrl = helper.getUniqueFilename('global'); - helper.registerLink('global', globalUrl); - - // set up templating - view.layout = conf['default'].layoutFile ? - path.getResourcePath(path.dirname(conf['default'].layoutFile), - path.basename(conf['default'].layoutFile) ) : - 'layout.tmpl'; - - // set up tutorials for helper - helper.setTutorials(tutorials); - - data = helper.prune(data); - data.sort('longname, version, since'); - helper.addEventListeners(data); - - var sourceFiles = {}; - var sourceFilePaths = []; - data().each(function(doclet) { - doclet.attribs = ''; - - if (doclet.examples) { - doclet.examples = doclet.examples.map(function(example) { - var caption, code; - - if (example.match(/^\s*([\s\S]+?)<\/caption>(\s*[\n\r])([\s\S]+)$/i)) { - caption = RegExp.$1; - code = RegExp.$3; - } - - return { - caption: caption || '', - code: code || example - }; - }); - } - if (doclet.see) { - doclet.see.forEach(function(seeItem, i) { - doclet.see[i] = hashToLink(doclet, seeItem); - }); - } - - // build a list of source files - var sourcePath; - if (doclet.meta) { - sourcePath = getPathFromDoclet(doclet); - sourceFiles[sourcePath] = { - resolved: sourcePath, - shortened: null - }; - if (sourceFilePaths.indexOf(sourcePath) === -1) { - sourceFilePaths.push(sourcePath); - } - } - }); - - // update outdir if necessary, then create outdir - var packageInfo = ( find({kind: 'package'}) || [] ) [0]; - if (packageInfo && packageInfo.name) { - outdir = path.join(outdir, packageInfo.name, packageInfo.version); - } - fs.mkPath(outdir); - - // copy the template's static files to outdir - var fromDir = path.join(templatePath, 'static'); - var staticFiles = fs.ls(fromDir, 3); - - staticFiles.forEach(function(fileName) { - var toDir = fs.toDir( fileName.replace(fromDir, outdir) ); - fs.mkPath(toDir); - fs.copyFileSync(fileName, toDir); - }); - - // copy user-specified static files to outdir - var staticFilePaths; - var staticFileFilter; - var staticFileScanner; - if (conf['default'].staticFiles) { - staticFilePaths = conf['default'].staticFiles.paths || []; - staticFileFilter = new (require('jsdoc/src/filter')).Filter(conf['default'].staticFiles); - staticFileScanner = new (require('jsdoc/src/scanner')).Scanner(); - - staticFilePaths.forEach(function(filePath) { - var extraStaticFiles = staticFileScanner.scan([filePath], 10, staticFileFilter); - - extraStaticFiles.forEach(function(fileName) { - var sourcePath = fs.toDir(filePath); - var toDir = fs.toDir( fileName.replace(sourcePath, outdir) ); - fs.mkPath(toDir); - fs.copyFileSync(fileName, toDir); - }); - }); - } - - if (sourceFilePaths.length) { - sourceFiles = shortenPaths( sourceFiles, path.commonPrefix(sourceFilePaths) ); - } - data().each(function(doclet) { - var url = helper.createLink(doclet); - helper.registerLink(doclet.longname, url); - - // add a shortened version of the full path - var docletPath; - if (doclet.meta) { - docletPath = getPathFromDoclet(doclet); - docletPath = sourceFiles[docletPath].shortened; - if (docletPath) { - doclet.meta.shortpath = docletPath; - } - } - }); - - data().each(function(doclet) { - var url = helper.longnameToUrl[doclet.longname]; - - if (url.indexOf('#') > -1) { - doclet.id = helper.longnameToUrl[doclet.longname].split(/#/).pop(); - } - else { - doclet.id = doclet.name; - } - - if ( needsSignature(doclet) ) { - addSignatureParams(doclet); - addSignatureReturns(doclet); - addAttribs(doclet); - } - }); - - // do this after the urls have all been generated - data().each(function(doclet) { - doclet.ancestors = getAncestorLinks(doclet); - - if (doclet.kind === 'member') { - addSignatureTypes(doclet); - addAttribs(doclet); - } - - if (doclet.kind === 'constant') { - addSignatureTypes(doclet); - addAttribs(doclet); - doclet.kind = 'member'; - } - }); - - var members = helper.getMembers(data); - members.tutorials = tutorials.children; - members.categories = data('method').get().reduce(function(cats, method) { - if (!(method.memberof in cats)) { - cats[method.memberof] = []; - } - - var cat = method.category || 'Other'; - if (cats[method.memberof].indexOf(cat) === -1) { - cats[method.memberof].push(cat); - cats[method.memberof] = cats[method.memberof].sort(); - } - - return cats; - }, {}); - - // output pretty-printed source files by default - var outputSourceFiles = conf['default'] && conf['default'].outputSourceFiles !== false ? true : - false; - - // add template helpers - view.find = find; - view.linkto = linkto; - view.resolveAuthorLinks = resolveAuthorLinks; - view.tutoriallink = tutoriallink; - view.htmlsafe = htmlsafe; - view.outputSourceFiles = outputSourceFiles; - - // Build readme nav - var readmeNav = buildReadmeNav(opts.readme); - opts.readme = readmeNav.readme; - - // once for all - view.nav = buildNav(readmeNav.nav, members); - attachModuleSymbols( find({ kind: ['class', 'function'], longname: {left: 'module:'} }), - members.modules ); - - // generate the pretty-printed source files first so other pages can link to them - if (outputSourceFiles) { - generateSourceFiles(sourceFiles, opts.encoding); - } - - if (members.globals.length) { generate('Global', [{kind: 'globalobj'}], globalUrl); } - - // index page displays information from package.json and lists files - var files = find({kind: 'file'}), - packages = find({kind: 'package'}); - - generate('Index', - packages.concat( - [{kind: 'mainpage', readme: opts.readme, longname: (opts.mainpagetitle) ? opts.mainpagetitle : 'Main Page'}] - ).concat(files), - indexUrl); - - // set up the lists that we'll use to generate pages - var classes = taffy(members.classes); - var modules = taffy(members.modules); - var namespaces = taffy(members.namespaces); - var mixins = taffy(members.mixins); - var externals = taffy(members.externals); - - Object.keys(helper.longnameToUrl).forEach(function(longname) { - var myClasses = helper.find(classes, {longname: longname}); - if (myClasses.length) { - generate('Class: ' + myClasses[0].name, myClasses, helper.longnameToUrl[longname]); - } - - var myModules = helper.find(modules, {longname: longname}); - if (myModules.length) { - generate('Module: ' + myModules[0].name, myModules, helper.longnameToUrl[longname]); - } - - var myNamespaces = helper.find(namespaces, {longname: longname}); - if (myNamespaces.length) { - generate('Namespace: ' + myNamespaces[0].name, myNamespaces, helper.longnameToUrl[longname]); - } - - var myMixins = helper.find(mixins, {longname: longname}); - if (myMixins.length) { - generate('Mixin: ' + myMixins[0].name, myMixins, helper.longnameToUrl[longname]); - } - - var myExternals = helper.find(externals, {longname: longname}); - if (myExternals.length) { - generate('External: ' + myExternals[0].name, myExternals, helper.longnameToUrl[longname]); - } - }); - - // TODO: move the tutorial functions to templateHelper.js - function generateTutorial(title, tutorial, filename) { - var tutorialData = { - title: title, - header: tutorial.title, - content: tutorial.parse(), - children: tutorial.children - }; - - var tutorialPath = path.join(outdir, filename), - html = view.render('tutorial.tmpl', tutorialData); - - // yes, you can use {@link} in tutorials too! - html = helper.resolveLinks(html); // turn {@link foo} into foo - - fs.writeFileSync(tutorialPath, html, 'utf8'); - } - - // tutorials can have only one parent so there is no risk for loops - function saveChildren(node) { - node.children.forEach(function(child) { - generateTutorial('Tutorial: ' + child.title, child, helper.tutorialToUrl(child.name)); - saveChildren(child); - }); - } - saveChildren(tutorials); -}; diff --git a/tools/jsdoc-template/static/scripts/linenumber.js b/tools/jsdoc-template/static/scripts/linenumber.js deleted file mode 100644 index 8d52f7ea..00000000 --- a/tools/jsdoc-template/static/scripts/linenumber.js +++ /dev/null @@ -1,25 +0,0 @@ -/*global document */ -(function() { - var source = document.getElementsByClassName('prettyprint source linenums'); - var i = 0; - var lineNumber = 0; - var lineId; - var lines; - var totalLines; - var anchorHash; - - if (source && source[0]) { - anchorHash = document.location.hash.substring(1); - lines = source[0].getElementsByTagName('li'); - totalLines = lines.length; - - for (; i < totalLines; i++) { - lineNumber++; - lineId = 'line' + lineNumber; - lines[i].id = lineId; - if (lineId === anchorHash) { - lines[i].className += ' selected'; - } - } - } -})(); diff --git a/tools/jsdoc-template/static/scripts/prettify/Apache-License-2.0.txt b/tools/jsdoc-template/static/scripts/prettify/Apache-License-2.0.txt deleted file mode 100644 index d6456956..00000000 --- a/tools/jsdoc-template/static/scripts/prettify/Apache-License-2.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/tools/jsdoc-template/static/scripts/prettify/lang-css.js b/tools/jsdoc-template/static/scripts/prettify/lang-css.js deleted file mode 100644 index 041e1f59..00000000 --- a/tools/jsdoc-template/static/scripts/prettify/lang-css.js +++ /dev/null @@ -1,2 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", -/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/tools/jsdoc-template/static/scripts/prettify/prettify.js b/tools/jsdoc-template/static/scripts/prettify/prettify.js deleted file mode 100644 index eef5ad7e..00000000 --- a/tools/jsdoc-template/static/scripts/prettify/prettify.js +++ /dev/null @@ -1,28 +0,0 @@ -var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; -(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= -[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), -l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, -q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, -q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, -"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), -a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} -for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], -"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], -H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], -J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ -I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), -["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", -/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), -["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", -hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= -!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p h2 { - margin-top: 6px; -} - -h3 -{ - font-size: 150%; - font-weight: bold; - letter-spacing: -0.01em; - margin-top: 16px; - margin: 50px 0 3px 0; -} - -h4 -{ - font-size: 130%; - font-weight: bold; - letter-spacing: -0.01em; - margin-top: 16px; - margin: 18px 0 3px 0; - color: #526492; -} - -h5, .container-overview .subsection-title -{ - font-size: 120%; - font-weight: bold; - letter-spacing: -0.01em; - margin: 8px 0 3px -16px; -} - -h6 -{ - font-size: 100%; - letter-spacing: -0.01em; - margin: 6px 0 3px 0; - font-style: italic; -} - -article > dl, article > pre { - margin-left: 2em; -} - -.ancestors { color: #999; } -.ancestors a -{ - color: #999 !important; - text-decoration: none; -} - -.important -{ - font-weight: bold; - color: #950B02; -} - -.yes-def { - text-indent: -1000px; -} - -.type-signature { - color: #aaa; -} - -.name, .signature { - font-family: Consolas, "Lucida Console", Monaco, monospace; -} - -.details { margin-top: 14px; border-left: 2px solid #DDD; } -.details dt { width:100px; float:left; padding-left: 10px; padding-top: 6px; } -.details dd { margin-left: 50px; } -.details ul { margin: 0; } -.details ul { list-style-type: none; } -.details li { margin-left: 30px; padding-top: 6px; } -.details pre.prettyprint { margin: 0 } -.details .object-value { padding-top: 0; } - -.description { - margin-bottom: 1em; - margin-left: -16px; - margin-top: 1em; -} - -.code-caption -{ - font-style: italic; - font-family: Palatino, 'Palatino Linotype', serif; - font-size: 107%; - margin: 0; -} - -.prettyprint -{ - border: 1px solid #ddd; - width: 80%; - overflow: auto; -} - -.prettyprint.source { - width: inherit; -} - -.prettyprint code -{ - font-family: Consolas, 'Lucida Console', Monaco, monospace; - font-size: 100%; - line-height: 18px; - display: block; - padding: 4px 12px; - margin: 0; - background-color: #fff; - color: #000; -} - -.prettyprint code span.line -{ - display: inline-block; -} - -.prettyprint.linenums -{ - padding-left: 70px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.prettyprint.linenums ol -{ - padding-left: 0; -} - -.prettyprint.linenums li -{ - border-left: 3px #ddd solid; -} - -.prettyprint.linenums li.selected, -.prettyprint.linenums li.selected * -{ - background-color: lightyellow; -} - -.prettyprint.linenums li * -{ - -webkit-user-select: text; - -moz-user-select: text; - -ms-user-select: text; - user-select: text; -} - -.params, .props -{ - border-spacing: 0; - border: 0; - border-collapse: collapse; -} - -.params .name, .props .name, .name code { - color: #526492; - font-family: Consolas, 'Lucida Console', Monaco, monospace; - font-size: 100%; -} - -.params td, .params th, .props td, .props th -{ - border: 1px solid #ddd; - margin: 0px; - text-align: left; - vertical-align: top; - padding: 4px 6px; - display: table-cell; -} - -.params thead tr, .props thead tr -{ - background-color: #ddd; - font-weight: bold; -} - -.params .params thead tr, .props .props thead tr -{ - background-color: #fff; - font-weight: bold; -} - -.params th, .props th { border-right: 1px solid #aaa; } -.params thead .last, .props thead .last { border-right: 1px solid #ddd; } - -.params td.description > p:first-child -{ - margin-top: 0; - padding-top: 0; -} - -.params td.description > p:last-child -{ - margin-bottom: 0; - padding-bottom: 0; -} - -.disabled { - color: #454545; -} diff --git a/tools/jsdoc-template/static/styles/prettify-jsdoc.css b/tools/jsdoc-template/static/styles/prettify-jsdoc.css deleted file mode 100644 index 5a2526e3..00000000 --- a/tools/jsdoc-template/static/styles/prettify-jsdoc.css +++ /dev/null @@ -1,111 +0,0 @@ -/* JSDoc prettify.js theme */ - -/* plain text */ -.pln { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* string content */ -.str { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a keyword */ -.kwd { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a comment */ -.com { - font-weight: normal; - font-style: italic; -} - -/* a type name */ -.typ { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* a literal value */ -.lit { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* punctuation */ -.pun { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* lisp open bracket */ -.opn { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* lisp close bracket */ -.clo { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a markup tag name */ -.tag { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a markup attribute name */ -.atn { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a markup attribute value */ -.atv { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a declaration */ -.dec { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a variable name */ -.var { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* a function name */ -.fun { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* Specify class=linenums on a pre to get line numbering */ -ol.linenums { - margin-top: 0; - margin-bottom: 0; -} diff --git a/tools/jsdoc-template/static/styles/prettify-tomorrow.css b/tools/jsdoc-template/static/styles/prettify-tomorrow.css deleted file mode 100644 index aa2908c2..00000000 --- a/tools/jsdoc-template/static/styles/prettify-tomorrow.css +++ /dev/null @@ -1,132 +0,0 @@ -/* Tomorrow Theme */ -/* Original theme - https://github.com/chriskempson/tomorrow-theme */ -/* Pretty printing styles. Used with prettify.js. */ -/* SPAN elements with the classes below are added by prettyprint. */ -/* plain text */ -.pln { - color: #4d4d4c; } - -@media screen { - /* string content */ - .str { - color: #718c00; } - - /* a keyword */ - .kwd { - color: #8959a8; } - - /* a comment */ - .com { - color: #8e908c; } - - /* a type name */ - .typ { - color: #4271ae; } - - /* a literal value */ - .lit { - color: #f5871f; } - - /* punctuation */ - .pun { - color: #4d4d4c; } - - /* lisp open bracket */ - .opn { - color: #4d4d4c; } - - /* lisp close bracket */ - .clo { - color: #4d4d4c; } - - /* a markup tag name */ - .tag { - color: #c82829; } - - /* a markup attribute name */ - .atn { - color: #f5871f; } - - /* a markup attribute value */ - .atv { - color: #3e999f; } - - /* a declaration */ - .dec { - color: #f5871f; } - - /* a variable name */ - .var { - color: #c82829; } - - /* a function name */ - .fun { - color: #4271ae; } } -/* Use higher contrast and text-weight for printable form. */ -@media print, projection { - .str { - color: #060; } - - .kwd { - color: #006; - font-weight: bold; } - - .com { - color: #600; - font-style: italic; } - - .typ { - color: #404; - font-weight: bold; } - - .lit { - color: #044; } - - .pun, .opn, .clo { - color: #440; } - - .tag { - color: #006; - font-weight: bold; } - - .atn { - color: #404; } - - .atv { - color: #060; } } -/* Style */ -/* -pre.prettyprint { - background: white; - font-family: Menlo, Monaco, Consolas, monospace; - font-size: 12px; - line-height: 1.5; - border: 1px solid #ccc; - padding: 10px; } -*/ - -/* Specify class=linenums on a pre to get line numbering */ -ol.linenums { - margin-top: 0; - margin-bottom: 0; } - -/* IE indents via margin-left */ -li.L0, -li.L1, -li.L2, -li.L3, -li.L4, -li.L5, -li.L6, -li.L7, -li.L8, -li.L9 { - /* */ } - -/* Alternate shading for lines */ -li.L1, -li.L3, -li.L5, -li.L7, -li.L9 { - /* */ } diff --git a/tools/jsdoc-template/tmpl/aliases.tmpl b/tools/jsdoc-template/tmpl/aliases.tmpl deleted file mode 100644 index 08461b64..00000000 --- a/tools/jsdoc-template/tmpl/aliases.tmpl +++ /dev/null @@ -1,12 +0,0 @@ - - 1) { ?> -
      - -
    • - -
    - - - \ No newline at end of file diff --git a/tools/jsdoc-template/tmpl/container.tmpl b/tools/jsdoc-template/tmpl/container.tmpl deleted file mode 100644 index e92a8825..00000000 --- a/tools/jsdoc-template/tmpl/container.tmpl +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - - -
    - -
    -

    - - - - - -

    - -
    - -
    - -
    -
    - - - - - - - - -
    - - - - - -

    Example 1? 's':'' ?>

    - - - -
    - - -

    Extends

    - -
      -
    • -
    - - - -

    Mixes In

    - -
      -
    • -
    - - - -

    Requires

    - -
      -
    • -
    - - - -

    Classes

    - -
    -
    -
    -
    - - - -

    Namespaces

    - -
    -
    -
    -
    - - - -

    Members

    - -
    - -
    - - - -

    - -
    - -
    - - - -

    Type Definitions

    - -
    - - - -
    - - - -

    Events

    - -
    - -
    - -
    - -
    - - - diff --git a/tools/jsdoc-template/tmpl/details.tmpl b/tools/jsdoc-template/tmpl/details.tmpl deleted file mode 100644 index abe5e651..00000000 --- a/tools/jsdoc-template/tmpl/details.tmpl +++ /dev/null @@ -1,107 +0,0 @@ -" + data.defaultvalue + ""; - defaultObjectClass = ' class="object-value"'; -} -?> -
    - - -
    Properties:
    - -
    - - - - -
    Version:
    -
    - - - -
    Since:
    -
    - - - -
    Inherited From:
    -
    • - -
    - - - -
    Deprecated:
    • Yes
      - - - -
      Author:
      -
      -
        -
      • -
      -
      - - - - - - - - -
      License:
      -
      - - - -
      Default Value:
      -
        - > -
      - - - -
      Source:
      -
      • - , -
      - - - -
      Tutorials:
      -
      -
        -
      • -
      -
      - - - -
      See:
      -
      -
        -
      • -
      -
      - - - -
      To Do:
      -
      -
        -
      • -
      -
      - -
      diff --git a/tools/jsdoc-template/tmpl/example.tmpl b/tools/jsdoc-template/tmpl/example.tmpl deleted file mode 100644 index e87caa5b..00000000 --- a/tools/jsdoc-template/tmpl/example.tmpl +++ /dev/null @@ -1,2 +0,0 @@ - -
      diff --git a/tools/jsdoc-template/tmpl/examples.tmpl b/tools/jsdoc-template/tmpl/examples.tmpl deleted file mode 100644 index 04d975e9..00000000 --- a/tools/jsdoc-template/tmpl/examples.tmpl +++ /dev/null @@ -1,13 +0,0 @@ - -

      - -
      - \ No newline at end of file diff --git a/tools/jsdoc-template/tmpl/exceptions.tmpl b/tools/jsdoc-template/tmpl/exceptions.tmpl deleted file mode 100644 index 78c4e250..00000000 --- a/tools/jsdoc-template/tmpl/exceptions.tmpl +++ /dev/null @@ -1,30 +0,0 @@ - - -
      -
      -
      - -
      -
      -
      -
      -
      - Type -
      -
      - -
      -
      -
      -
      - -
      - - - - - -
      - diff --git a/tools/jsdoc-template/tmpl/layout.tmpl b/tools/jsdoc-template/tmpl/layout.tmpl deleted file mode 100644 index 92cd6eeb..00000000 --- a/tools/jsdoc-template/tmpl/layout.tmpl +++ /dev/null @@ -1,38 +0,0 @@ - - - - - JSDoc: <?js= title ?> - - - - - - - - - - -
      - -

      - - -
      - - - -
      - -
      - Documentation generated by JSDoc on -
      - - - - - diff --git a/tools/jsdoc-template/tmpl/mainpage.tmpl b/tools/jsdoc-template/tmpl/mainpage.tmpl deleted file mode 100644 index 64e9e594..00000000 --- a/tools/jsdoc-template/tmpl/mainpage.tmpl +++ /dev/null @@ -1,14 +0,0 @@ - - - -

      - - - -
      -
      -
      - diff --git a/tools/jsdoc-template/tmpl/members.tmpl b/tools/jsdoc-template/tmpl/members.tmpl deleted file mode 100644 index 0f99998e..00000000 --- a/tools/jsdoc-template/tmpl/members.tmpl +++ /dev/null @@ -1,41 +0,0 @@ - -
      -

      - - -

      - -
      -
      - -
      - -
      - - - -
      Type:
      -
        -
      • - -
      • -
      - - - - - -
      Fires:
      -
        -
      • -
      - - - -
      Example 1? 's':'' ?>
      - - -
      diff --git a/tools/jsdoc-template/tmpl/method.tmpl b/tools/jsdoc-template/tmpl/method.tmpl deleted file mode 100644 index fb3920a7..00000000 --- a/tools/jsdoc-template/tmpl/method.tmpl +++ /dev/null @@ -1,102 +0,0 @@ - -
      -

      - - -

      - -
      -
      - - -
      - -
      - - - -
      Type:
      -
        -
      • - -
      • -
      - - - -
      This:
      -
      - - - -
      Parameters:
      - - - - - - -
      Requires:
      -
        -
      • -
      - - - -
      Fires:
      -
        -
      • -
      - - - -
      Listens to Events:
      -
        -
      • -
      - - - -
      Listeners of This Event:
      -
        -
      • -
      - - - -
      Throws:
      - 1) { ?>
        -
      • -
      - - - - -
      Returns:
      - 1) { ?>
        -
      • -
      - - - - -
      Example 1? 's':'' ?>:
      - - - - -
      Alias 1 ? 'es' : '' ?>:
      - - -
      diff --git a/tools/jsdoc-template/tmpl/params.tmpl b/tools/jsdoc-template/tmpl/params.tmpl deleted file mode 100644 index 7478752f..00000000 --- a/tools/jsdoc-template/tmpl/params.tmpl +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      NameTypeArgumentDefaultDescription
      - - - - - - <optional>
      - - - - <nullable>
      - - - - <repeatable>
      - -
      - - - - -
      Properties
      - -
      \ No newline at end of file diff --git a/tools/jsdoc-template/tmpl/properties.tmpl b/tools/jsdoc-template/tmpl/properties.tmpl deleted file mode 100644 index 1dba575c..00000000 --- a/tools/jsdoc-template/tmpl/properties.tmpl +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      NameTypeArgumentDefaultDescription
      - - - - - - <optional>
      - - - - <nullable>
      - -
      - - - - -
      Properties
      -
      \ No newline at end of file diff --git a/tools/jsdoc-template/tmpl/returns.tmpl b/tools/jsdoc-template/tmpl/returns.tmpl deleted file mode 100644 index d0704592..00000000 --- a/tools/jsdoc-template/tmpl/returns.tmpl +++ /dev/null @@ -1,19 +0,0 @@ - -
      - -
      - - - -
      -
      - Type -
      -
      - -
      -
      - \ No newline at end of file diff --git a/tools/jsdoc-template/tmpl/source.tmpl b/tools/jsdoc-template/tmpl/source.tmpl deleted file mode 100644 index e559b5d1..00000000 --- a/tools/jsdoc-template/tmpl/source.tmpl +++ /dev/null @@ -1,8 +0,0 @@ - -
      -
      -
      -
      -
      \ No newline at end of file diff --git a/tools/jsdoc-template/tmpl/tutorial.tmpl b/tools/jsdoc-template/tmpl/tutorial.tmpl deleted file mode 100644 index 88a0ad52..00000000 --- a/tools/jsdoc-template/tmpl/tutorial.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -
      - -
      - 0) { ?> -
        -
      • -
      - - -

      -
      - -
      - -
      - -
      diff --git a/tools/jsdoc-template/tmpl/type.tmpl b/tools/jsdoc-template/tmpl/type.tmpl deleted file mode 100644 index ec2c6c0d..00000000 --- a/tools/jsdoc-template/tmpl/type.tmpl +++ /dev/null @@ -1,7 +0,0 @@ - - -| - \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..c24a4446 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "@tsconfig/node18/tsconfig.json", + "compilerOptions": { + "sourceMap": true, + "declaration": true, + "declarationDir": "types", + "outDir": "build" + }, + "include": ["src/**/*", "tests/**/*"] +} diff --git a/yarn.lock b/yarn.lock index 7c783672..e8b40d6b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,234 +2,35 @@ # yarn lockfile v1 -"@ampproject/remapping@^2.2.0": - version "2.2.1" - resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630" - integrity sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg== - dependencies: - "@jridgewell/gen-mapping" "^0.3.0" - "@jridgewell/trace-mapping" "^0.3.9" - -"@babel/code-frame@^7.22.13": - version "7.22.13" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.13.tgz#e3c1c099402598483b7a8c46a721d1038803755e" - integrity sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w== - dependencies: - "@babel/highlight" "^7.22.13" - chalk "^2.4.2" - -"@babel/compat-data@^7.22.9": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.23.3.tgz#3febd552541e62b5e883a25eb3effd7c7379db11" - integrity sha512-BmR4bWbDIoFJmJ9z2cZ8Gmm2MXgEDgjdWgpKmKWUt54UGFJdlj31ECtbaDvCG/qVdG3AQ1SfpZEs01lUFbzLOQ== - -"@babel/core@^7.7.5": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.23.3.tgz#5ec09c8803b91f51cc887dedc2654a35852849c9" - integrity sha512-Jg+msLuNuCJDyBvFv5+OKOUjWMZgd85bKjbICd3zWrKAo+bJ49HJufi7CQE0q0uR8NGyO6xkCACScNqyjHSZew== - dependencies: - "@ampproject/remapping" "^2.2.0" - "@babel/code-frame" "^7.22.13" - "@babel/generator" "^7.23.3" - "@babel/helper-compilation-targets" "^7.22.15" - "@babel/helper-module-transforms" "^7.23.3" - "@babel/helpers" "^7.23.2" - "@babel/parser" "^7.23.3" - "@babel/template" "^7.22.15" - "@babel/traverse" "^7.23.3" - "@babel/types" "^7.23.3" - convert-source-map "^2.0.0" - debug "^4.1.0" - gensync "^1.0.0-beta.2" - json5 "^2.2.3" - semver "^6.3.1" - -"@babel/generator@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.3.tgz#86e6e83d95903fbe7613f448613b8b319f330a8e" - integrity sha512-keeZWAV4LU3tW0qRi19HRpabC/ilM0HRBBzf9/k8FFiG4KVpiv0FIy4hHfLfFQZNhziCTPTmd59zoyv6DNISzg== - dependencies: - "@babel/types" "^7.23.3" - "@jridgewell/gen-mapping" "^0.3.2" - "@jridgewell/trace-mapping" "^0.3.17" - jsesc "^2.5.1" - -"@babel/helper-compilation-targets@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz#0698fc44551a26cf29f18d4662d5bf545a6cfc52" - integrity sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw== - dependencies: - "@babel/compat-data" "^7.22.9" - "@babel/helper-validator-option" "^7.22.15" - browserslist "^4.21.9" - lru-cache "^5.1.1" - semver "^6.3.1" - -"@babel/helper-environment-visitor@^7.22.20": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167" - integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA== - -"@babel/helper-function-name@^7.23.0": - version "7.23.0" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" - integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== - dependencies: - "@babel/template" "^7.22.15" - "@babel/types" "^7.23.0" - -"@babel/helper-hoist-variables@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb" - integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw== - dependencies: - "@babel/types" "^7.22.5" - -"@babel/helper-module-imports@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz#16146307acdc40cc00c3b2c647713076464bdbf0" - integrity sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w== - dependencies: - "@babel/types" "^7.22.15" - -"@babel/helper-module-transforms@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz#d7d12c3c5d30af5b3c0fcab2a6d5217773e2d0f1" - integrity sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ== - dependencies: - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-module-imports" "^7.22.15" - "@babel/helper-simple-access" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/helper-validator-identifier" "^7.22.20" - -"@babel/helper-simple-access@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz#4938357dc7d782b80ed6dbb03a0fba3d22b1d5de" - integrity sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w== - dependencies: - "@babel/types" "^7.22.5" - -"@babel/helper-split-export-declaration@^7.22.6": - version "7.22.6" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" - integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== - dependencies: - "@babel/types" "^7.22.5" - -"@babel/helper-string-parser@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f" - integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== - -"@babel/helper-validator-identifier@^7.22.20": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" - integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== - -"@babel/helper-validator-option@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz#694c30dfa1d09a6534cdfcafbe56789d36aba040" - integrity sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA== - -"@babel/helpers@^7.23.2": - version "7.23.2" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.23.2.tgz#2832549a6e37d484286e15ba36a5330483cac767" - integrity sha512-lzchcp8SjTSVe/fPmLwtWVBFC7+Tbn8LGHDVfDp9JGxpAY5opSaEFgt8UQvrnECWOTdji2mOWMz1rOhkHscmGQ== - dependencies: - "@babel/template" "^7.22.15" - "@babel/traverse" "^7.23.2" - "@babel/types" "^7.23.0" - -"@babel/highlight@^7.22.13": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.20.tgz#4ca92b71d80554b01427815e06f2df965b9c1f54" - integrity sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg== - dependencies: - "@babel/helper-validator-identifier" "^7.22.20" - chalk "^2.4.2" - js-tokens "^4.0.0" - -"@babel/parser@^7.20.15", "@babel/parser@^7.22.15", "@babel/parser@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.3.tgz#0ce0be31a4ca4f1884b5786057cadcb6c3be58f9" - integrity sha512-uVsWNvlVsIninV2prNz/3lHCb+5CJ+e+IUBfbjToAHODtfGYLfCFuY4AU7TskI+dAKk+njsPiBjq1gKTvZOBaw== - -"@babel/template@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" - integrity sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w== - dependencies: - "@babel/code-frame" "^7.22.13" - "@babel/parser" "^7.22.15" - "@babel/types" "^7.22.15" - -"@babel/traverse@^7.23.2", "@babel/traverse@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.3.tgz#26ee5f252e725aa7aca3474aa5b324eaf7908b5b" - integrity sha512-+K0yF1/9yR0oHdE0StHuEj3uTPzwwbrLGfNOndVJVV2TqA5+j3oljJUb4nmB954FLGjNem976+B+eDuLIjesiQ== - dependencies: - "@babel/code-frame" "^7.22.13" - "@babel/generator" "^7.23.3" - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-function-name" "^7.23.0" - "@babel/helper-hoist-variables" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/parser" "^7.23.3" - "@babel/types" "^7.23.3" - debug "^4.1.0" - globals "^11.1.0" - -"@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.3.tgz#d5ea892c07f2ec371ac704420f4dcdb07b5f9598" - integrity sha512-OZnvoH2l8PK5eUvEcUyCt/sXgr/h+UWpVuBbOljwcrAgUl6lpchoQ++PHGyQy1AtYnVA6CEq3y5xeEI10brpXw== - dependencies: - "@babel/helper-string-parser" "^7.22.5" - "@babel/helper-validator-identifier" "^7.22.20" - to-fast-properties "^2.0.0" - -"@istanbuljs/load-nyc-config@^1.0.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" - integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== - dependencies: - camelcase "^5.3.1" - find-up "^4.1.0" - get-package-type "^0.1.0" - js-yaml "^3.13.1" - resolve-from "^5.0.0" +"@ava/typescript@^4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@ava/typescript/-/typescript-4.1.0.tgz#0dde7b3bbcfe59c1424fb20eb289b4a2b3694418" + integrity sha512-1iWZQ/nr9iflhLK9VN8H+1oDZqe93qxNnyYUz+jTzkYPAHc5fdZXBrqmNIgIfFhWYXK5OaQ5YtC7OmLeTNhVEg== + dependencies: + escape-string-regexp "^5.0.0" + execa "^7.1.1" -"@istanbuljs/schema@^0.1.2": +"@bcoe/v8-coverage@^0.2.3": + version "0.2.3" + resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" + integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== + +"@istanbuljs/schema@^0.1.2", "@istanbuljs/schema@^0.1.3": version "0.1.3" resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": - version "0.3.3" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" - integrity sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ== - dependencies: - "@jridgewell/set-array" "^1.0.1" - "@jridgewell/sourcemap-codec" "^1.4.10" - "@jridgewell/trace-mapping" "^0.3.9" - "@jridgewell/resolve-uri@^3.1.0": version "3.1.1" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== -"@jridgewell/set-array@^1.0.1": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" - integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== - -"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": +"@jridgewell/sourcemap-codec@^1.4.14": version "1.4.15" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== -"@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9": +"@jridgewell/trace-mapping@^0.3.12": version "0.3.20" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz#72e45707cf240fa6b081d0366f8265b0cd10197f" integrity sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q== @@ -237,73 +38,138 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@jsdoc/salty@^0.2.1": - version "0.2.5" - resolved "https://registry.yarnpkg.com/@jsdoc/salty/-/salty-0.2.5.tgz#1b2fa5bb8c66485b536d86eee877c263d322f692" - integrity sha512-TfRP53RqunNe2HBobVBJ0VLhK1HbfvBYeTC1ahnN64PWvyYyGebmMiPkuwvD9fpw2ZbkoPb8Q7mwy0aR8Z9rvw== +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== dependencies: - lodash "^4.17.21" + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" -"@types/linkify-it@*": - version "3.0.5" - resolved "https://registry.yarnpkg.com/@types/linkify-it/-/linkify-it-3.0.5.tgz#1e78a3ac2428e6d7e6c05c1665c242023a4601d8" - integrity sha512-yg6E+u0/+Zjva+buc3EIb+29XEg4wltq7cSmd4Uc2EE/1nUVmxyzpX6gUXD0V8jIrG0r7YeOGVIbYRkxeooCtw== +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== -"@types/markdown-it@^12.2.3": - version "12.2.3" - resolved "https://registry.yarnpkg.com/@types/markdown-it/-/markdown-it-12.2.3.tgz#0d6f6e5e413f8daaa26522904597be3d6cd93b51" - integrity sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ== +"@nodelib/fs.walk@^1.2.3": + version "1.2.8" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== dependencies: - "@types/linkify-it" "*" - "@types/mdurl" "*" + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" -"@types/mdurl@*": - version "1.0.5" - resolved "https://registry.yarnpkg.com/@types/mdurl/-/mdurl-1.0.5.tgz#3e0d2db570e9fb6ccb2dc8fde0be1d79ac810d39" - integrity sha512-6L6VymKTzYSrEf4Nev4Xa1LCHKrlTlYCBMTlQKFuddo1CvQcE52I0mwfOJayueUC7MJuXOeHTcIU683lzd0cUA== +"@sinonjs/commons@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-2.0.0.tgz#fd4ca5b063554307e8327b4564bd56d3b73924a3" + integrity sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg== + dependencies: + type-detect "4.0.8" -aggregate-error@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" - integrity sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA== +"@sinonjs/commons@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.0.tgz#beb434fe875d965265e04722ccfc21df7f755d72" + integrity sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA== dependencies: - clean-stack "^2.0.0" - indent-string "^4.0.0" + type-detect "4.0.8" -ajv@^6.12.3: - version "6.12.6" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" - integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== +"@sinonjs/fake-timers@^10.0.2": + version "10.3.0" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz#55fdff1ecab9f354019129daf4df0dd4d923ea66" + integrity sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA== dependencies: - fast-deep-equal "^3.1.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" + "@sinonjs/commons" "^3.0.0" -ansi-colors@4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" - integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== +"@sinonjs/fake-timers@^11.2.2": + version "11.2.2" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-11.2.2.tgz#50063cc3574f4a27bd8453180a04171c85cc9699" + integrity sha512-G2piCSxQ7oWOxwGSAyFHfPIsyeJGXYtc6mFbnFA+kRXkiEnTl8c/8jul2S329iFBnDI9HGoeWWAZvuvOkZccgw== + dependencies: + "@sinonjs/commons" "^3.0.0" + +"@sinonjs/samsam@^8.0.0": + version "8.0.0" + resolved "https://registry.yarnpkg.com/@sinonjs/samsam/-/samsam-8.0.0.tgz#0d488c91efb3fa1442e26abea81759dfc8b5ac60" + integrity sha512-Bp8KUVlLp8ibJZrnvq2foVhP0IVX2CIprMJPK0vqGqgrDa0OHVKeZyBykqskkrdxV6yKBPmGasO8LVjAKR3Gew== + dependencies: + "@sinonjs/commons" "^2.0.0" + lodash.get "^4.4.2" + type-detect "^4.0.8" + +"@sinonjs/text-encoding@^0.7.1": + version "0.7.2" + resolved "https://registry.yarnpkg.com/@sinonjs/text-encoding/-/text-encoding-0.7.2.tgz#5981a8db18b56ba38ef0efb7d995b12aa7b51918" + integrity sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ== + +"@tsconfig/node18@^18.2.2": + version "18.2.2" + resolved "https://registry.yarnpkg.com/@tsconfig/node18/-/node18-18.2.2.tgz#81fb16ecff0d400b1cbadbf76713b50f331029ce" + integrity sha512-d6McJeGsuoRlwWZmVIeE8CUA27lu6jLjvv1JzqmpsytOYYbVi1tHZEnwCNVOXnj4pyLvneZlFlpXUK+X9wBWyw== + +"@types/istanbul-lib-coverage@^2.0.1": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" + integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== + +"@types/node@^20.9.0": + version "20.9.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.0.tgz#bfcdc230583aeb891cf51e73cfdaacdd8deae298" + integrity sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw== + dependencies: + undici-types "~5.26.4" + +"@types/sinon@^17.0.1": + version "17.0.1" + resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-17.0.1.tgz#f17816577ee61d462cb7bfcea6ff64fb05063256" + integrity sha512-Q2Go6TJetYn5Za1+RJA1Aik61Oa2FS8SuJ0juIqUuJ5dZR4wvhKfmSdIqWtQ3P6gljKWjW0/R7FZkA4oXVL6OA== + dependencies: + "@types/sinonjs__fake-timers" "*" + +"@types/sinonjs__fake-timers@*": + version "8.1.5" + resolved "https://registry.yarnpkg.com/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.5.tgz#5fd3592ff10c1e9695d377020c033116cc2889f2" + integrity sha512-mQkU2jY8jJEF7YHjHvsQO8+3ughTL1mcnn96igfhONmR+fUPSKIkefQYpSe8bsly2Ep7oQbn/6VG5/9/0qcArQ== + +acorn-walk@^8.2.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.0.tgz#2097665af50fd0cf7a2dfccd2b9368964e66540f" + integrity sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA== + +acorn@^8.8.2: + version "8.11.2" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.2.tgz#ca0d78b51895be5390a5903c5b3bdcdaf78ae40b" + integrity sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w== + +aggregate-error@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-4.0.1.tgz#25091fe1573b9e0be892aeda15c7c66a545f758e" + integrity sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w== + dependencies: + clean-stack "^4.0.0" + indent-string "^5.0.0" ansi-regex@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== -ansi-styles@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" - integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== - dependencies: - color-convert "^1.9.0" +ansi-regex@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.0.1.tgz#3183e38fae9a65d7cb5e53945cd5897d0260a06a" + integrity sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA== -ansi-styles@^4.0.0, ansi-styles@^4.1.0: +ansi-styles@^4.0.0: version "4.3.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== dependencies: color-convert "^2.0.1" +ansi-styles@^6.0.0, ansi-styles@^6.2.1: + version "6.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" + integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== + anymatch@~3.1.2: version "3.1.3" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" @@ -312,18 +178,6 @@ anymatch@~3.1.2: normalize-path "^3.0.0" picomatch "^2.0.4" -append-transform@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-2.0.0.tgz#99d9d29c7b38391e6f428d28ce136551f0b77e12" - integrity sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg== - dependencies: - default-require-extensions "^3.0.0" - -archy@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" - integrity sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw== - argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -331,64 +185,84 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" -argparse@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" - integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== - -asn1@~0.2.3: - version "0.2.6" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.6.tgz#0d3a7bb6e64e02a90c0303b31f292868ea09a08d" - integrity sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ== - dependencies: - safer-buffer "~2.1.0" - -assert-plus@1.0.0, assert-plus@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" - integrity sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw== - -async@^0.2.9: - version "0.2.10" - resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1" - integrity sha512-eAkdoKxU6/LkKDBzLpT+t6Ff5EtfSF4wx1WfJiPEEV7WNLnDaRXk0oVysiEPm262roaachGexwUv94WhSgN5TQ== +array-find-index@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" + integrity sha512-M1HQyIXcBGtVywBt8WVdim+lrNaK7VHp99Qt5pSNziXznKHViIBbXWtfRTpEFpF/c4FdfxNAsCCwPp5phBYJtw== -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== +arrgv@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/arrgv/-/arrgv-1.0.2.tgz#025ed55a6a433cad9b604f8112fc4292715a6ec0" + integrity sha512-a4eg4yhp7mmruZDQFqVMlxNRFGi/i1r87pt8SDHy0/I8PqSXoUTlWZRdAZo0VXgvEARcujbtTk8kiZRi1uDGRw== -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - integrity sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA== +arrify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-3.0.0.tgz#ccdefb8eaf2a1d2ab0da1ca2ce53118759fd46bc" + integrity sha512-tLkvA81vQG/XqE2mjDkGQHoOINtMHtysSnemrmoGe6PydDPMRbVugqyk4A6V/WDWEfm3l+0d8anA9r8cv/5Jaw== -aws4@^1.8.0: - version "1.12.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.12.0.tgz#ce1c9d143389679e253b314241ea9aa5cec980d3" - integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg== +ava@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/ava/-/ava-5.3.1.tgz#335737dd963b7941b90214836cea2e8de1f4d5f4" + integrity sha512-Scv9a4gMOXB6+ni4toLuhAm9KYWEjsgBglJl+kMGI5+IVDt120CCDZyB5HNU9DjmLI2t4I0GbnxGLmmRfGTJGg== + dependencies: + acorn "^8.8.2" + acorn-walk "^8.2.0" + ansi-styles "^6.2.1" + arrgv "^1.0.2" + arrify "^3.0.0" + callsites "^4.0.0" + cbor "^8.1.0" + chalk "^5.2.0" + chokidar "^3.5.3" + chunkd "^2.0.1" + ci-info "^3.8.0" + ci-parallel-vars "^1.0.1" + clean-yaml-object "^0.1.0" + cli-truncate "^3.1.0" + code-excerpt "^4.0.0" + common-path-prefix "^3.0.0" + concordance "^5.0.4" + currently-unhandled "^0.4.1" + debug "^4.3.4" + emittery "^1.0.1" + figures "^5.0.0" + globby "^13.1.4" + ignore-by-default "^2.1.0" + indent-string "^5.0.0" + is-error "^2.2.2" + is-plain-object "^5.0.0" + is-promise "^4.0.0" + matcher "^5.0.0" + mem "^9.0.2" + ms "^2.1.3" + p-event "^5.0.1" + p-map "^5.5.0" + picomatch "^2.3.1" + pkg-conf "^4.0.0" + plur "^5.1.0" + pretty-ms "^8.0.0" + resolve-cwd "^3.0.0" + stack-utils "^2.0.6" + strip-ansi "^7.0.1" + supertap "^3.0.1" + temp-dir "^3.0.0" + write-file-atomic "^5.0.1" + yargs "^17.7.2" balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== -bcrypt-pbkdf@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" - integrity sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w== - dependencies: - tweetnacl "^0.14.3" - binary-extensions@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== -bluebird@^3.7.2: - version "3.7.2" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" - integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== +blueimp-md5@^2.10.0: + version "2.19.0" + resolved "https://registry.yarnpkg.com/blueimp-md5/-/blueimp-md5-2.19.0.tgz#b53feea5498dcb53dc6ec4b823adb84b729c4af0" + integrity sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w== brace-expansion@^1.1.7: version "1.1.11" @@ -398,90 +272,49 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" -brace-expansion@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" - integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== - dependencies: - balanced-match "^1.0.0" - -braces@~3.0.2: +braces@^3.0.2, braces@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== dependencies: fill-range "^7.0.1" -browser-stdout@1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" - integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== - -browserslist@^4.21.9: - version "4.22.1" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.22.1.tgz#ba91958d1a59b87dab6fed8dfbcb3da5e2e9c619" - integrity sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ== - dependencies: - caniuse-lite "^1.0.30001541" - electron-to-chromium "^1.4.535" - node-releases "^2.0.13" - update-browserslist-db "^1.0.13" - -caching-transform@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/caching-transform/-/caching-transform-4.0.0.tgz#00d297a4206d71e2163c39eaffa8157ac0651f0f" - integrity sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA== +c8@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/c8/-/c8-8.0.1.tgz#bafd60be680e66c5530ee69f621e45b1364af9fd" + integrity sha512-EINpopxZNH1mETuI0DzRA4MZpAUH+IFiRhnmFD3vFr3vdrgxqi3VfE3KL0AIL+zDq8rC9bZqwM/VDmmoe04y7w== dependencies: - hasha "^5.0.0" - make-dir "^3.0.0" - package-hash "^4.0.0" - write-file-atomic "^3.0.0" - -camelcase@^5.0.0, camelcase@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" - integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== - -camelcase@^6.0.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" - integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== - -caniuse-lite@^1.0.30001541: - version "1.0.30001561" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001561.tgz#752f21f56f96f1b1a52e97aae98c57c562d5d9da" - integrity sha512-NTt0DNoKe958Q0BE0j0c1V9jbUzhBxHIEJy7asmGrpE0yG63KTV7PLHPnK2E1O9RsQrQ081I3NLuXGS6zht3cw== - -caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw== + "@bcoe/v8-coverage" "^0.2.3" + "@istanbuljs/schema" "^0.1.3" + find-up "^5.0.0" + foreground-child "^2.0.0" + istanbul-lib-coverage "^3.2.0" + istanbul-lib-report "^3.0.1" + istanbul-reports "^3.1.6" + rimraf "^3.0.2" + test-exclude "^6.0.0" + v8-to-istanbul "^9.0.0" + yargs "^17.7.2" + yargs-parser "^21.1.1" -catharsis@^0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/catharsis/-/catharsis-0.9.0.tgz#40382a168be0e6da308c277d3a2b3eb40c7d2121" - integrity sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A== - dependencies: - lodash "^4.17.15" +callsites@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-4.1.0.tgz#de72b98612eed4e1e2564c952498677faa9d86c2" + integrity sha512-aBMbD1Xxay75ViYezwT40aQONfr+pSXTHwNKvIXhXD6+LY3F1dLIcceoC5OZKBVHbXcysz1hL9D2w0JJIMXpUw== -chalk@^2.4.2: - version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" - integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== +cbor@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/cbor/-/cbor-8.1.0.tgz#cfc56437e770b73417a2ecbfc9caf6b771af60d5" + integrity sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg== dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" + nofilter "^3.1.0" -chalk@^4.1.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" - integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" +chalk@^5.2.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385" + integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w== -chokidar@3.5.3: +chokidar@^3.5.3: version "3.5.3" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== @@ -496,35 +329,56 @@ chokidar@3.5.3: optionalDependencies: fsevents "~2.3.2" -clean-stack@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" - integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== +chunkd@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/chunkd/-/chunkd-2.0.1.tgz#49cd1d7b06992dc4f7fccd962fe2a101ee7da920" + integrity sha512-7d58XsFmOq0j6el67Ug9mHf9ELUXsQXYJBkyxhH/k+6Ke0qXRnv0kbemx+Twc6fRJ07C49lcbdgm9FL1Ei/6SQ== -cliui@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" - integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== +ci-info@^3.8.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" + integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== + +ci-parallel-vars@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ci-parallel-vars/-/ci-parallel-vars-1.0.1.tgz#e87ff0625ccf9d286985b29b4ada8485ca9ffbc2" + integrity sha512-uvzpYrpmidaoxvIQHM+rKSrigjOe9feHYbw4uOI2gdfe1C3xIlxO+kVXq83WQWNniTf8bAxVpy+cQeFQsMERKg== + +clean-stack@^4.0.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-4.2.0.tgz#c464e4cde4ac789f4e0735c5d75beb49d7b30b31" + integrity sha512-LYv6XPxoyODi36Dp976riBtSY27VmFo+MKqEU9QCCWyTrdEPDog+RWA7xQWHi6Vbp61j5c4cdzzX1NidnwtUWg== dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.0" - wrap-ansi "^6.2.0" + escape-string-regexp "5.0.0" + +clean-yaml-object@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/clean-yaml-object/-/clean-yaml-object-0.1.0.tgz#63fb110dc2ce1a84dc21f6d9334876d010ae8b68" + integrity sha512-3yONmlN9CSAkzNwnRCiJQ7Q2xK5mWuEfL3PuTZcAUzhObbXsfsnMptJzXwz93nc5zn9V9TwCVMmV7w4xsm43dw== + +cli-truncate@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-3.1.0.tgz#3f23ab12535e3d73e839bb43e73c9de487db1389" + integrity sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA== + dependencies: + slice-ansi "^5.0.0" + string-width "^5.0.0" -cliui@^7.0.2: - version "7.0.4" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" - integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== +cliui@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" + integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== dependencies: string-width "^4.2.0" - strip-ansi "^6.0.0" + strip-ansi "^6.0.1" wrap-ansi "^7.0.0" -color-convert@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== +code-excerpt@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/code-excerpt/-/code-excerpt-4.0.0.tgz#2de7d46e98514385cb01f7b3b741320115f4c95e" + integrity sha512-xxodCmBen3iy2i0WtAK8FlFNrRzjUqjRsMfho58xT/wvZU1YTM3fCnRjcy1gJPMepaRlgm/0e6w8SpWHpn3/cA== dependencies: - color-name "1.1.3" + convert-to-spaces "^2.0.1" color-convert@^2.0.1: version "2.0.1" @@ -533,58 +387,44 @@ color-convert@^2.0.1: dependencies: color-name "~1.1.4" -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== - color-name@~1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -combined-stream@^1.0.6, combined-stream@~1.0.6: - version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" - integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== - dependencies: - delayed-stream "~1.0.0" - -commondir@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" - integrity sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg== +common-path-prefix@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/common-path-prefix/-/common-path-prefix-3.0.0.tgz#7d007a7e07c58c4b4d5f433131a19141b29f11e0" + integrity sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w== concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== -convert-source-map@^1.7.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" - integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== +concordance@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/concordance/-/concordance-5.0.4.tgz#9896073261adced72f88d60e4d56f8efc4bbbbd2" + integrity sha512-OAcsnTEYu1ARJqWVGwf4zh4JDfHZEaSNlNccFmt8YjB2l/n19/PF2viLINHc57vO4FKIAFl2FWASIGZZWZ2Kxw== + dependencies: + date-time "^3.1.0" + esutils "^2.0.3" + fast-diff "^1.2.0" + js-string-escape "^1.0.1" + lodash "^4.17.15" + md5-hex "^3.0.1" + semver "^7.3.2" + well-known-symbols "^2.0.0" convert-source-map@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== -core-util-is@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ== - -coveralls@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.1.1.tgz#f5d4431d8b5ae69c5079c8f8ca00d64ac77cf081" - integrity sha512-+dxnG2NHncSD1NrqbSM3dn/lE57O6Qf/koe9+I7c+wzkqRmEvcp0kgJdxKInzYzkICKkFMZsX3Vct3++tsF9ww== - dependencies: - js-yaml "^3.13.1" - lcov-parse "^1.0.0" - log-driver "^1.2.7" - minimist "^1.2.5" - request "^2.88.2" +convert-to-spaces@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/convert-to-spaces/-/convert-to-spaces-2.0.1.tgz#61a6c98f8aa626c16b296b862a91412a33bceb6b" + integrity sha512-rcQ1bsQO9799wq24uE5AM2tAILy4gXGIK/njFWcVQkGNZ96edlpY+A7bjwvzjYvLDyzmG1MmMLZhpcsb+klNMQ== cross-spawn@^7.0.0, cross-spawn@^7.0.3: version "7.0.3" @@ -595,89 +435,68 @@ cross-spawn@^7.0.0, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" -dashdash@^1.12.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" - integrity sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g== +currently-unhandled@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" + integrity sha512-/fITjgjGU50vjQ4FH6eUoYu+iUoUKIXws2hL15JJpIR+BbTxaXQsMuuyjtNh2WqsSBS5nsaZHFsFecyw5CCAng== + dependencies: + array-find-index "^1.0.1" + +date-time@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/date-time/-/date-time-3.1.0.tgz#0d1e934d170579f481ed8df1e2b8ff70ee845e1e" + integrity sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg== dependencies: - assert-plus "^1.0.0" + time-zone "^1.0.0" -debug@4.3.4, debug@^4.1.0, debug@^4.1.1: +debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== dependencies: ms "2.1.2" -decamelize@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" - integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== - -decamelize@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" - integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== +diff@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-5.1.0.tgz#bc52d298c5ea8df9194800224445ed43ffc87e40" + integrity sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw== -default-require-extensions@^3.0.0: +dir-glob@^3.0.1: version "3.0.1" - resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-3.0.1.tgz#bfae00feeaeada68c2ae256c62540f60b80625bd" - integrity sha512-eXTJmRbm2TIt9MgWTsOH1wEuhew6XGZcMeGKCtLedIg/NCsg1iBePXkceTdK4Fii7pzmN9tGsZhKzZ4h7O/fxw== + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== dependencies: - strip-bom "^4.0.0" - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== - -diff@5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" - integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== + path-type "^4.0.0" -ecc-jsbn@~0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" - integrity sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw== - dependencies: - jsbn "~0.1.0" - safer-buffer "^2.1.0" +eastasianwidth@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" + integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== -electron-to-chromium@^1.4.535: - version "1.4.581" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.581.tgz#23b684c67bf56d4284e95598c05a5d266653b6d8" - integrity sha512-6uhqWBIapTJUxgPTCHH9sqdbxIMPt7oXl0VcAL1kOtlU6aECdcMncCrX5Z7sHQ/invtrC9jUQUef7+HhO8vVFw== +emittery@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/emittery/-/emittery-1.0.1.tgz#e0cf36e2d7eef94dbd025969f642d57ae50a56cd" + integrity sha512-2ID6FdrMD9KDLldGesP6317G78K7km/kMcwItRtVFva7I/cSEOIaLpewaUb+YLXVwdAp3Ctfxh/V5zIl1sj7dQ== emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== -entities@~2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/entities/-/entities-2.1.0.tgz#992d3129cf7df6870b96c57858c249a120f8b8b5" - integrity sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w== - -es6-error@^4.0.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.1.1.tgz#9e3af407459deed47e9a91f9b885a84eb05c561d" - integrity sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg== +emoji-regex@^9.2.2: + version "9.2.2" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" + integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== -escape-string-regexp@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" - integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== - -escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== +escape-string-regexp@5.0.0, escape-string-regexp@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz#4683126b500b61762f2dbebace1806e8be31b1c8" + integrity sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw== escape-string-regexp@^2.0.0: version "2.0.0" @@ -689,30 +508,56 @@ esprima@^4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -extend@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" - integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== +esutils@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -extsprintf@1.3.0: +execa@^7.1.1: + version "7.2.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-7.2.0.tgz#657e75ba984f42a70f38928cedc87d6f2d4fe4e9" + integrity sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.1" + human-signals "^4.3.0" + is-stream "^3.0.0" + merge-stream "^2.0.0" + npm-run-path "^5.1.0" + onetime "^6.0.0" + signal-exit "^3.0.7" + strip-final-newline "^3.0.0" + +fast-diff@^1.2.0: version "1.3.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" - integrity sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g== + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" + integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== -extsprintf@^1.2.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.1.tgz#8d172c064867f235c0c84a596806d279bf4bcc07" - integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA== +fast-glob@^3.3.0: + version "3.3.2" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" + integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" -fast-deep-equal@^3.1.1: - version "3.1.3" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" - integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fastq@^1.6.0: + version "1.15.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a" + integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw== + dependencies: + reusify "^1.0.4" -fast-json-stable-stringify@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" - integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== +figures@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-5.0.0.tgz#126cd055052dea699f8a54e8c9450e6ecfc44d5f" + integrity sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg== + dependencies: + escape-string-regexp "^5.0.0" + is-unicode-supported "^1.2.0" fill-range@^7.0.1: version "7.0.1" @@ -721,16 +566,7 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" -find-cache-dir@^3.2.0: - version "3.3.2" - resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.2.tgz#b30c5b6eff0730731aea9bbd9dbecbd80256d64b" - integrity sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig== - dependencies: - commondir "^1.0.1" - make-dir "^3.0.2" - pkg-dir "^4.1.0" - -find-up@5.0.0: +find-up@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== @@ -738,18 +574,13 @@ find-up@5.0.0: locate-path "^6.0.0" path-exists "^4.0.0" -find-up@^4.0.0, find-up@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" - integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== +find-up@^6.0.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-6.3.0.tgz#2abab3d3280b2dc7ac10199ef324c4e002c8c790" + integrity sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw== dependencies: - locate-path "^5.0.0" - path-exists "^4.0.0" - -flat@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" - integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== + locate-path "^7.1.0" + path-exists "^5.0.0" foreground-child@^2.0.0: version "2.0.0" @@ -759,25 +590,6 @@ foreground-child@^2.0.0: cross-spawn "^7.0.0" signal-exit "^3.0.2" -forever-agent@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" - integrity sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw== - -form-data@~2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" - integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.6" - mime-types "^2.1.12" - -fromentries@^1.2.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/fromentries/-/fromentries-1.3.2.tgz#e4bca6808816bf8f93b52750f1127f5a6fd86e3a" - integrity sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg== - fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -788,48 +600,24 @@ fsevents@~2.3.2: resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== -gensync@^1.0.0-beta.2: - version "1.0.0-beta.2" - resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" - integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== - -get-caller-file@^2.0.1, get-caller-file@^2.0.5: +get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-package-type@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" - integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== - -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" - integrity sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng== - dependencies: - assert-plus "^1.0.0" +get-stream@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" + integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== -glob-parent@~5.1.2: +glob-parent@^5.1.2, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== dependencies: is-glob "^4.0.1" -glob@7.2.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" - integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: +glob@^7.1.3, glob@^7.1.4: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -841,75 +629,51 @@ glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" -globals@^11.1.0: - version "11.12.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" - integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== - -graceful-fs@^4.1.15, graceful-fs@^4.1.9: - version "4.2.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" - integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== - -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - integrity sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q== - -har-validator@~5.1.3: - version "5.1.5" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.5.tgz#1f0803b9f8cb20c0fa13822df1ecddb36bde1efd" - integrity sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w== +globby@^13.1.4: + version "13.2.2" + resolved "https://registry.yarnpkg.com/globby/-/globby-13.2.2.tgz#63b90b1bf68619c2135475cbd4e71e66aa090592" + integrity sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w== dependencies: - ajv "^6.12.3" - har-schema "^2.0.0" - -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== + dir-glob "^3.0.1" + fast-glob "^3.3.0" + ignore "^5.2.4" + merge2 "^1.4.1" + slash "^4.0.0" has-flag@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -hasha@^5.0.0: - version "5.2.2" - resolved "https://registry.yarnpkg.com/hasha/-/hasha-5.2.2.tgz#a48477989b3b327aea3c04f53096d816d97522a1" - integrity sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ== - dependencies: - is-stream "^2.0.0" - type-fest "^0.8.0" - -he@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" - integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== - html-escaper@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" - integrity sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ== - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" +human-signals@^4.3.0: + version "4.3.1" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-4.3.1.tgz#ab7f811e851fca97ffbd2c1fe9a958964de321b2" + integrity sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ== + +ignore-by-default@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-2.1.0.tgz#c0e0de1a99b6065bdc93315a6f728867981464db" + integrity sha512-yiWd4GVmJp0Q6ghmM2B/V3oZGRmjrKLXvHR3TE1nfoXsmoggllfZUQe74EN0fJdPFZu2NIvNdrMMLm3OsV7Ohw== + +ignore@^5.2.4: + version "5.2.4" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" + integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== -indent-string@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" - integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== +indent-string@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-5.0.0.tgz#4fd2980fccaf8622d14c64d694f4cf33c81951a5" + integrity sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg== inflight@^1.0.4: version "1.0.6" @@ -924,6 +688,11 @@ inherits@2: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== +irregular-plurals@^3.3.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/irregular-plurals/-/irregular-plurals-3.5.0.tgz#0835e6639aa8425bdc8b0d33d0dc4e89d9c01d2b" + integrity sha512-1ANGLZ+Nkv1ptFb2pa8oG8Lem4krflKuX/gINiHJHjJUKaJHk/SXk5x6K3J+39/p0h1RQ2saROclJJ+QLvETCQ== + is-binary-path@~2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" @@ -931,6 +700,11 @@ is-binary-path@~2.1.0: dependencies: binary-extensions "^2.0.0" +is-error@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/is-error/-/is-error-2.2.2.tgz#c10ade187b3c93510c5470a5567833ee25649843" + integrity sha512-IOQqts/aHWbiisY5DuPJQ0gcbvaLFCa7fBa9xoLfxBZvQ+ZI/Zh9xoI7Gk+G64N0FdK4AbibytHht2tWgpJWLg== + is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" @@ -941,6 +715,11 @@ is-fullwidth-code-point@^3.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== +is-fullwidth-code-point@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz#fae3167c729e7463f8461ce512b080a49268aa88" + integrity sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ== + is-glob@^4.0.1, is-glob@~4.0.1: version "4.0.3" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" @@ -953,76 +732,42 @@ is-number@^7.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== -is-plain-obj@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" - integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== +is-plain-object@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344" + integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== -is-stream@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" - integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== +is-promise@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-4.0.0.tgz#42ff9f84206c1991d26debf520dd5c01042dd2f3" + integrity sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ== -is-typedarray@^1.0.0, is-typedarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== +is-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-3.0.0.tgz#e6bfd7aa6bef69f4f472ce9bb681e3e57b4319ac" + integrity sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA== -is-unicode-supported@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" - integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== +is-unicode-supported@^1.2.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz#d824984b616c292a2e198207d4a609983842f714" + integrity sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ== -is-windows@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" - integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== +isarray@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ== isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" - integrity sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g== - istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756" integrity sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg== -istanbul-lib-hook@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz#8f84c9434888cc6b1d0a9d7092a76d239ebf0cc6" - integrity sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ== - dependencies: - append-transform "^2.0.0" - -istanbul-lib-instrument@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz#873c6fff897450118222774696a3f28902d77c1d" - integrity sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ== - dependencies: - "@babel/core" "^7.7.5" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-coverage "^3.0.0" - semver "^6.3.0" - -istanbul-lib-processinfo@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.3.tgz#366d454cd0dcb7eb6e0e419378e60072c8626169" - integrity sha512-NkwHbo3E00oybX6NGJi6ar0B29vxyvNwoC7eJ4G4Yq28UfY758Hgn/heV8VRFhevPED4LXfFz0DQ8z/0kw9zMg== - dependencies: - archy "^1.0.0" - cross-spawn "^7.0.3" - istanbul-lib-coverage "^3.2.0" - p-map "^3.0.0" - rimraf "^3.0.0" - uuid "^8.3.2" - -istanbul-lib-report@^3.0.0: +istanbul-lib-report@^3.0.0, istanbul-lib-report@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" integrity sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw== @@ -1031,16 +776,7 @@ istanbul-lib-report@^3.0.0: make-dir "^4.0.0" supports-color "^7.1.0" -istanbul-lib-source-maps@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" - integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== - dependencies: - debug "^4.1.1" - istanbul-lib-coverage "^3.0.0" - source-map "^0.6.1" - -istanbul-reports@^3.0.2: +istanbul-reports@^3.1.6: version "3.1.6" resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.6.tgz#2544bcab4768154281a2f0870471902704ccaa1a" integrity sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg== @@ -1048,19 +784,12 @@ istanbul-reports@^3.0.2: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" -js-tokens@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== - -js-yaml@4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" - integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== - dependencies: - argparse "^2.0.1" +js-string-escape@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/js-string-escape/-/js-string-escape-1.0.1.tgz#e2625badbc0d67c7533e9edc1068c587ae4137ef" + integrity sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg== -js-yaml@^3.13.1: +js-yaml@^3.14.1: version "3.14.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== @@ -1068,99 +797,15 @@ js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" -js2xmlparser@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/js2xmlparser/-/js2xmlparser-4.0.2.tgz#2a1fdf01e90585ef2ae872a01bc169c6a8d5e60a" - integrity sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA== - dependencies: - xmlcreate "^2.0.4" - -jsbn@~0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" - integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== - -jsdoc@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/jsdoc/-/jsdoc-4.0.2.tgz#a1273beba964cf433ddf7a70c23fd02c3c60296e" - integrity sha512-e8cIg2z62InH7azBBi3EsSEqrKx+nUtAS5bBcYTSpZFA+vhNPyhv8PTFZ0WsjOPDj04/dOLlm08EDcQJDqaGQg== - dependencies: - "@babel/parser" "^7.20.15" - "@jsdoc/salty" "^0.2.1" - "@types/markdown-it" "^12.2.3" - bluebird "^3.7.2" - catharsis "^0.9.0" - escape-string-regexp "^2.0.0" - js2xmlparser "^4.0.2" - klaw "^3.0.0" - markdown-it "^12.3.2" - markdown-it-anchor "^8.4.1" - marked "^4.0.10" - mkdirp "^1.0.4" - requizzle "^0.2.3" - strip-json-comments "^3.1.0" - underscore "~1.13.2" - -jsesc@^2.5.1: - version "2.5.2" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" - integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== - -json-schema-traverse@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" - integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== - -json-schema@0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz#f7de4cf6efab838ebaeb3236474cbba5a1930ab5" - integrity sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA== - -json-stringify-safe@~5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== - -json5@^2.2.3: - version "2.2.3" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" - integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== - -jsprim@^1.2.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.2.tgz#712c65533a15c878ba59e9ed5f0e26d5b77c5feb" - integrity sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw== - dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.4.0" - verror "1.10.0" - -klaw@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/klaw/-/klaw-3.0.0.tgz#b11bec9cf2492f06756d6e809ab73a2910259146" - integrity sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g== - dependencies: - graceful-fs "^4.1.9" - -lcov-parse@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-1.0.0.tgz#eb0d46b54111ebc561acb4c408ef9363bdc8f7e0" - integrity sha512-aprLII/vPzuQvYZnDRU78Fns9I2Ag3gi4Ipga/hxnVMCZC8DnR2nI7XBqrPoywGfxqIx/DgarGvDJZAD3YBTgQ== - -linkify-it@^3.0.1: - version "3.0.3" - resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-3.0.3.tgz#a98baf44ce45a550efb4d49c769d07524cc2fa2e" - integrity sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ== - dependencies: - uc.micro "^1.0.1" +just-extend@^4.0.2: + version "4.2.1" + resolved "https://registry.yarnpkg.com/just-extend/-/just-extend-4.2.1.tgz#ef5e589afb61e5d66b24eca749409a8939a8c744" + integrity sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg== -locate-path@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" - integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== - dependencies: - p-locate "^4.1.0" +load-json-file@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-7.0.1.tgz#a3c9fde6beffb6bedb5acf104fad6bb1604e1b00" + integrity sha512-Gnxj3ev3mB5TkVBGad0JM6dmLiQL+o0t23JPBZ9sd+yvSLk05mFoqKBw5N8gbbkU4TNXyqCgIrl/VM17OgUIgQ== locate-path@^6.0.0: version "6.0.0" @@ -1169,36 +814,23 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" -lodash.flattendeep@^4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2" - integrity sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ== +locate-path@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-7.2.0.tgz#69cb1779bd90b35ab1e771e1f2f89a202c2a8a8a" + integrity sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA== + dependencies: + p-locate "^6.0.0" + +lodash.get@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" + integrity sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ== -lodash@^4.17.15, lodash@^4.17.21: +lodash@^4.17.15: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -log-driver@^1.2.7: - version "1.2.7" - resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8" - integrity sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg== - -log-symbols@4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" - integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== - dependencies: - chalk "^4.1.0" - is-unicode-supported "^0.1.0" - -lru-cache@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" - integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== - dependencies: - yallist "^3.0.2" - lru-cache@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" @@ -1206,13 +838,6 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" -make-dir@^3.0.0, make-dir@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" - integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== - dependencies: - semver "^6.0.0" - make-dir@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" @@ -1220,50 +845,57 @@ make-dir@^4.0.0: dependencies: semver "^7.5.3" -markdown-it-anchor@^8.4.1: - version "8.6.7" - resolved "https://registry.yarnpkg.com/markdown-it-anchor/-/markdown-it-anchor-8.6.7.tgz#ee6926daf3ad1ed5e4e3968b1740eef1c6399634" - integrity sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA== +map-age-cleaner@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" + integrity sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w== + dependencies: + p-defer "^1.0.0" -markdown-it@^12.3.2: - version "12.3.2" - resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-12.3.2.tgz#bf92ac92283fe983fe4de8ff8abfb5ad72cd0c90" - integrity sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg== +matcher@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/matcher/-/matcher-5.0.0.tgz#cd82f1c7ae7ee472a9eeaf8ec7cac45e0fe0da62" + integrity sha512-s2EMBOWtXFc8dgqvoAzKJXxNHibcdJMV0gwqKUaw9E2JBJuGUK7DrNKrA6g/i+v72TT16+6sVm5mS3thaMLQUw== dependencies: - argparse "^2.0.1" - entities "~2.1.0" - linkify-it "^3.0.1" - mdurl "^1.0.1" - uc.micro "^1.0.5" + escape-string-regexp "^5.0.0" -marked@^4.0.10: - version "4.3.0" - resolved "https://registry.yarnpkg.com/marked/-/marked-4.3.0.tgz#796362821b019f734054582038b116481b456cf3" - integrity sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A== +md5-hex@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/md5-hex/-/md5-hex-3.0.1.tgz#be3741b510591434b2784d79e556eefc2c9a8e5c" + integrity sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw== + dependencies: + blueimp-md5 "^2.10.0" -mdurl@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" - integrity sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g== +mem@^9.0.2: + version "9.0.2" + resolved "https://registry.yarnpkg.com/mem/-/mem-9.0.2.tgz#bbc2d40be045afe30749681e8f5d554cee0c0354" + integrity sha512-F2t4YIv9XQUBHt6AOJ0y7lSmP1+cY7Fm1DRh9GClTGzKST7UWLMx6ly9WZdLH/G/ppM5RL4MlQfRT71ri9t19A== + dependencies: + map-age-cleaner "^0.1.3" + mimic-fn "^4.0.0" -mime-db@1.52.0: - version "1.52.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" - integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -mime-types@^2.1.12, mime-types@~2.1.19: - version "2.1.35" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" - integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== - dependencies: - mime-db "1.52.0" +merge2@^1.3.0, merge2@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -minimatch@5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.0.1.tgz#fb9022f7528125187c92bd9e9b6366be1cf3415b" - integrity sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g== +micromatch@^4.0.4: + version "4.0.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== dependencies: - brace-expansion "^2.0.1" + braces "^3.0.2" + picomatch "^2.3.1" + +mimic-fn@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc" + integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw== minimatch@^3.0.4, minimatch@^3.1.1: version "3.1.2" @@ -1272,112 +904,43 @@ minimatch@^3.0.4, minimatch@^3.1.1: dependencies: brace-expansion "^1.1.7" -minimist@^1.2.5: - version "1.2.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" - integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== - -mkdirp@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" - integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== - -mocha@^10.0.0: - version "10.2.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.2.0.tgz#1fd4a7c32ba5ac372e03a17eef435bd00e5c68b8" - integrity sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg== - dependencies: - ansi-colors "4.1.1" - browser-stdout "1.3.1" - chokidar "3.5.3" - debug "4.3.4" - diff "5.0.0" - escape-string-regexp "4.0.0" - find-up "5.0.0" - glob "7.2.0" - he "1.2.0" - js-yaml "4.1.0" - log-symbols "4.1.0" - minimatch "5.0.1" - ms "2.1.3" - nanoid "3.3.3" - serialize-javascript "6.0.0" - strip-json-comments "3.1.1" - supports-color "8.1.1" - workerpool "6.2.1" - yargs "16.2.0" - yargs-parser "20.2.4" - yargs-unparser "2.0.0" - ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@2.1.3: +ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -nanoid@3.3.3: - version "3.3.3" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25" - integrity sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w== - -node-preload@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/node-preload/-/node-preload-0.2.1.tgz#c03043bb327f417a18fee7ab7ee57b408a144301" - integrity sha512-RM5oyBy45cLEoHqCeh+MNuFAxO0vTFBLskvQbOKnEE7YTTSN4tbN8QWDIPQ6L+WvKsB/qLEGpYe2ZZ9d4W9OIQ== +nise@^5.1.5: + version "5.1.5" + resolved "https://registry.yarnpkg.com/nise/-/nise-5.1.5.tgz#f2aef9536280b6c18940e32ba1fbdc770b8964ee" + integrity sha512-VJuPIfUFaXNRzETTQEEItTOP8Y171ijr+JLq42wHes3DiryR8vT+1TXQW/Rx8JNUhyYYWyIvjXTU6dOhJcs9Nw== dependencies: - process-on-spawn "^1.0.0" + "@sinonjs/commons" "^2.0.0" + "@sinonjs/fake-timers" "^10.0.2" + "@sinonjs/text-encoding" "^0.7.1" + just-extend "^4.0.2" + path-to-regexp "^1.7.0" -node-releases@^2.0.13: - version "2.0.13" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.13.tgz#d5ed1627c23e3461e819b02e57b75e4899b1c81d" - integrity sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ== +nofilter@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/nofilter/-/nofilter-3.1.0.tgz#c757ba68801d41ff930ba2ec55bab52ca184aa66" + integrity sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g== normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== -nyc@^15.1.0: - version "15.1.0" - resolved "https://registry.yarnpkg.com/nyc/-/nyc-15.1.0.tgz#1335dae12ddc87b6e249d5a1994ca4bdaea75f02" - integrity sha512-jMW04n9SxKdKi1ZMGhvUTHBN0EICCRkHemEoE5jm6mTYcqcdas0ATzgUgejlQUHMvpnOZqGB5Xxsv9KxJW1j8A== +npm-run-path@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-5.1.0.tgz#bc62f7f3f6952d9894bd08944ba011a6ee7b7e00" + integrity sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q== dependencies: - "@istanbuljs/load-nyc-config" "^1.0.0" - "@istanbuljs/schema" "^0.1.2" - caching-transform "^4.0.0" - convert-source-map "^1.7.0" - decamelize "^1.2.0" - find-cache-dir "^3.2.0" - find-up "^4.1.0" - foreground-child "^2.0.0" - get-package-type "^0.1.0" - glob "^7.1.6" - istanbul-lib-coverage "^3.0.0" - istanbul-lib-hook "^3.0.0" - istanbul-lib-instrument "^4.0.0" - istanbul-lib-processinfo "^2.0.2" - istanbul-lib-report "^3.0.0" - istanbul-lib-source-maps "^4.0.0" - istanbul-reports "^3.0.2" - make-dir "^3.0.0" - node-preload "^0.2.1" - p-map "^3.0.0" - process-on-spawn "^1.0.0" - resolve-from "^5.0.0" - rimraf "^3.0.0" - signal-exit "^3.0.2" - spawn-wrap "^2.0.0" - test-exclude "^6.0.0" - yargs "^15.0.2" - -oauth-sign@~0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" - integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== + path-key "^4.0.0" once@^1.3.0: version "1.4.0" @@ -1386,12 +949,24 @@ once@^1.3.0: dependencies: wrappy "1" -p-limit@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" - integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== +onetime@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-6.0.0.tgz#7c24c18ed1fd2e9bca4bd26806a33613c77d34b4" + integrity sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ== dependencies: - p-try "^2.0.0" + mimic-fn "^4.0.0" + +p-defer@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" + integrity sha512-wB3wfAxZpk2AzOfUMJNL+d36xothRSyj8EXOa4f6GMqYDN9BJaaSISbsk+wS9abmnebVw95C2Kb5t85UmpCxuw== + +p-event@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/p-event/-/p-event-5.0.1.tgz#614624ec02ae7f4f13d09a721c90586184af5b0c" + integrity sha512-dd589iCQ7m1L0bmC5NLlVYfy3TbBEsMUfWx9PyAgPeIcFZ/E2yaTZ4Rz4MiBmmJShviiftHVXOqfnfzJ6kyMrQ== + dependencies: + p-timeout "^5.0.2" p-limit@^3.0.2: version "3.1.0" @@ -1400,12 +975,12 @@ p-limit@^3.0.2: dependencies: yocto-queue "^0.1.0" -p-locate@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" - integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== +p-limit@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-4.0.0.tgz#914af6544ed32bfa54670b061cafcbd04984b644" + integrity sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ== dependencies: - p-limit "^2.2.0" + yocto-queue "^1.0.0" p-locate@^5.0.0: version "5.0.0" @@ -1414,33 +989,40 @@ p-locate@^5.0.0: dependencies: p-limit "^3.0.2" -p-map@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-map/-/p-map-3.0.0.tgz#d704d9af8a2ba684e2600d9a215983d4141a979d" - integrity sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ== +p-locate@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-6.0.0.tgz#3da9a49d4934b901089dca3302fa65dc5a05c04f" + integrity sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw== dependencies: - aggregate-error "^3.0.0" + p-limit "^4.0.0" -p-try@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" - integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== - -package-hash@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/package-hash/-/package-hash-4.0.0.tgz#3537f654665ec3cc38827387fc904c163c54f506" - integrity sha512-whdkPIooSu/bASggZ96BWVvZTRMOFxnyUG5PnTSGKoJE2gd5mbVNmR2Nj20QFzxYYgAXpoqC+AiXzl+UMRh7zQ== +p-map@^5.5.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-5.5.0.tgz#054ca8ca778dfa4cf3f8db6638ccb5b937266715" + integrity sha512-VFqfGDHlx87K66yZrNdI4YGtD70IRyd+zSvgks6mzHPRNkoKy+9EKP4SFC77/vTTQYmRmti7dvqC+m5jBrBAcg== dependencies: - graceful-fs "^4.1.15" - hasha "^5.0.0" - lodash.flattendeep "^4.4.0" - release-zalgo "^1.0.0" + aggregate-error "^4.0.0" + +p-timeout@^5.0.2: + version "5.1.0" + resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-5.1.0.tgz#b3c691cf4415138ce2d9cfe071dba11f0fee085b" + integrity sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew== + +parse-ms@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/parse-ms/-/parse-ms-3.0.0.tgz#3ea24a934913345fcc3656deda72df921da3a70e" + integrity sha512-Tpb8Z7r7XbbtBTrM9UhpkzzaMrqA2VXMT3YChzYltwV3P3pM6t8wl7TvpMnSTosz1aQAdVib7kdoys7vYOPerw== path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== +path-exists@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-5.0.0.tgz#a6aad9489200b21fab31e49cf09277e5116fb9e7" + integrity sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ== + path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" @@ -1451,56 +1033,59 @@ path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== +path-key@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-4.0.0.tgz#295588dc3aee64154f877adb9d780b81c554bf18" + integrity sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ== -picocolors@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" - integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== +path-to-regexp@^1.7.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.8.0.tgz#887b3ba9d84393e87a0a0b9f4cb756198b53548a" + integrity sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA== + dependencies: + isarray "0.0.1" -picomatch@^2.0.4, picomatch@^2.2.1: +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== -pkg-dir@^4.1.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" - integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== +pkg-conf@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/pkg-conf/-/pkg-conf-4.0.0.tgz#63ace00cbacfa94c2226aee133800802d3e3b80c" + integrity sha512-7dmgi4UY4qk+4mj5Cd8v/GExPo0K+SlY+hulOSdfZ/T6jVH6//y7NtzZo5WrfhDBxuQ0jCa7fLZmNaNh7EWL/w== dependencies: - find-up "^4.0.0" + find-up "^6.0.0" + load-json-file "^7.0.0" -process-on-spawn@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/process-on-spawn/-/process-on-spawn-1.0.0.tgz#95b05a23073d30a17acfdc92a440efd2baefdc93" - integrity sha512-1WsPDsUSMmZH5LeMLegqkPDrsGgsWwk1Exipy2hvB0o/F0ASzbpIctSCcZIK1ykJvtTJULEH+20WOFjMvGnCTg== +plur@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/plur/-/plur-5.1.0.tgz#bff58c9f557b9061d60d8ebf93959cf4b08594ae" + integrity sha512-VP/72JeXqak2KiOzjgKtQen5y3IZHn+9GOuLDafPv0eXa47xq0At93XahYBs26MsifCQ4enGKwbjBTKgb9QJXg== dependencies: - fromentries "^1.2.0" - -psl@^1.1.28: - version "1.9.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" - integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== + irregular-plurals "^3.3.0" -punycode@^2.1.0, punycode@^2.1.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" - integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== - -qs@~6.5.2: - version "6.5.3" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad" - integrity sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA== +prettier@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.1.0.tgz#c6d16474a5f764ea1a4a373c593b779697744d5e" + integrity sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw== -randombytes@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" - integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== +pretty-ms@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/pretty-ms/-/pretty-ms-8.0.0.tgz#a35563b2a02df01e595538f86d7de54ca23194a3" + integrity sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q== dependencies: - safe-buffer "^5.1.0" + parse-ms "^3.0.0" + +queue-microtask@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== readdirp@~3.6.0: version "3.6.0" @@ -1509,101 +1094,55 @@ readdirp@~3.6.0: dependencies: picomatch "^2.2.1" -release-zalgo@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/release-zalgo/-/release-zalgo-1.0.0.tgz#09700b7e5074329739330e535c5a90fb67851730" - integrity sha512-gUAyHVHPPC5wdqX/LG4LWtRYtgjxyX78oanFNTMMyFEfOqdC54s3eE82imuWKbOeqYht2CrNf64Qb8vgmmtZGA== - dependencies: - es6-error "^4.0.1" - -request@^2.88.2: - version "2.88.2" - resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" - integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.8.0" - caseless "~0.12.0" - combined-stream "~1.0.6" - extend "~3.0.2" - forever-agent "~0.6.1" - form-data "~2.3.2" - har-validator "~5.1.3" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.19" - oauth-sign "~0.9.0" - performance-now "^2.1.0" - qs "~6.5.2" - safe-buffer "^5.1.2" - tough-cookie "~2.5.0" - tunnel-agent "^0.6.0" - uuid "^3.3.2" - require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== -require-main-filename@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" - integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== - -requizzle@^0.2.3: - version "0.2.4" - resolved "https://registry.yarnpkg.com/requizzle/-/requizzle-0.2.4.tgz#319eb658b28c370f0c20f968fa8ceab98c13d27c" - integrity sha512-JRrFk1D4OQ4SqovXOgdav+K8EAhSB/LJZqCz8tbX0KObcdeM15Ss59ozWMBWmmINMagCwmqn4ZNryUGpBsl6Jw== +resolve-cwd@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" + integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== dependencies: - lodash "^4.17.21" + resolve-from "^5.0.0" resolve-from@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== -rimraf@^3.0.0: +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== dependencies: glob "^7.1.3" -safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.2: - version "5.2.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - -safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== - -semver@^6.0.0, semver@^6.3.0, semver@^6.3.1: - version "6.3.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" - integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" -semver@^7.5.3: +semver@^7.3.2, semver@^7.5.3: version "7.5.4" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== dependencies: lru-cache "^6.0.0" -serialize-javascript@6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" - integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== +serialize-error@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/serialize-error/-/serialize-error-7.0.1.tgz#f1360b0447f61ffb483ec4157c737fab7d778e18" + integrity sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw== dependencies: - randombytes "^2.1.0" - -set-blocking@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" - integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== + type-fest "^0.13.1" shebang-command@^2.0.0: version "2.0.0" @@ -1617,93 +1156,54 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -should-equal@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/should-equal/-/should-equal-2.0.0.tgz#6072cf83047360867e68e98b09d71143d04ee0c3" - integrity sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA== - dependencies: - should-type "^1.4.0" - -should-format@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/should-format/-/should-format-3.0.3.tgz#9bfc8f74fa39205c53d38c34d717303e277124f1" - integrity sha512-hZ58adtulAk0gKtua7QxevgUaXTTXxIi8t41L3zo9AHvjXO1/7sdLECuHeIN2SRtYXpNkmhoUP2pdeWgricQ+Q== - dependencies: - should-type "^1.3.0" - should-type-adaptors "^1.0.1" - -should-type-adaptors@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz#401e7f33b5533033944d5cd8bf2b65027792e27a" - integrity sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA== - dependencies: - should-type "^1.3.0" - should-util "^1.0.0" - -should-type@^1.3.0, should-type@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/should-type/-/should-type-1.4.0.tgz#0756d8ce846dfd09843a6947719dfa0d4cff5cf3" - integrity sha512-MdAsTu3n25yDbIe1NeN69G4n6mUnJGtSJHygX3+oN0ZbO3DTiATnf7XnYJdGT42JCXurTb1JI0qOBR65shvhPQ== - -should-util@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/should-util/-/should-util-1.0.1.tgz#fb0d71338f532a3a149213639e2d32cbea8bcb28" - integrity sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g== - -should@^13.0.0: - version "13.2.3" - resolved "https://registry.yarnpkg.com/should/-/should-13.2.3.tgz#96d8e5acf3e97b49d89b51feaa5ae8d07ef58f10" - integrity sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ== - dependencies: - should-equal "^2.0.0" - should-format "^3.0.3" - should-type "^1.4.0" - should-type-adaptors "^1.0.1" - should-util "^1.0.0" - -signal-exit@^3.0.2: +signal-exit@^3.0.2, signal-exit@^3.0.7: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== -source-map@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +signal-exit@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" + integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== + +sinon@^17.0.1: + version "17.0.1" + resolved "https://registry.yarnpkg.com/sinon/-/sinon-17.0.1.tgz#26b8ef719261bf8df43f925924cccc96748e407a" + integrity sha512-wmwE19Lie0MLT+ZYNpDymasPHUKTaZHUH/pKEubRXIzySv9Atnlw+BUMGCzWgV7b7wO+Hw6f1TEOr0IUnmU8/g== + dependencies: + "@sinonjs/commons" "^3.0.0" + "@sinonjs/fake-timers" "^11.2.2" + "@sinonjs/samsam" "^8.0.0" + diff "^5.1.0" + nise "^5.1.5" + supports-color "^7.2.0" + +slash@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-4.0.0.tgz#2422372176c4c6c5addb5e2ada885af984b396a7" + integrity sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew== -spawn-wrap@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/spawn-wrap/-/spawn-wrap-2.0.0.tgz#103685b8b8f9b79771318827aa78650a610d457e" - integrity sha512-EeajNjfN9zMnULLwhZZQU3GWBoFNkbngTUPfaawT4RkMiviTxcX0qfhVbGey39mfctfDHkWtuecgQ8NJcyQWHg== +slice-ansi@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-5.0.0.tgz#b73063c57aa96f9cd881654b15294d95d285c42a" + integrity sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ== dependencies: - foreground-child "^2.0.0" - is-windows "^1.0.2" - make-dir "^3.0.0" - rimraf "^3.0.0" - signal-exit "^3.0.2" - which "^2.0.1" + ansi-styles "^6.0.0" + is-fullwidth-code-point "^4.0.0" sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== -sshpk@^1.7.0: - version "1.18.0" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.18.0.tgz#1663e55cddf4d688b86a46b77f0d5fe363aba028" - integrity sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ== - dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - bcrypt-pbkdf "^1.0.0" - dashdash "^1.12.0" - ecc-jsbn "~0.1.1" - getpass "^0.1.1" - jsbn "~0.1.0" - safer-buffer "^2.0.2" - tweetnacl "~0.14.0" - -string-width@^4.1.0, string-width@^4.2.0: +stack-utils@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" + integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== + dependencies: + escape-string-regexp "^2.0.0" + +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -1712,6 +1212,15 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" +string-width@^5.0.0: + version "5.1.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" + integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== + dependencies: + eastasianwidth "^0.2.0" + emoji-regex "^9.2.2" + strip-ansi "^7.0.1" + strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -1719,37 +1228,40 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" -strip-bom@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" - integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== - -strip-json-comments@3.1.1, strip-json-comments@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" - integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== - -supports-color@8.1.1: - version "8.1.1" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" - integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== +strip-ansi@^7.0.1: + version "7.1.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" + integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== dependencies: - has-flag "^4.0.0" + ansi-regex "^6.0.1" -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== +strip-final-newline@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-3.0.0.tgz#52894c313fbff318835280aed60ff71ebf12b8fd" + integrity sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw== + +supertap@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/supertap/-/supertap-3.0.1.tgz#aa89e4522104402c6e8fe470a7d2db6dc4037c6a" + integrity sha512-u1ZpIBCawJnO+0QePsEiOknOfCRq0yERxiAchT0i4li0WHNUJbf0evXXSXOcCAR4M8iMDoajXYmstm/qO81Isw== dependencies: - has-flag "^3.0.0" + indent-string "^5.0.0" + js-yaml "^3.14.1" + serialize-error "^7.0.1" + strip-ansi "^7.0.1" -supports-color@^7.1.0: +supports-color@^7.1.0, supports-color@^7.2.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== dependencies: has-flag "^4.0.0" +temp-dir@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/temp-dir/-/temp-dir-3.0.0.tgz#7f147b42ee41234cc6ba3138cd8e8aa2302acffa" + integrity sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw== + test-exclude@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" @@ -1759,10 +1271,10 @@ test-exclude@^6.0.0: glob "^7.1.4" minimatch "^3.0.4" -to-fast-properties@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" - integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== +time-zone@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/time-zone/-/time-zone-1.0.0.tgz#99c5bf55958966af6d06d83bdf3800dc82faec5d" + integrity sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA== to-regex-range@^5.0.1: version "5.0.1" @@ -1771,93 +1283,39 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -tough-cookie@~2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" - integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== - dependencies: - psl "^1.1.28" - punycode "^2.1.1" - -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" - integrity sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w== - dependencies: - safe-buffer "^5.0.1" - -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" - integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA== - -type-fest@^0.8.0: - version "0.8.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" - integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== - -typedarray-to-buffer@^3.1.5: - version "3.1.5" - resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" - integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== - dependencies: - is-typedarray "^1.0.0" - -uc.micro@^1.0.1, uc.micro@^1.0.5: - version "1.0.6" - resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" - integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== - -underscore@~1.13.2: - version "1.13.6" - resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.6.tgz#04786a1f589dc6c09f761fc5f45b89e935136441" - integrity sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A== - -update-browserslist-db@^1.0.13: - version "1.0.13" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4" - integrity sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg== - dependencies: - escalade "^3.1.1" - picocolors "^1.0.0" +type-detect@4.0.8, type-detect@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" + integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== -uri-js@^4.2.2: - version "4.4.1" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" - integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== - dependencies: - punycode "^2.1.0" +type-fest@^0.13.1: + version "0.13.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.13.1.tgz#0172cb5bce80b0bd542ea348db50c7e21834d934" + integrity sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg== -uuid@^3.3.2: - version "3.4.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" - integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== +typescript@^5.2.2: + version "5.2.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78" + integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w== -uuid@^8.3.2: - version "8.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" - integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== -verror@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" - integrity sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw== +v8-to-istanbul@^9.0.0: + version "9.1.3" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.1.3.tgz#ea456604101cd18005ac2cae3cdd1aa058a6306b" + integrity sha512-9lDD+EVI2fjFsMWXc6dy5JJzBsVTcQ2fVkfBvncZ6xJWG9wtBhOldG+mHkSL0+V1K/xgZz0JDO5UT5hFwHUghg== dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" - -which-module@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.1.tgz#776b1fe35d90aebe99e8ac15eb24093389a4a409" - integrity sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ== + "@jridgewell/trace-mapping" "^0.3.12" + "@types/istanbul-lib-coverage" "^2.0.1" + convert-source-map "^2.0.0" -which@^1.1.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" - integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== - dependencies: - isexe "^2.0.0" +well-known-symbols@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/well-known-symbols/-/well-known-symbols-2.0.0.tgz#e9c7c07dbd132b7b84212c8174391ec1f9871ba5" + integrity sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q== which@^2.0.1: version "2.0.2" @@ -1866,20 +1324,6 @@ which@^2.0.1: dependencies: isexe "^2.0.0" -workerpool@6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" - integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== - -wrap-ansi@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" - integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" @@ -1894,100 +1338,48 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -write-file-atomic@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8" - integrity sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q== +write-file-atomic@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-5.0.1.tgz#68df4717c55c6fa4281a7860b4c2ba0a6d2b11e7" + integrity sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw== dependencies: imurmurhash "^0.1.4" - is-typedarray "^1.0.0" - signal-exit "^3.0.2" - typedarray-to-buffer "^3.1.5" - -xmlcreate@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/xmlcreate/-/xmlcreate-2.0.4.tgz#0c5ab0f99cdd02a81065fa9cd8f8ae87624889be" - integrity sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg== - -y18n@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf" - integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ== + signal-exit "^4.0.1" y18n@^5.0.5: version "5.0.8" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== -yallist@^3.0.2: - version "3.1.1" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" - integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== - yallist@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yargs-parser@20.2.4: - version "20.2.4" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" - integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== +yargs-parser@^21.1.1: + version "21.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== -yargs-parser@^18.1.2: - version "18.1.3" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" - integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== +yargs@^17.7.2: + version "17.7.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" + integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== dependencies: - camelcase "^5.0.0" - decamelize "^1.2.0" - -yargs-parser@^20.2.2: - version "20.2.9" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" - integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== - -yargs-unparser@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" - integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== - dependencies: - camelcase "^6.0.0" - decamelize "^4.0.0" - flat "^5.0.2" - is-plain-obj "^2.1.0" - -yargs@16.2.0: - version "16.2.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" - integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== - dependencies: - cliui "^7.0.2" + cliui "^8.0.1" escalade "^3.1.1" get-caller-file "^2.0.5" require-directory "^2.1.1" - string-width "^4.2.0" + string-width "^4.2.3" y18n "^5.0.5" - yargs-parser "^20.2.2" - -yargs@^15.0.2: - version "15.4.1" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" - integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== - dependencies: - cliui "^6.0.0" - decamelize "^1.2.0" - find-up "^4.1.0" - get-caller-file "^2.0.1" - require-directory "^2.1.1" - require-main-filename "^2.0.0" - set-blocking "^2.0.0" - string-width "^4.2.0" - which-module "^2.0.0" - y18n "^4.0.0" - yargs-parser "^18.1.2" + yargs-parser "^21.1.1" yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== + +yocto-queue@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251" + integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==