diff --git a/Ducky.js b/Ducky.js index b8617ad..318f05b 100644 --- a/Ducky.js +++ b/Ducky.js @@ -94,9 +94,9 @@ bot.on("message", function(message) { if(stopMyself(message.author.id)) { return; } - if(!isMaster(message.author.id)) { + /*if(!isMaster(message.author.id)) { return; - } + }*/ // TODO: Notify logger (need to figure out how to not spam users...) /*if(message.mentions.length > 0) { for(var i = 0; i < message.mentions.length; i++) { @@ -108,66 +108,64 @@ bot.on("message", function(message) { } } }*/ + var msg = message.content.toLowerCase(); + for (var i in exports.triggers) { var trigger = exports.triggers[i]; - bot.sendMessage(message, trigger); - } - var msg = message.content.toLowerCase(); - for(var i = 0; i < exports.triggers.length; i++) { - if(exports.triggers[i] == msg) { + if(trigger == msg) { var callback_function = exports.callbacks[i]; callback_function(bot, message, msg); return; } } - return; + for (var i in exports.triggers) { + var trigger = exports.triggers[i]; - - - for(var i = 0; i < exports.triggers.length; i++) { - var ts = exports.triggers[i].split(" "); - bot.sendMessage(message, ts[c] + " -> " + ms[c]); + var ts = trigger.split(" "); var ms = msg.split(" "); - var nm = []; var inMentions = false; - if(message.mentions.length > 0) { - var mentions = message.mentions.join(", "); - } - for(var c = 0; c < ms.length; c++) { - - if(ts[c] == "%arg%") { - nm.push(ts[c]); - } else if (ts[c] == "%args%") { - nm.push(ts[c]); - break; - } else if (ts[c] == "%mention%") { - if(contains(mentions, ms[c])) { - nm.push(ts[c]); + var nm = []; + for (var t in ts) { + if(ts[t] == ms[t]) { + if(inMentions) { + /*if(!message.mentions.indexOf(ms[t]) > 0) { + nm.push(ts[t]); + }*/ + continue; } else { - bot.sendMessage(message, "Parse error! Arg type: \"mention\", got type: \"String\""); - break; + nm.push(ts[t]); } - } else if (ts[c] == "%mentions%") { - nm.push("%mentions%") + } else if (ts[t] == "%arg%") { + nm.push(ts[t]); + } else if (ts[t] == "%args%") { + nm.push(ts[t]); + break; + } else if (ts[t] == "%mention%") { + /*if(message.mentions.indexOf(ms[t]) > 0) { + nm.push(ts[t]); + }*/ + // Just going to push it straight up + nm.push(ts[t]); + } else if (ts[t] == "%mentions%") { + /*if(message.mentions.indexOf(ms[t]) > 0) { + nm.push(ts[t]); + }*/ inMentions = true; - } else if (inMentions) { - if(!ms[c].startsWith("@")) { - inMentions = false; - } - } else { - nm.push(ms[c]); + // Just going to push it straight up + nm.push(ts[t]); } } - - msg = nm.join(" "); - return; - if(exports.triggers[i] == msg) { + var newmsg = nm.join(" "); + if(trigger == newmsg) { var callback_function = exports.callbacks[i]; callback_function(bot, message, msg); return; - } + } } + + return; }); + var auth = require("./data/auth.json"); bot.login(auth.email, auth.password); \ No newline at end of file diff --git a/commands/ducky_management.js b/commands/ducky_management.js index b454ca3..9167dc7 100644 --- a/commands/ducky_management.js +++ b/commands/ducky_management.js @@ -69,7 +69,12 @@ Ducky.registerCommand("about you", function(bot, message, msg) { duckyinfo.push("Channels monitoring: " + bot.channels.length); duckyinfo.push("Users found: " + bot.users.length); duckyinfo.push("Private chats: " + bot.privateChannels.length); - duckyinfo.push("Uptime: " + bot.uptime/60 + " seconds"); + var date1 = new Date(bot.uptime); + var date2 = new Date(); + var timeDiff = Math.abs(date2.getTime() - date1.getTime()); + var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)); + //duckyinfo.push("Uptime: " + duckydate.getDay() + " days, " + duckydate.getHours() + " hours, " + duckydate.getMinutes() + " minutes and " + duckydate.getSeconds() + " seconds"); + duckyinfo.push("Uptime: " + diffDays); duckyinfo.push("ID: " + bot.user.id); var duckyout = duckyinfo.join("\n"); bot.sendMessage(message, duckyout); diff --git a/commands/misc.js b/commands/misc.js index 9d6be48..d00caf4 100644 --- a/commands/misc.js +++ b/commands/misc.js @@ -29,7 +29,43 @@ Ducky.registerCommand("/help", function(bot, message, msg) { }); Ducky.registerCommand("penis length of %mention%", function(bot, message, msg) { - bot.sendMessage(message, "Coming soon"); + var file = require('/root/ducky/data/penis_lengths.json'); + var fpath = '/root/ducky/data/penis_lengths.json'; + + var fs = require('fs'); + + //try { + //fs.accessSync(file, fs.F_OK); + var jsonF = require("jsonfile"); + if(file[message.mentions[0].id]) { + var full = file[message.mentions[0].id]; + var penis = []; + penis.push("8") + for(var i = 0; i < full; i++) { + penis.push("="); + } + penis.push("D"); + var pout = penis.join(""); + bot.sendMessage(message, "Penis length of " + message.mentions[0] + " is " + pout); + } else { + var full = ((Math.random() * 10) + 1); + var penis = []; + penis.push("8") + for(var i = 0; i < full; i++) { + penis.push("="); + } + penis.push("D"); + var pout = penis.join(""); + bot.sendMessage(message, "Penis length of " + message.mentions[0] + " is " + pout); + var jsonString = '{\"' + message.mentions[0].id + '\":\"' + full + '\"}'; + var jsonObj = JSON.parse(jsonString); + jsonF.writeFileSync(fpath, jsonObj); + } + /*} catch (e) { + fs.closeSync(fs.openSync(file, 'w')); + bot.sendMessage(message, "Oh no! Something went wrong getting the girth of " + message.mentions[0]); + console.log(e); + }*/ }); Ducky.registerCommand("monitor me", function(bot, message, msg) { diff --git a/data/auth.json b/data/auth.json index a58dad2..f471c28 100644 --- a/data/auth.json +++ b/data/auth.json @@ -1 +1 @@ -{"email":"example@ducky.com","password":"duckyisbae"} \ No newline at end of file +{"email":"example@domain.com","password":"duckyisbae"} \ No newline at end of file diff --git a/data/penis_lengths.json b/data/penis_lengths.json new file mode 100644 index 0000000..d75d824 --- /dev/null +++ b/data/penis_lengths.json @@ -0,0 +1 @@ +{"128194687801622528":"7.047292856965214"} diff --git a/node_modules/fluent-ffmpeg/.npmignore b/node_modules/fluent-ffmpeg/.npmignore deleted file mode 100644 index a3c4705..0000000 --- a/node_modules/fluent-ffmpeg/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -*.md -.git* -test/ -examples/ \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/.travis.yml b/node_modules/fluent-ffmpeg/.travis.yml deleted file mode 100644 index cfb7874..0000000 --- a/node_modules/fluent-ffmpeg/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -matrix: - include: - - os: osx - env: NODE_VERSION=0.8 - - os: osx - env: NODE_VERSION=0.10 - - os: osx - env: NODE_VERSION=0.11 - - os: linux - env: NODE_VERSION=0.8 - - os: linux - env: NODE_VERSION=0.10 - - os: linux - env: NODE_VERSION=0.11 -script: - - tools/test-travis.sh diff --git a/node_modules/fluent-ffmpeg/Gruntfile.js b/node_modules/fluent-ffmpeg/Gruntfile.js deleted file mode 100644 index 813dc79..0000000 --- a/node_modules/fluent-ffmpeg/Gruntfile.js +++ /dev/null @@ -1,37 +0,0 @@ -module.exports = function(grunt) { - - grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - shell: { - makeTest: { - command: 'make test-colors', - options: { - stdout: true, - stderr: true - } - } - }, - lint: { - files: ['grunt.js', 'lib/**/*.js'] - }, - watch: { - scripts: { - files: ['test/**/*.js','lib/**/*.js'], - tasks: ['shell'], - options: { - nospawn: true, - }, - }, - } - }); - - grunt.loadNpmTasks('grunt-contrib-watch'); - - grunt.loadNpmTasks('grunt-shell'); - - grunt.registerTask('test', ['shell']); - - grunt.registerTask('commit', ['shell']); - - grunt.registerTask('default', ['watch']); -}; \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/LICENSE b/node_modules/fluent-ffmpeg/LICENSE deleted file mode 100644 index 4827ade..0000000 --- a/node_modules/fluent-ffmpeg/LICENSE +++ /dev/null @@ -1,9 +0,0 @@ -(The MIT License) - -Copyright (c) 2011 Stefan Schaermeli - -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/node_modules/fluent-ffmpeg/Makefile b/node_modules/fluent-ffmpeg/Makefile deleted file mode 100644 index 26e1b14..0000000 --- a/node_modules/fluent-ffmpeg/Makefile +++ /dev/null @@ -1,29 +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 - -test-cov: test/coverage.html - -test/coverage.html: lib-cov - @FLUENTFFMPEG_COV=1 NODE_ENV=test $(MOCHA) --require should --reporter html-cov > test/coverage.html - -lib-cov: - @rm -fr ./$@ - @jscoverage lib $@ - -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-cov lib-cov test-colors publish doc \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/README.md b/node_modules/fluent-ffmpeg/README.md deleted file mode 100644 index e1a8fff..0000000 --- a/node_modules/fluent-ffmpeg/README.md +++ /dev/null @@ -1,1482 +0,0 @@ -# Fluent ffmpeg-API for node.js [![Build Status](https://secure.travis-ci.org/fluent-ffmpeg/node-fluent-ffmpeg.svg?branch=master)](http://travis-ci.org/fluent-ffmpeg/node-fluent-ffmpeg) - -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 -> -> A major 2.0 version has been released. This release features lots of API cleanup and a cleaner syntax for most methods. -> -> It has been designed to be mostly compatible with the previous fluent-ffmpeg version, but there are some incompatibilities, mainly because deprecated APIs in 1.x have been removed. See [the 2.x migration wiki page](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/wiki/Migrating-from-fluent-ffmpeg-1.x) for information on how to migrate. -> -> Please take care to update your package.json files if you want to keep using version 1.x: -> ```js -{ - "dependencies": { - "fluent-ffmpeg": "~1.7" - } -} -``` -> -> 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). - -## 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 - -#### 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. - -```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) - - -### 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, optionnaly 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, optionnaly 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'); - }); -``` - -#### '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_. - -```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 no 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() { - console.log('Transcoding succeeded !'); - }); -``` - - -### 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); - }); -``` - -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`). - -```sh -$ make test -``` - -If you want to re-generate the test coverage report (filed under test/coverage.html), run - -```sh -$ make test-cov -``` - -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. diff --git a/node_modules/fluent-ffmpeg/build.bat b/node_modules/fluent-ffmpeg/build.bat deleted file mode 100644 index 8f68980..0000000 --- a/node_modules/fluent-ffmpeg/build.bat +++ /dev/null @@ -1,7 +0,0 @@ -@echo off -set REPORTER="list" - -:test - setx NODE_ENV "test" - node_modules\.bin\mocha.cmd -u bdd --require should --reporter "%REPORTER%" - setx NODE_ENV "development" \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/doc/FfmpegCommand.html b/node_modules/fluent-ffmpeg/doc/FfmpegCommand.html deleted file mode 100644 index 0170b25..0000000 --- a/node_modules/fluent-ffmpeg/doc/FfmpegCommand.html +++ /dev/null @@ -1,17661 +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

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:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
filters - - -String -| - -Array.<String> -| - -Array.<Object> - - - - - - - - - - <repeatable>
- -

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)

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

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 -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - -
-

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, callback)

- - -
-
- - -
-

Run ffprobe on last specified input

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

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

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)

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

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)

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

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
  • - -
- - -
- - - -
-

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:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
filters - - -String -| - -Array.<String> -| - -Array.<Object> - - - - - - - - - - <repeatable>
- -

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)

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

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
  • - -
- - -
- - - -
-

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 - - -Array -| - -null - - - - - - <optional>
- - - - - -

generated filenames when taking screenshots, null otherwise

- - - -
- - - - - - - - - - - - - - - - - - - -
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:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - -
- -
- -
- -
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.3.0-alpha5 on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST) -
- - - - - \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/doc/audio.js.html b/node_modules/fluent-ffmpeg/doc/audio.js.html deleted file mode 100644 index 38646b3..0000000 --- a/node_modules/fluent-ffmpeg/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;
-  };
-};
-
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.3.0-alpha5 on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST) -
- - - - - diff --git a/node_modules/fluent-ffmpeg/doc/capabilities.js.html b/node_modules/fluent-ffmpeg/doc/capabilities.js.html deleted file mode 100644 index 3115764..0000000 --- a/node_modules/fluent-ffmpeg/doc/capabilities.js.html +++ /dev/null @@ -1,700 +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 }, function (err, stdout) {
-      if (err) {
-        return callback(err);
-      }
-
-      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 }, function(err, stdout) {
-      if (err) {
-        return callback(err);
-      }
-
-      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 }, function(err, stdout) {
-      if (err) {
-        return callback(err);
-      }
-
-      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 }, function (err, stdout) {
-      if (err) {
-        return callback(err);
-      }
-
-      // Parse output
-      var lines = stdout.split(lineBreakRegexp);
-      var data = {};
-
-      lines.forEach(function(line) {
-        var match = line.match(formatRegexp);
-        if (match) {
-          data[match[3]] = {
-            description: match[4],
-            canDemux: match[1] === 'D',
-            canMux: match[2] === 'E'
-          };
-        }
-      });
-
-      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);
-  };
-};
-
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.3.0-alpha5 on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST) -
- - - - - diff --git a/node_modules/fluent-ffmpeg/doc/custom.js.html b/node_modules/fluent-ffmpeg/doc/custom.js.html deleted file mode 100644 index af7098c..0000000 --- a/node_modules/fluent-ffmpeg/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;
-  };
-};
-
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.3.0-alpha5 on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST) -
- - - - - diff --git a/node_modules/fluent-ffmpeg/doc/ffprobe.js.html b/node_modules/fluent-ffmpeg/doc/ffprobe.js.html deleted file mode 100644 index 37bd5c6..0000000 --- a/node_modules/fluent-ffmpeg/doc/ffprobe.js.html +++ /dev/null @@ -1,262 +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/);
-  var data = {
-    streams: []
-  };
-
-  function parseBlock() {
-    var data = {};
-
-    var line = lines.shift();
-    while (line) {
-      if (line.match(/^\[\//)) {
-        return data;
-      }
-
-      var kv = line.match(/^([^=]+)=(.*)$/);
-      if (kv) {
-        if (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 (line) {
-    if (line === '[STREAM]') {
-      var stream = parseBlock();
-      data.streams.push(stream);
-    } else if (line === '[FORMAT]') {
-      data.format = parseBlock();
-    }
-
-    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 {FfmpegCommand~ffprobeCallback} callback callback function
-   *
-   */
-  proto.ffprobe = function(index, callback) {
-    var input;
-
-    if (typeof callback === 'undefined') {
-      callback = index;
-
-      if (!this._currentInput) {
-        return callback(new Error('No input specified'));
-      }
-
-      input = this._currentInput;
-    } else {
-      input = this._inputs[index];
-
-      if (!input) {
-        return callback(new Error('Invalid input index'));
-      }
-    }
-
-    if (!input.isFile) {
-      return callback(new Error('Cannot run ffprobe on non-file input'));
-    }
-
-    // Find ffprobe
-    this._getFfprobePath(function(err, path) {
-      if (err) {
-        return callback(err);
-      } else if (!path) {
-        return callback(new Error('Cannot find ffprobe'));
-      }
-
-      var stdout = '';
-      var stdoutClosed = false;
-      var stderr = '';
-      var stderrClosed = false;
-
-      // Spawn ffprobe
-      var ffprobe = spawn(path, [
-        '-show_streams',
-        '-show_format',
-        input.source
-      ]);
-
-      ffprobe.on('error', function(err) {
-        callback(err);
-      });
-
-      // 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 callback(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) {
-            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];
-              });
-            }
-          });
-
-          callback(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();
-      });
-    });
-  };
-};
-
-
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.3.0-alpha5 on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST) -
- - - - - diff --git a/node_modules/fluent-ffmpeg/doc/fluent-ffmpeg.js.html b/node_modules/fluent-ffmpeg/doc/fluent-ffmpeg.js.html deleted file mode 100644 index da7fb25..0000000 --- a/node_modules/fluent-ffmpeg/doc/fluent-ffmpeg.js.html +++ /dev/null @@ -1,268 +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 {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.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, callback) {
-  (new FfmpegCommand(file)).ffprobe(callback);
-};
-
-/* Add processing recipes */
-
-require('./recipes')(FfmpegCommand.prototype);
-
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.3.0-alpha5 on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST) -
- - - - - diff --git a/node_modules/fluent-ffmpeg/doc/global.html b/node_modules/fluent-ffmpeg/doc/global.html deleted file mode 100644 index 9362b4e..0000000 --- a/node_modules/fluent-ffmpeg/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:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- -
- - - - - -
- -
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.3.0-alpha5 on Thu May 01 2014 13:29:29 GMT+0200 (CEST) -
- - - - - \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/doc/index.html b/node_modules/fluent-ffmpeg/doc/index.html deleted file mode 100644 index b1de17e..0000000 --- a/node_modules/fluent-ffmpeg/doc/index.html +++ /dev/null @@ -1,1067 +0,0 @@ - - - - - JSDoc: Index - - - - - - - - - - -
- -

Index

- - - - - - - -

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

Fluent ffmpeg-API for node.js Build Status

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).

-

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)
  • -
-

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().

-

You can pass one option, many options or an option array to this method.

-
ffmpeg('/dev/video0').inputOptions('-r', '24');
-ffmpeg('/dev/video0').inputOptions('-r 24');
-ffmpeg('/dev/video0').inputOptions(['-r 24', '-loop 1']);
-
-

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().

-

You can pass one option, many options or an option array to this method.

-
ffmpeg('/dev/video0').outputOptions('-r', '24');
-ffmpeg('/dev/video0').outputOptions('-r 24');
-ffmpeg('/dev/video0').outputOptions(['-r 24', '-loop 1']);
-
-

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 (only available when the total output duration is known; most notably not available when using an input stream).
  • -
-
ffmpeg('/path/to/file.avi')
-  .on('progress', function(progress) {
-    console.log('Processing: ' + progress.percent + '% done');
-  });
-
-

'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 no 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() {
-    console.log('Transcoding succeeded !');
-  });
-
-

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.

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

takeScreenshots(options, dirname): generate thumbnails

One pretty neat feature of fluent-ffmpeg is the ability to generate any amount of thumbnails from your movies. The screenshots are taken at automatically determined timemarks using the following formula: (duration_in_sec * 0.9) / number_of_thumbnails.

-

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

-
ffmpeg('/path/to/video.avi')
-  .size('320x240')
-  .on('error', function(err) {
-    console.log('An error occurred: ' + err.message);
-  })
-  .on('end', function(filenames) {
-    console.log('Successfully generated ' + filenames.join(', '));
-  })
-  .takeScreenshots(5, '/path/to/directory');
-
-

You can also call takeScreenshots with specific timemarks.

-
ffmpeg('/path/to/video.avi')
-  .size('320x240')
-  .on('error', function(err) {
-    console.log('An error occurred: ' + err.message);
-  })
-  .on('end', function(filenames) {
-    console.log('Successfully generated ' + filenames.join(', '));
-  })
-  .takeScreenshots({
-    count: 2,
-    timemarks: [ '0.5', '1' ]
-  }, '/path/to/directory');
-
-

You can set a filename pattern using following format characters:

-
    -
  • %s - offset in seconds
  • -
  • %w - screenshot width
  • -
  • %h - screenshot height
  • -
  • %r - screenshot resolution (eg. '320x240')
  • -
  • %f - input filename
  • -
  • %b - input basename (filename w/o extension)
  • -
  • %i - number of screenshot in timemark array (can be zero-padded by using it like %000i)
  • -
-

If multiple timemarks are given and no %i format character is found in filename, _%i will be added to the end of the given pattern.

-
ffmpeg('/path/to/video.avi')
-  .size('320x240')
-  .on('error', function(err) {
-    console.log('An error occurred: ' + err.message);
-  })
-  .on('end', function(filenames) {
-    console.log('Successfully generated ' + filenames.join(', '));
-  })
-  .takeScreenshots({
-    count: 2,
-    timemarks: [ '0.5', '1' ],
-    filename: '%b-thumbnail-%i-%r'
-  }, '/path/to/directory');
-
-

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

The returned object is the same that is returned by running the following command from your shell:

-
$ 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.

-
- - - - - - -
- - - -
- -
- Documentation generated by JSDoc 3.3.0-alpha5 on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST) -
- - - - - \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/doc/inputs.js.html b/node_modules/fluent-ffmpeg/doc/inputs.js.html deleted file mode 100644 index e5d2cf7..0000000 --- a/node_modules/fluent-ffmpeg/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;
-  };
-};
-
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.3.0-alpha5 on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST) -
- - - - - diff --git a/node_modules/fluent-ffmpeg/doc/misc.js.html b/node_modules/fluent-ffmpeg/doc/misc.js.html deleted file mode 100644 index 6d0b7a3..0000000 --- a/node_modules/fluent-ffmpeg/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;
-  };
-};
-
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.3.0-alpha5 on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST) -
- - - - - diff --git a/node_modules/fluent-ffmpeg/doc/output.js.html b/node_modules/fluent-ffmpeg/doc/output.js.html deleted file mode 100644 index d2b2d17..0000000 --- a/node_modules/fluent-ffmpeg/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;
-  };
-};
-
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.3.0-alpha5 on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST) -
- - - - - diff --git a/node_modules/fluent-ffmpeg/doc/processor.js.html b/node_modules/fluent-ffmpeg/doc/processor.js.html deleted file mode 100644 index 09d65da..0000000 --- a/node_modules/fluent-ffmpeg/doc/processor.js.html +++ /dev/null @@ -1,688 +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');
-
-
-/*
- *! Processor methods
- */
-
-
-/**
- * Run ffprobe asynchronously and store data in command
- *
- * @param {FfmpegCommand} command
- * @private
- */
-function runFfprobe(command) {
-  command.ffprobe(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 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|null} [filenames] generated filenames when taking screenshots, null otherwise
-   */
-
-
-  /**
-   * Spawn an ffmpeg process
-   *
-   * The 'options' argument may contain the following keys:
-   * - 'niceness': specify process niceness, ignored on Windows (default: 0)
-   * - 'captureStdout': capture stdout and pass it to 'endCB' as its 2nd argument (default: false)
-   * - 'captureStderr': capture stderr and pass it to 'endCB' as its 3rd argument (default: false)
-   *
-   * 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 when it has been created
-   * @param {Function} endCB callback with signature (err, stdout, stderr)
-   * @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() {};
-    }
-
-    // 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 stdout = null;
-      var stdoutClosed = false;
-
-      var stderr = null;
-      var stderrClosed = false;
-
-      // Spawn process
-      var ffmpegProc = spawn(command, args, options);
-
-      if (ffmpegProc.stderr && options.captureStderr) {
-        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 || !options.captureStderr)) {
-          endCB(exitError, stdout, stderr);
-        }
-      }
-
-      // 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) {
-        stdout = '';
-
-        ffmpegProc.stdout.on('data', function(data) {
-          stdout += data;
-        });
-
-        ffmpegProc.stdout.on('close', function() {
-          stdoutClosed = true;
-          handleExit();
-        });
-      }
-
-      // Capture stderr if specified
-      if (options.captureStderr) {
-        stderr = '';
-
-        ffmpegProc.stderr.on('data', function(data) {
-          stderr += data;
-        });
-
-        ffmpegProc.stderr.on('close', function() {
-          stderrClosed = true;
-          handleExit();
-        });
-      }
-
-      // Call process callback
-      processCB(ffmpegProc);
-    });
-  };
-
-
-  /**
-   * 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(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
-      var stdout = null;
-      var stderr = '';
-      self._spawnFfmpeg(
-        args,
-
-        { niceness: self.options.niceness },
-
-        function processCB(ffmpegProc) {
-          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), stdout, stderr);
-              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));
-              ffmpegProc.kill();
-            });
-          } else {
-            // Gather ffmpeg stdout
-            stdout = '';
-            ffmpegProc.stdout.on('data', function (data) {
-              stdout += data;
-            });
-          }
-
-          // Process ffmpeg stderr data
-          self._codecDataSent = false;
-          ffmpegProc.stderr.on('data', function (data) {
-            stderr += data;
-
-            if (!self._codecDataSent && self.listeners('codecData').length) {
-              utils.extractCodecData(self, stderr);
-            }
-
-            if (self.listeners('progress').length) {
-              var duration = 0;
-
-              if (self._ffprobeData && self._ffprobeData.format && self._ffprobeData.format.duration) {
-                duration = Number(self._ffprobeData.format.duration);
-              }
-
-              utils.extractProgress(self, stderr, duration);
-            }
-          });
-        },
-
-        function endCB(err) {
-          delete self.ffmpegProc;
-
-          if (err) {
-            if (err.message.match(/ffmpeg exited with code/)) {
-              // Add ffmpeg error message
-              err.message += ': ' + utils.extractError(stderr);
-            }
-
-            emitEnd(err, stdout, stderr);
-          } 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) {
-                // No possible error here, getFlvtoolPath was already called by _prepare
-                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, stdout, stderr);
-                    }
-                  }
-                );
-              });
-            } else {
-              emitEnd(null, stdout, stderr);
-            }
-          }
-        }
-      );
-    });
-  };
-
-
-  /**
-   * 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.options.logger.warn('No running ffmpeg process, cannot send signal');
-    } else {
-      this.ffmpegProc.kill(signal || 'SIGKILL');
-    }
-
-    return this;
-  };
-};
-
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.3.0-alpha5 on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST) -
- - - - - diff --git a/node_modules/fluent-ffmpeg/doc/recipes.js.html b/node_modules/fluent-ffmpeg/doc/recipes.js.html deleted file mode 100644 index 5c4da06..0000000 --- a/node_modules/fluent-ffmpeg/doc/recipes.js.html +++ /dev/null @@ -1,464 +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;
-  };
-
-
-  /**
-   * @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 {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'
-    config.timemarks = 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 {
-              var 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();
-        }
-      },
-
-      // 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 > 0 && !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, width, height);
-          });
-        } 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;
-            });
-        });
-
-        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();
-
-        // Add stream labels
-      }
-
-      for (var i = 0; i < count; i++) {
-        var stream = 'screen' + i;
-        split.outputs.push(stream);
-
-        self.output(path.join(config.folder, filenames[i]))
-          .seek(config.timemarks[i])
-          .frames(1)
-          .map(stream);
-      }
-
-      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 file input
-    var fileInput = this._inputs.filter(function(input) {
-      return input.isFile;
-    })[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;
-  };
-};
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.3.0-alpha5 on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST) -
- - - - - diff --git a/node_modules/fluent-ffmpeg/doc/scripts/linenumber.js b/node_modules/fluent-ffmpeg/doc/scripts/linenumber.js deleted file mode 100644 index 8d52f7e..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/doc/scripts/prettify/Apache-License-2.0.txt b/node_modules/fluent-ffmpeg/doc/scripts/prettify/Apache-License-2.0.txt deleted file mode 100644 index d645695..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/doc/scripts/prettify/lang-css.js b/node_modules/fluent-ffmpeg/doc/scripts/prettify/lang-css.js deleted file mode 100644 index 041e1f5..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/doc/scripts/prettify/prettify.js b/node_modules/fluent-ffmpeg/doc/scripts/prettify/prettify.js deleted file mode 100644 index eef5ad7..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/doc/styles/prettify-jsdoc.css b/node_modules/fluent-ffmpeg/doc/styles/prettify-jsdoc.css deleted file mode 100644 index 5a2526e..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/doc/styles/prettify-tomorrow.css b/node_modules/fluent-ffmpeg/doc/styles/prettify-tomorrow.css deleted file mode 100644 index aa2908c..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/doc/utils.js.html b/node_modules/fluent-ffmpeg/doc/utils.js.html deleted file mode 100644 index 587c089..0000000 --- a/node_modules/fluent-ffmpeg/doc/utils.js.html +++ /dev/null @@ -1,275 +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 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,
-
-  /**
-   * 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 = [];
-    var argfunc = function() {
-      if (arguments.length === 1 && Array.isArray(arguments[0])) {
-        list = list.concat(arguments[0]);
-      } else {
-        list = list.concat([].slice.call(arguments));
-      }
-    };
-
-    argfunc.clear = function() {
-      list = [];
-    };
-
-    argfunc.get = function() {
-      return list;
-    };
-
-    argfunc.find = function(arg, count) {
-      var index = list.indexOf(arg);
-      if (index !== -1) {
-        return list.slice(index + 1, index + 1 + (count || 0));
-      }
-    };
-
-    argfunc.remove = function(arg, count) {
-      var index = list.indexOf(arg);
-      if (index !== -1) {
-        list.splice(index, (count || 0) + 1);
-      }
-    };
-
-    return argfunc;
-  },
-
-
-  /**
-   * 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]);
-    }
-
-    var cmd = 'which ' + name;
-    if (isWindows) {
-      cmd = 'where ' + name + '.exe';
-    }
-
-    exec(cmd, function(err, stdout) {
-      if (err) {
-        // Treat errors as not found
-        callback(null, whichCache[name] = '');
-      } else {
-        callback(null, whichCache[name] = stdout.replace(/\n$/, ''));
-      }
-    });
-  },
-
-
-  /**
-   * Convert a [[hh:]mm:]ss[.xxx] timemark into seconds
-   *
-   * @param {String} timemark timemark string
-   * @return Number
-   * @private
-   */
-  timemarkToSeconds: function(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
-   *
-   * @param {FfmpegCommand} command event emitter
-   * @param {String} stderr ffmpeg stderr output
-   * @private
-   */
-  extractCodecData: function(command, stderr) {
-    var format= /Input #[0-9]+, ([^ ]+),/.exec(stderr);
-    var dur   = /Duration\: ([^,]+)/.exec(stderr);
-    var audio = /Audio\: (.*)/.exec(stderr);
-    var video = /Video\: (.*)/.exec(stderr);
-    var codecObject = { format: '', audio: '', video: '', duration: '' };
-
-    if (format && format.length > 1) {
-      codecObject.format = format[1];
-    }
-
-    if (dur && dur.length > 1) {
-      codecObject.duration = dur[1];
-    }
-
-    if (audio && audio.length > 1) {
-      audio = audio[1].split(', ');
-      codecObject.audio = audio[0];
-      codecObject.audio_details = audio;
-    }
-    if (video && video.length > 1) {
-      video = video[1].split(', ');
-      codecObject.video = video[0];
-      codecObject.video_details = video;
-    }
-
-    var codecInfoPassed = /Press (\[q\]|ctrl-c) to stop/.test(stderr);
-    if (codecInfoPassed) {
-      command.emit('codecData', codecObject);
-      command._codecDataSent = true;
-    }
-  },
-
-
-  /**
-   * Extract progress data from ffmpeg stderr and emit 'progress' event if appropriate
-   *
-   * @param {FfmpegCommand} command event emitter
-   * @param {Number} [duration=0] expected output duration in seconds
-   */
-  extractProgress: function(command, stderr, duration) {
-    var lines = stderr.split(/\r\n|\r|\n/g);
-    var lastline = lines[lines.length - 2];
-    var progress;
-
-    if (lastline) {
-      progress = parseProgressLine(lastline);
-    }
-
-    if (progress) {
-      // build progress report object
-      var ret = {
-        frames: parseInt(progress.frame, 10),
-        currentFps: parseInt(progress.fps, 10),
-        currentKbps: parseFloat(progress.bitrate.replace('kbits/s', '')),
-        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);
-    }
-  }
-};
-
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.3.0-alpha5 on Thu May 08 2014 10:38:29 GMT+0200 (CEST) -
- - - - - diff --git a/node_modules/fluent-ffmpeg/doc/video.js.html b/node_modules/fluent-ffmpeg/doc/video.js.html deleted file mode 100644 index 9d4089d..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/doc/videosize.js.html b/node_modules/fluent-ffmpeg/doc/videosize.js.html deleted file mode 100644 index b94dfda..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/index.js b/node_modules/fluent-ffmpeg/index.js deleted file mode 100644 index 04e594c..0000000 --- a/node_modules/fluent-ffmpeg/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = process.env.FLUENTFFMPEG_COV ? require('./lib-cov/fluent-ffmpeg') : require('./lib/fluent-ffmpeg'); diff --git a/node_modules/fluent-ffmpeg/lib-cov/capabilities.js b/node_modules/fluent-ffmpeg/lib-cov/capabilities.js deleted file mode 100644 index bbf4bbc..0000000 --- a/node_modules/fluent-ffmpeg/lib-cov/capabilities.js +++ /dev/null @@ -1,594 +0,0 @@ -// instrument by jscoverage, do not modifly this file -(function () { - var BASE; - if (typeof global === 'object') { - BASE = global; - } else if (typeof window === 'object') { - BASE = window; - } else { - throw new Error('[jscoverage] unknow ENV!'); - } - if (!BASE._$jscoverage) { - BASE._$jscoverage = {}; - BASE._$jscoverage_cond = {}; - BASE._$jscoverage_done = function (file, line, express) { - if (arguments.length === 2) { - BASE._$jscoverage[file][line] ++; - } else { - BASE._$jscoverage_cond[file][line] ++; - return express; - } - }; - BASE._$jscoverage_init = function (base, file, lines) { - var tmp = []; - for (var i = 0; i < lines.length; i ++) { - tmp[lines[i]] = 0; - } - base[file] = tmp; - }; - } -})(); -_$jscoverage_init(_$jscoverage, "lib/capabilities.js",[4,5,6,7,13,14,15,16,17,18,19,21,23,32,33,34,35,49,50,51,54,57,58,59,60,62,66,72,73,76,77,81,82,84,101,102,103,106,107,110,111,112,115,121,122,125,126,132,133,136,137,138,139,140,141,142,143,146,151,152,154,170,171,172,175,178,179,180,183,189,190,193,194,195,198,204,205,208,209,215,216,219,220,224,225,227,256,258,259,262,263,264,267,268,269,271,272,273,274,284,311,313,314,317,318,319,322,323,325,326,327,328,339,340,341,351,352,354,355,357,358,359,360,361,363,364,365,366,369,370,371,373,374,375,382,408,410,411,415,416,417,421,422,424,425,426,427,435,449,450,451,454,459,462,464,465,466,467,471,474,475,476,477,481,483,484,485,486,490,493,494,495,496,499,504,509,512,513,514,515,516,520,523,524,525,526,530,531,532,533,534,538,541,542,543,544,547]); -_$jscoverage_init(_$jscoverage_cond, "lib/capabilities.js",[50,57,59,72,81,102,110,121,132,137,139,151,171,178,189,193,204,215,224,258,263,273,313,318,327,327,340,340,357,357,370,410,416,426,465,466,466,474,476,484,485,485,493,495,514,514,515,515,515,523,525,532,532,533,533,533,541,543]); -_$jscoverage["lib/capabilities.js"].source = ["/*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 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) {"," /**"," * 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) {"," if ('ffprobePath' in cache) {"," return callback(null, cache.ffprobePath);"," }",""," var self = this;"," 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 }, function (err, stdout) {"," if (err) {"," return callback(err);"," }",""," 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 }, function(err, stdout) {"," if (err) {"," return callback(err);"," }",""," 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#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 }, function (err, stdout) {"," if (err) {"," return callback(err);"," }",""," // Parse output"," var lines = stdout.split(lineBreakRegexp);"," var data = {};",""," lines.forEach(function(line) {"," var match = line.match(formatRegexp);"," if (match) {"," data[match[3]] = {"," description: match[4],"," canDemux: match[1] === 'D',"," canMux: match[2] === 'E'"," };"," }"," });",""," 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.availableCodecs(cb);"," },",""," // Check whether specified codecs are available"," function(codecs, 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 codecs) || codecs[acodec[0]].type !== 'audio' || !(codecs[acodec[0]].canEncode)) {"," 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 codecs) || codecs[vcodec[0]].type !== 'video' || !(codecs[vcodec[0]].canEncode)) {"," 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);"," };","};",""]; -"use strict"; - -_$jscoverage_done("lib/capabilities.js", 4); -var fs = require("fs"); - -_$jscoverage_done("lib/capabilities.js", 5); -var path = require("path"); - -_$jscoverage_done("lib/capabilities.js", 6); -var async = require("async"); - -_$jscoverage_done("lib/capabilities.js", 7); -var utils = require("./utils"); - -_$jscoverage_done("lib/capabilities.js", 13); -var avCodecRegexp = /^\s*([D ])([E ])([VAS])([S ])([D ])([T ]) ([^ ]+) +(.*)$/; - -_$jscoverage_done("lib/capabilities.js", 14); -var ffCodecRegexp = /^\s*([D\.])([E\.])([VAS])([I\.])([L\.])([S\.]) ([^ ]+) +(.*)$/; - -_$jscoverage_done("lib/capabilities.js", 15); -var ffEncodersRegexp = /\(encoders:([^\)]+)\)/; - -_$jscoverage_done("lib/capabilities.js", 16); -var ffDecodersRegexp = /\(decoders:([^\)]+)\)/; - -_$jscoverage_done("lib/capabilities.js", 17); -var formatRegexp = /^\s*([D ])([E ]) ([^ ]+) +(.*)$/; - -_$jscoverage_done("lib/capabilities.js", 18); -var lineBreakRegexp = /\r\n|\r|\n/; - -_$jscoverage_done("lib/capabilities.js", 19); -var filterRegexp = /^(?: [T\.][S\.][C\.] )?([^ ]+) +(AA?|VV?|\|)->(AA?|VV?|\|) +(.*)$/; - -_$jscoverage_done("lib/capabilities.js", 21); -var cache = {}; - -_$jscoverage_done("lib/capabilities.js", 23); -module.exports = function(proto) { - _$jscoverage_done("lib/capabilities.js", 32); - proto._forgetPaths = function() { - _$jscoverage_done("lib/capabilities.js", 33); - delete cache.ffmpegPath; - _$jscoverage_done("lib/capabilities.js", 34); - delete cache.ffprobePath; - _$jscoverage_done("lib/capabilities.js", 35); - delete cache.flvtoolPath; - }; - _$jscoverage_done("lib/capabilities.js", 49); - proto._getFfmpegPath = function(callback) { - _$jscoverage_done("lib/capabilities.js", 50); - if (_$jscoverage_done("lib/capabilities.js", 50, "ffmpegPath" in cache)) { - _$jscoverage_done("lib/capabilities.js", 51); - return callback(null, cache.ffmpegPath); - } - _$jscoverage_done("lib/capabilities.js", 54); - async.waterfall([ function(cb) { - _$jscoverage_done("lib/capabilities.js", 57); - if (_$jscoverage_done("lib/capabilities.js", 57, process.env.FFMPEG_PATH)) { - _$jscoverage_done("lib/capabilities.js", 58); - fs.exists(process.env.FFMPEG_PATH, function(exists) { - _$jscoverage_done("lib/capabilities.js", 59); - if (_$jscoverage_done("lib/capabilities.js", 59, exists)) { - _$jscoverage_done("lib/capabilities.js", 60); - cb(null, process.env.FFMPEG_PATH); - } else { - _$jscoverage_done("lib/capabilities.js", 62); - cb(null, ""); - } - }); - } else { - _$jscoverage_done("lib/capabilities.js", 66); - cb(null, ""); - } - }, function(ffmpeg, cb) { - _$jscoverage_done("lib/capabilities.js", 72); - if (_$jscoverage_done("lib/capabilities.js", 72, ffmpeg.length)) { - _$jscoverage_done("lib/capabilities.js", 73); - return cb(null, ffmpeg); - } - _$jscoverage_done("lib/capabilities.js", 76); - utils.which("ffmpeg", function(err, ffmpeg) { - _$jscoverage_done("lib/capabilities.js", 77); - cb(err, ffmpeg); - }); - } ], function(err, ffmpeg) { - _$jscoverage_done("lib/capabilities.js", 81); - if (_$jscoverage_done("lib/capabilities.js", 81, err)) { - _$jscoverage_done("lib/capabilities.js", 82); - callback(err); - } else { - _$jscoverage_done("lib/capabilities.js", 84); - callback(null, cache.ffmpegPath = ffmpeg || ""); - } - }); - }; - _$jscoverage_done("lib/capabilities.js", 101); - proto._getFfprobePath = function(callback) { - _$jscoverage_done("lib/capabilities.js", 102); - if (_$jscoverage_done("lib/capabilities.js", 102, "ffprobePath" in cache)) { - _$jscoverage_done("lib/capabilities.js", 103); - return callback(null, cache.ffprobePath); - } - _$jscoverage_done("lib/capabilities.js", 106); - var self = this; - _$jscoverage_done("lib/capabilities.js", 107); - async.waterfall([ function(cb) { - _$jscoverage_done("lib/capabilities.js", 110); - if (_$jscoverage_done("lib/capabilities.js", 110, process.env.FFPROBE_PATH)) { - _$jscoverage_done("lib/capabilities.js", 111); - fs.exists(process.env.FFPROBE_PATH, function(exists) { - _$jscoverage_done("lib/capabilities.js", 112); - cb(null, exists ? process.env.FFPROBE_PATH : ""); - }); - } else { - _$jscoverage_done("lib/capabilities.js", 115); - cb(null, ""); - } - }, function(ffprobe, cb) { - _$jscoverage_done("lib/capabilities.js", 121); - if (_$jscoverage_done("lib/capabilities.js", 121, ffprobe.length)) { - _$jscoverage_done("lib/capabilities.js", 122); - return cb(null, ffprobe); - } - _$jscoverage_done("lib/capabilities.js", 125); - utils.which("ffprobe", function(err, ffprobe) { - _$jscoverage_done("lib/capabilities.js", 126); - cb(err, ffprobe); - }); - }, function(ffprobe, cb) { - _$jscoverage_done("lib/capabilities.js", 132); - if (_$jscoverage_done("lib/capabilities.js", 132, ffprobe.length)) { - _$jscoverage_done("lib/capabilities.js", 133); - return cb(null, ffprobe); - } - _$jscoverage_done("lib/capabilities.js", 136); - self._getFfmpegPath(function(err, ffmpeg) { - _$jscoverage_done("lib/capabilities.js", 137); - if (_$jscoverage_done("lib/capabilities.js", 137, err)) { - _$jscoverage_done("lib/capabilities.js", 138); - cb(err); - } else { - _$jscoverage_done("lib/capabilities.js", 139); - if (_$jscoverage_done("lib/capabilities.js", 139, ffmpeg.length)) { - _$jscoverage_done("lib/capabilities.js", 140); - var name = utils.isWindows ? "ffprobe.exe" : "ffprobe"; - _$jscoverage_done("lib/capabilities.js", 141); - var ffprobe = path.join(path.dirname(ffmpeg), name); - _$jscoverage_done("lib/capabilities.js", 142); - fs.exists(ffprobe, function(exists) { - _$jscoverage_done("lib/capabilities.js", 143); - cb(null, exists ? ffprobe : ""); - }); - } else { - _$jscoverage_done("lib/capabilities.js", 146); - cb(null, ""); - } - } - }); - } ], function(err, ffprobe) { - _$jscoverage_done("lib/capabilities.js", 151); - if (_$jscoverage_done("lib/capabilities.js", 151, err)) { - _$jscoverage_done("lib/capabilities.js", 152); - callback(err); - } else { - _$jscoverage_done("lib/capabilities.js", 154); - callback(null, cache.ffprobePath = ffprobe || ""); - } - }); - }; - _$jscoverage_done("lib/capabilities.js", 170); - proto._getFlvtoolPath = function(callback) { - _$jscoverage_done("lib/capabilities.js", 171); - if (_$jscoverage_done("lib/capabilities.js", 171, "flvtoolPath" in cache)) { - _$jscoverage_done("lib/capabilities.js", 172); - return callback(null, cache.flvtoolPath); - } - _$jscoverage_done("lib/capabilities.js", 175); - async.waterfall([ function(cb) { - _$jscoverage_done("lib/capabilities.js", 178); - if (_$jscoverage_done("lib/capabilities.js", 178, process.env.FLVMETA_PATH)) { - _$jscoverage_done("lib/capabilities.js", 179); - fs.exists(process.env.FLVMETA_PATH, function(exists) { - _$jscoverage_done("lib/capabilities.js", 180); - cb(null, exists ? process.env.FLVMETA_PATH : ""); - }); - } else { - _$jscoverage_done("lib/capabilities.js", 183); - cb(null, ""); - } - }, function(flvtool, cb) { - _$jscoverage_done("lib/capabilities.js", 189); - if (_$jscoverage_done("lib/capabilities.js", 189, flvtool.length)) { - _$jscoverage_done("lib/capabilities.js", 190); - return cb(null, flvtool); - } - _$jscoverage_done("lib/capabilities.js", 193); - if (_$jscoverage_done("lib/capabilities.js", 193, process.env.FLVTOOL2_PATH)) { - _$jscoverage_done("lib/capabilities.js", 194); - fs.exists(process.env.FLVTOOL2_PATH, function(exists) { - _$jscoverage_done("lib/capabilities.js", 195); - cb(null, exists ? process.env.FLVTOOL2_PATH : ""); - }); - } else { - _$jscoverage_done("lib/capabilities.js", 198); - cb(null, ""); - } - }, function(flvtool, cb) { - _$jscoverage_done("lib/capabilities.js", 204); - if (_$jscoverage_done("lib/capabilities.js", 204, flvtool.length)) { - _$jscoverage_done("lib/capabilities.js", 205); - return cb(null, flvtool); - } - _$jscoverage_done("lib/capabilities.js", 208); - utils.which("flvmeta", function(err, flvmeta) { - _$jscoverage_done("lib/capabilities.js", 209); - cb(err, flvmeta); - }); - }, function(flvtool, cb) { - _$jscoverage_done("lib/capabilities.js", 215); - if (_$jscoverage_done("lib/capabilities.js", 215, flvtool.length)) { - _$jscoverage_done("lib/capabilities.js", 216); - return cb(null, flvtool); - } - _$jscoverage_done("lib/capabilities.js", 219); - utils.which("flvtool2", function(err, flvtool2) { - _$jscoverage_done("lib/capabilities.js", 220); - cb(err, flvtool2); - }); - } ], function(err, flvtool) { - _$jscoverage_done("lib/capabilities.js", 224); - if (_$jscoverage_done("lib/capabilities.js", 224, err)) { - _$jscoverage_done("lib/capabilities.js", 225); - callback(err); - } else { - _$jscoverage_done("lib/capabilities.js", 227); - callback(null, cache.flvtoolPath = flvtool || ""); - } - }); - }; - _$jscoverage_done("lib/capabilities.js", 256); - proto.availableFilters = proto.getAvailableFilters = function(callback) { - _$jscoverage_done("lib/capabilities.js", 258); - if (_$jscoverage_done("lib/capabilities.js", 258, "filters" in cache)) { - _$jscoverage_done("lib/capabilities.js", 259); - return callback(null, cache.filters); - } - _$jscoverage_done("lib/capabilities.js", 262); - this._spawnFfmpeg([ "-filters" ], { - captureStdout: true - }, function(err, stdout) { - _$jscoverage_done("lib/capabilities.js", 263); - if (_$jscoverage_done("lib/capabilities.js", 263, err)) { - _$jscoverage_done("lib/capabilities.js", 264); - return callback(err); - } - _$jscoverage_done("lib/capabilities.js", 267); - var lines = stdout.split("\n"); - _$jscoverage_done("lib/capabilities.js", 268); - var data = {}; - _$jscoverage_done("lib/capabilities.js", 269); - var types = { - A: "audio", - V: "video", - "|": "none" - }; - _$jscoverage_done("lib/capabilities.js", 271); - lines.forEach(function(line) { - _$jscoverage_done("lib/capabilities.js", 272); - var match = line.match(filterRegexp); - _$jscoverage_done("lib/capabilities.js", 273); - if (_$jscoverage_done("lib/capabilities.js", 273, match)) { - _$jscoverage_done("lib/capabilities.js", 274); - 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 - }; - } - }); - _$jscoverage_done("lib/capabilities.js", 284); - callback(null, cache.filters = data); - }); - }; - _$jscoverage_done("lib/capabilities.js", 311); - proto.availableCodecs = proto.getAvailableCodecs = function(callback) { - _$jscoverage_done("lib/capabilities.js", 313); - if (_$jscoverage_done("lib/capabilities.js", 313, "codecs" in cache)) { - _$jscoverage_done("lib/capabilities.js", 314); - return callback(null, cache.codecs); - } - _$jscoverage_done("lib/capabilities.js", 317); - this._spawnFfmpeg([ "-codecs" ], { - captureStdout: true - }, function(err, stdout) { - _$jscoverage_done("lib/capabilities.js", 318); - if (_$jscoverage_done("lib/capabilities.js", 318, err)) { - _$jscoverage_done("lib/capabilities.js", 319); - return callback(err); - } - _$jscoverage_done("lib/capabilities.js", 322); - var lines = stdout.split(lineBreakRegexp); - _$jscoverage_done("lib/capabilities.js", 323); - var data = {}; - _$jscoverage_done("lib/capabilities.js", 325); - lines.forEach(function(line) { - _$jscoverage_done("lib/capabilities.js", 326); - var match = line.match(avCodecRegexp); - _$jscoverage_done("lib/capabilities.js", 327); - if (_$jscoverage_done("lib/capabilities.js", 327, match) && _$jscoverage_done("lib/capabilities.js", 327, match[7] !== "=")) { - _$jscoverage_done("lib/capabilities.js", 328); - 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" - }; - } - _$jscoverage_done("lib/capabilities.js", 339); - match = line.match(ffCodecRegexp); - _$jscoverage_done("lib/capabilities.js", 340); - if (_$jscoverage_done("lib/capabilities.js", 340, match) && _$jscoverage_done("lib/capabilities.js", 340, match[7] !== "=")) { - _$jscoverage_done("lib/capabilities.js", 341); - 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" - }; - _$jscoverage_done("lib/capabilities.js", 351); - var encoders = codecData.description.match(ffEncodersRegexp); - _$jscoverage_done("lib/capabilities.js", 352); - encoders = encoders ? encoders[1].trim().split(" ") : []; - _$jscoverage_done("lib/capabilities.js", 354); - var decoders = codecData.description.match(ffDecodersRegexp); - _$jscoverage_done("lib/capabilities.js", 355); - decoders = decoders ? decoders[1].trim().split(" ") : []; - _$jscoverage_done("lib/capabilities.js", 357); - if (_$jscoverage_done("lib/capabilities.js", 357, encoders.length) || _$jscoverage_done("lib/capabilities.js", 357, decoders.length)) { - _$jscoverage_done("lib/capabilities.js", 358); - var coderData = {}; - _$jscoverage_done("lib/capabilities.js", 359); - utils.copy(codecData, coderData); - _$jscoverage_done("lib/capabilities.js", 360); - delete coderData.canEncode; - _$jscoverage_done("lib/capabilities.js", 361); - delete coderData.canDecode; - _$jscoverage_done("lib/capabilities.js", 363); - encoders.forEach(function(name) { - _$jscoverage_done("lib/capabilities.js", 364); - data[name] = {}; - _$jscoverage_done("lib/capabilities.js", 365); - utils.copy(coderData, data[name]); - _$jscoverage_done("lib/capabilities.js", 366); - data[name].canEncode = true; - }); - _$jscoverage_done("lib/capabilities.js", 369); - decoders.forEach(function(name) { - _$jscoverage_done("lib/capabilities.js", 370); - if (_$jscoverage_done("lib/capabilities.js", 370, name in data)) { - _$jscoverage_done("lib/capabilities.js", 371); - data[name].canDecode = true; - } else { - _$jscoverage_done("lib/capabilities.js", 373); - data[name] = {}; - _$jscoverage_done("lib/capabilities.js", 374); - utils.copy(coderData, data[name]); - _$jscoverage_done("lib/capabilities.js", 375); - data[name].canDecode = true; - } - }); - } - } - }); - _$jscoverage_done("lib/capabilities.js", 382); - callback(null, cache.codecs = data); - }); - }; - _$jscoverage_done("lib/capabilities.js", 408); - proto.availableFormats = proto.getAvailableFormats = function(callback) { - _$jscoverage_done("lib/capabilities.js", 410); - if (_$jscoverage_done("lib/capabilities.js", 410, "formats" in cache)) { - _$jscoverage_done("lib/capabilities.js", 411); - return callback(null, cache.formats); - } - _$jscoverage_done("lib/capabilities.js", 415); - this._spawnFfmpeg([ "-formats" ], { - captureStdout: true - }, function(err, stdout) { - _$jscoverage_done("lib/capabilities.js", 416); - if (_$jscoverage_done("lib/capabilities.js", 416, err)) { - _$jscoverage_done("lib/capabilities.js", 417); - return callback(err); - } - _$jscoverage_done("lib/capabilities.js", 421); - var lines = stdout.split(lineBreakRegexp); - _$jscoverage_done("lib/capabilities.js", 422); - var data = {}; - _$jscoverage_done("lib/capabilities.js", 424); - lines.forEach(function(line) { - _$jscoverage_done("lib/capabilities.js", 425); - var match = line.match(formatRegexp); - _$jscoverage_done("lib/capabilities.js", 426); - if (_$jscoverage_done("lib/capabilities.js", 426, match)) { - _$jscoverage_done("lib/capabilities.js", 427); - data[match[3]] = { - description: match[4], - canDemux: match[1] === "D", - canMux: match[2] === "E" - }; - } - }); - _$jscoverage_done("lib/capabilities.js", 435); - callback(null, cache.formats = data); - }); - }; - _$jscoverage_done("lib/capabilities.js", 449); - proto._checkCapabilities = function(callback) { - _$jscoverage_done("lib/capabilities.js", 450); - var self = this; - _$jscoverage_done("lib/capabilities.js", 451); - async.waterfall([ function(cb) { - _$jscoverage_done("lib/capabilities.js", 454); - self.availableFormats(cb); - }, function(formats, cb) { - _$jscoverage_done("lib/capabilities.js", 459); - var unavailable; - _$jscoverage_done("lib/capabilities.js", 462); - unavailable = self._outputs.reduce(function(fmts, output) { - _$jscoverage_done("lib/capabilities.js", 464); - var format = output.options.find("-f", 1); - _$jscoverage_done("lib/capabilities.js", 465); - if (_$jscoverage_done("lib/capabilities.js", 465, format)) { - _$jscoverage_done("lib/capabilities.js", 466); - if (_$jscoverage_done("lib/capabilities.js", 466, !(format[0] in formats)) || _$jscoverage_done("lib/capabilities.js", 466, !formats[format[0]].canMux)) { - _$jscoverage_done("lib/capabilities.js", 467); - fmts.push(format); - } - } - _$jscoverage_done("lib/capabilities.js", 471); - return fmts; - }, []); - _$jscoverage_done("lib/capabilities.js", 474); - if (_$jscoverage_done("lib/capabilities.js", 474, unavailable.length === 1)) { - _$jscoverage_done("lib/capabilities.js", 475); - return cb(new Error("Output format " + unavailable[0] + " is not available")); - } else { - _$jscoverage_done("lib/capabilities.js", 476); - if (_$jscoverage_done("lib/capabilities.js", 476, unavailable.length > 1)) { - _$jscoverage_done("lib/capabilities.js", 477); - return cb(new Error("Output formats " + unavailable.join(", ") + " are not available")); - } - } - _$jscoverage_done("lib/capabilities.js", 481); - unavailable = self._inputs.reduce(function(fmts, input) { - _$jscoverage_done("lib/capabilities.js", 483); - var format = input.options.find("-f", 1); - _$jscoverage_done("lib/capabilities.js", 484); - if (_$jscoverage_done("lib/capabilities.js", 484, format)) { - _$jscoverage_done("lib/capabilities.js", 485); - if (_$jscoverage_done("lib/capabilities.js", 485, !(format[0] in formats)) || _$jscoverage_done("lib/capabilities.js", 485, !formats[format[0]].canDemux)) { - _$jscoverage_done("lib/capabilities.js", 486); - fmts.push(format[0]); - } - } - _$jscoverage_done("lib/capabilities.js", 490); - return fmts; - }, []); - _$jscoverage_done("lib/capabilities.js", 493); - if (_$jscoverage_done("lib/capabilities.js", 493, unavailable.length === 1)) { - _$jscoverage_done("lib/capabilities.js", 494); - return cb(new Error("Input format " + unavailable[0] + " is not available")); - } else { - _$jscoverage_done("lib/capabilities.js", 495); - if (_$jscoverage_done("lib/capabilities.js", 495, unavailable.length > 1)) { - _$jscoverage_done("lib/capabilities.js", 496); - return cb(new Error("Input formats " + unavailable.join(", ") + " are not available")); - } - } - _$jscoverage_done("lib/capabilities.js", 499); - cb(); - }, function(cb) { - _$jscoverage_done("lib/capabilities.js", 504); - self.availableCodecs(cb); - }, function(codecs, cb) { - _$jscoverage_done("lib/capabilities.js", 509); - var unavailable; - _$jscoverage_done("lib/capabilities.js", 512); - unavailable = self._outputs.reduce(function(cdcs, output) { - _$jscoverage_done("lib/capabilities.js", 513); - var acodec = output.audio.find("-acodec", 1); - _$jscoverage_done("lib/capabilities.js", 514); - if (_$jscoverage_done("lib/capabilities.js", 514, acodec) && _$jscoverage_done("lib/capabilities.js", 514, acodec[0] !== "copy")) { - _$jscoverage_done("lib/capabilities.js", 515); - if (_$jscoverage_done("lib/capabilities.js", 515, !(acodec[0] in codecs)) || _$jscoverage_done("lib/capabilities.js", 515, codecs[acodec[0]].type !== "audio") || _$jscoverage_done("lib/capabilities.js", 515, !codecs[acodec[0]].canEncode)) { - _$jscoverage_done("lib/capabilities.js", 516); - cdcs.push(acodec[0]); - } - } - _$jscoverage_done("lib/capabilities.js", 520); - return cdcs; - }, []); - _$jscoverage_done("lib/capabilities.js", 523); - if (_$jscoverage_done("lib/capabilities.js", 523, unavailable.length === 1)) { - _$jscoverage_done("lib/capabilities.js", 524); - return cb(new Error("Audio codec " + unavailable[0] + " is not available")); - } else { - _$jscoverage_done("lib/capabilities.js", 525); - if (_$jscoverage_done("lib/capabilities.js", 525, unavailable.length > 1)) { - _$jscoverage_done("lib/capabilities.js", 526); - return cb(new Error("Audio codecs " + unavailable.join(", ") + " are not available")); - } - } - _$jscoverage_done("lib/capabilities.js", 530); - unavailable = self._outputs.reduce(function(cdcs, output) { - _$jscoverage_done("lib/capabilities.js", 531); - var vcodec = output.video.find("-vcodec", 1); - _$jscoverage_done("lib/capabilities.js", 532); - if (_$jscoverage_done("lib/capabilities.js", 532, vcodec) && _$jscoverage_done("lib/capabilities.js", 532, vcodec[0] !== "copy")) { - _$jscoverage_done("lib/capabilities.js", 533); - if (_$jscoverage_done("lib/capabilities.js", 533, !(vcodec[0] in codecs)) || _$jscoverage_done("lib/capabilities.js", 533, codecs[vcodec[0]].type !== "video") || _$jscoverage_done("lib/capabilities.js", 533, !codecs[vcodec[0]].canEncode)) { - _$jscoverage_done("lib/capabilities.js", 534); - cdcs.push(vcodec[0]); - } - } - _$jscoverage_done("lib/capabilities.js", 538); - return cdcs; - }, []); - _$jscoverage_done("lib/capabilities.js", 541); - if (_$jscoverage_done("lib/capabilities.js", 541, unavailable.length === 1)) { - _$jscoverage_done("lib/capabilities.js", 542); - return cb(new Error("Video codec " + unavailable[0] + " is not available")); - } else { - _$jscoverage_done("lib/capabilities.js", 543); - if (_$jscoverage_done("lib/capabilities.js", 543, unavailable.length > 1)) { - _$jscoverage_done("lib/capabilities.js", 544); - return cb(new Error("Video codecs " + unavailable.join(", ") + " are not available")); - } - } - _$jscoverage_done("lib/capabilities.js", 547); - cb(); - } ], callback); - }; -}; \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/lib-cov/ffprobe.js b/node_modules/fluent-ffmpeg/lib-cov/ffprobe.js deleted file mode 100644 index 4bd70f0..0000000 --- a/node_modules/fluent-ffmpeg/lib-cov/ffprobe.js +++ /dev/null @@ -1,220 +0,0 @@ -// instrument by jscoverage, do not modifly this file -(function () { - var BASE; - if (typeof global === 'object') { - BASE = global; - } else if (typeof window === 'object') { - BASE = window; - } else { - throw new Error('[jscoverage] unknow ENV!'); - } - if (!BASE._$jscoverage) { - BASE._$jscoverage = {}; - BASE._$jscoverage_cond = {}; - BASE._$jscoverage_done = function (file, line, express) { - if (arguments.length === 2) { - BASE._$jscoverage[file][line] ++; - } else { - BASE._$jscoverage_cond[file][line] ++; - return express; - } - }; - BASE._$jscoverage_init = function (base, file, lines) { - var tmp = []; - for (var i = 0; i < lines.length; i ++) { - tmp[lines[i]] = 0; - } - base[file] = tmp; - }; - } -})(); -_$jscoverage_init(_$jscoverage, "lib/ffprobe.js",[4,7,8,11,36,37,39,40,42,43,46,48,50,51,55,56,60,61,62,63,64,67,68,69,70,73,80,81,85,87,88,91,92,93,94,97,101,103,104,106,110,111,113,114,116,117,118,122,124,125,127,128,129,134,139,140,141,143,144,145,146,148,153,154,157,158,159,162,163,166,167,168]); -_$jscoverage_init(_$jscoverage_cond, "lib/ffprobe.js",[39,42,50,55,61,63,87,91,91,91,92,93,113,124,143,145]); -_$jscoverage["lib/ffprobe.js"].source = ["/*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:/); }","","","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 {FfmpegCommand~ffprobeCallback} callback callback function"," *"," */"," proto.ffprobe = function(index, callback) {"," var input;",""," if (typeof callback === 'undefined') {"," callback = index;",""," if (!this._currentInput) {"," return callback(new Error('No input specified'));"," }",""," input = this._currentInput;"," } else {"," input = this._inputs[index];",""," if (!input) {"," return callback(new Error('Invalid input index'));"," }"," }",""," if (!input.isFile) {"," return callback(new Error('Cannot run ffprobe on non-file input'));"," }",""," // Find ffprobe"," this._getFfprobePath(function(err, path) {"," if (err) {"," return callback(err);"," } else if (!path) {"," return callback(new Error('Cannot find ffprobe'));"," }",""," var stdout = '';"," var stdoutClosed = false;"," var stderr = '';"," var stderrClosed = false;",""," // Spawn ffprobe"," var ffprobe = spawn(path, ["," '-print_format', 'json',"," '-show_streams',"," '-show_format',"," input.source"," ]);",""," ffprobe.on('error', function(err) {"," callback(err);"," });",""," // 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 callback(exitError);"," }",""," // Process output"," var data;",""," try {"," data = JSON.parse(stdout);"," } catch(e) {"," return callback(e);"," }",""," // Handle legacy output with \"TAG:x\" and \"DISPOSITION:x\" keys"," [data.format].concat(data.streams).forEach(function(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];"," });"," }"," });",""," callback(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();"," });"," });"," };","};","",""]; -"use strict"; - -_$jscoverage_done("lib/ffprobe.js", 4); -var spawn = require("child_process").spawn; - -function legacyTag(key) { - _$jscoverage_done("lib/ffprobe.js", 7); - return key.match(/^TAG:/); -} - -function legacyDisposition(key) { - _$jscoverage_done("lib/ffprobe.js", 8); - return key.match(/^DISPOSITION:/); -} - -_$jscoverage_done("lib/ffprobe.js", 11); -module.exports = function(proto) { - _$jscoverage_done("lib/ffprobe.js", 36); - proto.ffprobe = function(index, callback) { - _$jscoverage_done("lib/ffprobe.js", 37); - var input; - _$jscoverage_done("lib/ffprobe.js", 39); - if (_$jscoverage_done("lib/ffprobe.js", 39, typeof callback === "undefined")) { - _$jscoverage_done("lib/ffprobe.js", 40); - callback = index; - _$jscoverage_done("lib/ffprobe.js", 42); - if (_$jscoverage_done("lib/ffprobe.js", 42, !this._currentInput)) { - _$jscoverage_done("lib/ffprobe.js", 43); - return callback(new Error("No input specified")); - } - _$jscoverage_done("lib/ffprobe.js", 46); - input = this._currentInput; - } else { - _$jscoverage_done("lib/ffprobe.js", 48); - input = this._inputs[index]; - _$jscoverage_done("lib/ffprobe.js", 50); - if (_$jscoverage_done("lib/ffprobe.js", 50, !input)) { - _$jscoverage_done("lib/ffprobe.js", 51); - return callback(new Error("Invalid input index")); - } - } - _$jscoverage_done("lib/ffprobe.js", 55); - if (_$jscoverage_done("lib/ffprobe.js", 55, !input.isFile)) { - _$jscoverage_done("lib/ffprobe.js", 56); - return callback(new Error("Cannot run ffprobe on non-file input")); - } - _$jscoverage_done("lib/ffprobe.js", 60); - this._getFfprobePath(function(err, path) { - _$jscoverage_done("lib/ffprobe.js", 61); - if (_$jscoverage_done("lib/ffprobe.js", 61, err)) { - _$jscoverage_done("lib/ffprobe.js", 62); - return callback(err); - } else { - _$jscoverage_done("lib/ffprobe.js", 63); - if (_$jscoverage_done("lib/ffprobe.js", 63, !path)) { - _$jscoverage_done("lib/ffprobe.js", 64); - return callback(new Error("Cannot find ffprobe")); - } - } - _$jscoverage_done("lib/ffprobe.js", 67); - var stdout = ""; - _$jscoverage_done("lib/ffprobe.js", 68); - var stdoutClosed = false; - _$jscoverage_done("lib/ffprobe.js", 69); - var stderr = ""; - _$jscoverage_done("lib/ffprobe.js", 70); - var stderrClosed = false; - _$jscoverage_done("lib/ffprobe.js", 73); - var ffprobe = spawn(path, [ "-print_format", "json", "-show_streams", "-show_format", input.source ]); - _$jscoverage_done("lib/ffprobe.js", 80); - ffprobe.on("error", function(err) { - _$jscoverage_done("lib/ffprobe.js", 81); - callback(err); - }); - _$jscoverage_done("lib/ffprobe.js", 85); - var exitError = null; - function handleExit(err) { - _$jscoverage_done("lib/ffprobe.js", 87); - if (_$jscoverage_done("lib/ffprobe.js", 87, err)) { - _$jscoverage_done("lib/ffprobe.js", 88); - exitError = err; - } - _$jscoverage_done("lib/ffprobe.js", 91); - if (_$jscoverage_done("lib/ffprobe.js", 91, processExited) && _$jscoverage_done("lib/ffprobe.js", 91, stdoutClosed) && _$jscoverage_done("lib/ffprobe.js", 91, stderrClosed)) { - _$jscoverage_done("lib/ffprobe.js", 92); - if (_$jscoverage_done("lib/ffprobe.js", 92, exitError)) { - _$jscoverage_done("lib/ffprobe.js", 93); - if (_$jscoverage_done("lib/ffprobe.js", 93, stderr)) { - _$jscoverage_done("lib/ffprobe.js", 94); - exitError.message += "\n" + stderr; - } - _$jscoverage_done("lib/ffprobe.js", 97); - return callback(exitError); - } - _$jscoverage_done("lib/ffprobe.js", 101); - var data; - _$jscoverage_done("lib/ffprobe.js", 103); - try { - _$jscoverage_done("lib/ffprobe.js", 104); - data = JSON.parse(stdout); - } catch (e) { - _$jscoverage_done("lib/ffprobe.js", 106); - return callback(e); - } - _$jscoverage_done("lib/ffprobe.js", 110); - [ data.format ].concat(data.streams).forEach(function(target) { - _$jscoverage_done("lib/ffprobe.js", 111); - var legacyTagKeys = Object.keys(target).filter(legacyTag); - _$jscoverage_done("lib/ffprobe.js", 113); - if (_$jscoverage_done("lib/ffprobe.js", 113, legacyTagKeys.length)) { - _$jscoverage_done("lib/ffprobe.js", 114); - target.tags = target.tags || {}; - _$jscoverage_done("lib/ffprobe.js", 116); - legacyTagKeys.forEach(function(tagKey) { - _$jscoverage_done("lib/ffprobe.js", 117); - target.tags[tagKey.substr(4)] = target[tagKey]; - _$jscoverage_done("lib/ffprobe.js", 118); - delete target[tagKey]; - }); - } - _$jscoverage_done("lib/ffprobe.js", 122); - var legacyDispositionKeys = Object.keys(target).filter(legacyDisposition); - _$jscoverage_done("lib/ffprobe.js", 124); - if (_$jscoverage_done("lib/ffprobe.js", 124, legacyDispositionKeys.length)) { - _$jscoverage_done("lib/ffprobe.js", 125); - target.disposition = target.disposition || {}; - _$jscoverage_done("lib/ffprobe.js", 127); - legacyDispositionKeys.forEach(function(dispositionKey) { - _$jscoverage_done("lib/ffprobe.js", 128); - target.disposition[dispositionKey.substr(12)] = target[dispositionKey]; - _$jscoverage_done("lib/ffprobe.js", 129); - delete target[dispositionKey]; - }); - } - }); - _$jscoverage_done("lib/ffprobe.js", 134); - callback(null, data); - } - } - _$jscoverage_done("lib/ffprobe.js", 139); - var processExited = false; - _$jscoverage_done("lib/ffprobe.js", 140); - ffprobe.on("exit", function(code, signal) { - _$jscoverage_done("lib/ffprobe.js", 141); - processExited = true; - _$jscoverage_done("lib/ffprobe.js", 143); - if (_$jscoverage_done("lib/ffprobe.js", 143, code)) { - _$jscoverage_done("lib/ffprobe.js", 144); - handleExit(new Error("ffprobe exited with code " + code)); - } else { - _$jscoverage_done("lib/ffprobe.js", 145); - if (_$jscoverage_done("lib/ffprobe.js", 145, signal)) { - _$jscoverage_done("lib/ffprobe.js", 146); - handleExit(new Error("ffprobe was killed with signal " + signal)); - } else { - _$jscoverage_done("lib/ffprobe.js", 148); - handleExit(); - } - } - }); - _$jscoverage_done("lib/ffprobe.js", 153); - ffprobe.stdout.on("data", function(data) { - _$jscoverage_done("lib/ffprobe.js", 154); - stdout += data; - }); - _$jscoverage_done("lib/ffprobe.js", 157); - ffprobe.stdout.on("close", function() { - _$jscoverage_done("lib/ffprobe.js", 158); - stdoutClosed = true; - _$jscoverage_done("lib/ffprobe.js", 159); - handleExit(); - }); - _$jscoverage_done("lib/ffprobe.js", 162); - ffprobe.stderr.on("data", function(data) { - _$jscoverage_done("lib/ffprobe.js", 163); - stderr += data; - }); - _$jscoverage_done("lib/ffprobe.js", 166); - ffprobe.stderr.on("close", function() { - _$jscoverage_done("lib/ffprobe.js", 167); - stderrClosed = true; - _$jscoverage_done("lib/ffprobe.js", 168); - handleExit(); - }); - }); - }; -}; \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/lib-cov/fluent-ffmpeg.js b/node_modules/fluent-ffmpeg/lib-cov/fluent-ffmpeg.js deleted file mode 100644 index fa805cc..0000000 --- a/node_modules/fluent-ffmpeg/lib-cov/fluent-ffmpeg.js +++ /dev/null @@ -1,216 +0,0 @@ -// instrument by jscoverage, do not modifly this file -(function () { - var BASE; - if (typeof global === 'object') { - BASE = global; - } else if (typeof window === 'object') { - BASE = window; - } else { - throw new Error('[jscoverage] unknow ENV!'); - } - if (!BASE._$jscoverage) { - BASE._$jscoverage = {}; - BASE._$jscoverage_cond = {}; - BASE._$jscoverage_done = function (file, line, express) { - if (arguments.length === 2) { - BASE._$jscoverage[file][line] ++; - } else { - BASE._$jscoverage_cond[file][line] ++; - return express; - } - }; - BASE._$jscoverage_init = function (base, file, lines) { - var tmp = []; - for (var i = 0; i < lines.length; i ++) { - tmp[lines[i]] = 0; - } - base[file] = tmp; - }; - } -})(); -_$jscoverage_init(_$jscoverage, "lib/fluent-ffmpeg.js",[4,5,6,8,9,32,33,36,38,40,43,44,48,49,50,54,55,58,59,60,64,65,68,71,78,79,110,111,112,115,116,119,120,127,129,130,133,139,140,143,144,145,148,152,153,156,162,163,164,165,166,167,168,173,178,180,182,185,187,190,192,198,200,201,206]); -_$jscoverage_init(_$jscoverage_cond, "lib/fluent-ffmpeg.js",[32,38,38,49,127,143]); -_$jscoverage["lib/fluent-ffmpeg.js"].source = ["/*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 {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.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.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, callback) {"," (new FfmpegCommand(file)).ffprobe(callback);","};","","/* Add processing recipes */","","require('./recipes')(FfmpegCommand.prototype);",""]; -"use strict"; - -_$jscoverage_done("lib/fluent-ffmpeg.js", 4); -var path = require("path"); - -_$jscoverage_done("lib/fluent-ffmpeg.js", 5); -var util = require("util"); - -_$jscoverage_done("lib/fluent-ffmpeg.js", 6); -var EventEmitter = require("events").EventEmitter; - -_$jscoverage_done("lib/fluent-ffmpeg.js", 8); -var utils = require("./utils"); - -_$jscoverage_done("lib/fluent-ffmpeg.js", 9); -var ARGLISTS = [ "_global", "_audio", "_audioFilters", "_video", "_videoFilters", "_sizeFilters", "_complexFilters" ]; - -function FfmpegCommand(input, options) { - _$jscoverage_done("lib/fluent-ffmpeg.js", 32); - if (_$jscoverage_done("lib/fluent-ffmpeg.js", 32, !(this instanceof FfmpegCommand))) { - _$jscoverage_done("lib/fluent-ffmpeg.js", 33); - return new FfmpegCommand(input, options); - } - _$jscoverage_done("lib/fluent-ffmpeg.js", 36); - EventEmitter.call(this); - _$jscoverage_done("lib/fluent-ffmpeg.js", 38); - if (_$jscoverage_done("lib/fluent-ffmpeg.js", 38, typeof input === "object") && _$jscoverage_done("lib/fluent-ffmpeg.js", 38, !("readable" in input))) { - _$jscoverage_done("lib/fluent-ffmpeg.js", 40); - options = input; - } else { - _$jscoverage_done("lib/fluent-ffmpeg.js", 43); - options = options || {}; - _$jscoverage_done("lib/fluent-ffmpeg.js", 44); - options.source = input; - } - _$jscoverage_done("lib/fluent-ffmpeg.js", 48); - this._inputs = []; - _$jscoverage_done("lib/fluent-ffmpeg.js", 49); - if (_$jscoverage_done("lib/fluent-ffmpeg.js", 49, options.source)) { - _$jscoverage_done("lib/fluent-ffmpeg.js", 50); - this.input(options.source); - } - _$jscoverage_done("lib/fluent-ffmpeg.js", 54); - this._outputs = []; - _$jscoverage_done("lib/fluent-ffmpeg.js", 55); - this.output(); - _$jscoverage_done("lib/fluent-ffmpeg.js", 58); - var self = this; - _$jscoverage_done("lib/fluent-ffmpeg.js", 59); - [ "_global", "_complexFilters" ].forEach(function(prop) { - _$jscoverage_done("lib/fluent-ffmpeg.js", 60); - self[prop] = utils.args(); - }); - _$jscoverage_done("lib/fluent-ffmpeg.js", 64); - options.presets = options.presets || options.preset || path.join(__dirname, "presets"); - _$jscoverage_done("lib/fluent-ffmpeg.js", 65); - options.niceness = options.niceness || options.priority || 0; - _$jscoverage_done("lib/fluent-ffmpeg.js", 68); - this.options = options; - _$jscoverage_done("lib/fluent-ffmpeg.js", 71); - this.logger = options.logger || { - debug: function() {}, - info: function() {}, - warn: function() {}, - error: function() {} - }; -} - -_$jscoverage_done("lib/fluent-ffmpeg.js", 78); -util.inherits(FfmpegCommand, EventEmitter); - -_$jscoverage_done("lib/fluent-ffmpeg.js", 79); -module.exports = FfmpegCommand; - -_$jscoverage_done("lib/fluent-ffmpeg.js", 110); -FfmpegCommand.prototype.clone = function() { - _$jscoverage_done("lib/fluent-ffmpeg.js", 111); - var clone = new FfmpegCommand; - _$jscoverage_done("lib/fluent-ffmpeg.js", 112); - var self = this; - _$jscoverage_done("lib/fluent-ffmpeg.js", 115); - clone.options = this.options; - _$jscoverage_done("lib/fluent-ffmpeg.js", 116); - clone.logger = this.logger; - _$jscoverage_done("lib/fluent-ffmpeg.js", 119); - clone._inputs = this._inputs.map(function(input) { - _$jscoverage_done("lib/fluent-ffmpeg.js", 120); - return { - source: input.source, - options: input.options.clone() - }; - }); - _$jscoverage_done("lib/fluent-ffmpeg.js", 127); - if (_$jscoverage_done("lib/fluent-ffmpeg.js", 127, "target" in this._outputs[0])) { - _$jscoverage_done("lib/fluent-ffmpeg.js", 129); - clone._outputs = []; - _$jscoverage_done("lib/fluent-ffmpeg.js", 130); - clone.output(); - } else { - _$jscoverage_done("lib/fluent-ffmpeg.js", 133); - clone._outputs = [ clone._currentOutput = { - flags: {} - } ]; - _$jscoverage_done("lib/fluent-ffmpeg.js", 139); - [ "audio", "audioFilters", "video", "videoFilters", "sizeFilters", "options" ].forEach(function(key) { - _$jscoverage_done("lib/fluent-ffmpeg.js", 140); - clone._currentOutput[key] = self._currentOutput[key].clone(); - }); - _$jscoverage_done("lib/fluent-ffmpeg.js", 143); - if (_$jscoverage_done("lib/fluent-ffmpeg.js", 143, this._currentOutput.sizeData)) { - _$jscoverage_done("lib/fluent-ffmpeg.js", 144); - clone._currentOutput.sizeData = {}; - _$jscoverage_done("lib/fluent-ffmpeg.js", 145); - utils.copy(this._currentOutput.sizeData, clone._currentOutput.sizeData); - } - _$jscoverage_done("lib/fluent-ffmpeg.js", 148); - utils.copy(this._currentOutput.flags, clone._currentOutput.flags); - } - _$jscoverage_done("lib/fluent-ffmpeg.js", 152); - [ "_global", "_complexFilters" ].forEach(function(prop) { - _$jscoverage_done("lib/fluent-ffmpeg.js", 153); - clone[prop] = self[prop].clone(); - }); - _$jscoverage_done("lib/fluent-ffmpeg.js", 156); - return clone; -}; - -_$jscoverage_done("lib/fluent-ffmpeg.js", 162); -require("./options/inputs")(FfmpegCommand.prototype); - -_$jscoverage_done("lib/fluent-ffmpeg.js", 163); -require("./options/audio")(FfmpegCommand.prototype); - -_$jscoverage_done("lib/fluent-ffmpeg.js", 164); -require("./options/video")(FfmpegCommand.prototype); - -_$jscoverage_done("lib/fluent-ffmpeg.js", 165); -require("./options/videosize")(FfmpegCommand.prototype); - -_$jscoverage_done("lib/fluent-ffmpeg.js", 166); -require("./options/output")(FfmpegCommand.prototype); - -_$jscoverage_done("lib/fluent-ffmpeg.js", 167); -require("./options/custom")(FfmpegCommand.prototype); - -_$jscoverage_done("lib/fluent-ffmpeg.js", 168); -require("./options/misc")(FfmpegCommand.prototype); - -_$jscoverage_done("lib/fluent-ffmpeg.js", 173); -require("./processor")(FfmpegCommand.prototype); - -_$jscoverage_done("lib/fluent-ffmpeg.js", 178); -require("./capabilities")(FfmpegCommand.prototype); - -_$jscoverage_done("lib/fluent-ffmpeg.js", 180); -FfmpegCommand.availableFilters = FfmpegCommand.getAvailableFilters = function(callback) { - _$jscoverage_done("lib/fluent-ffmpeg.js", 182); - (new FfmpegCommand).availableFilters(callback); -}; - -_$jscoverage_done("lib/fluent-ffmpeg.js", 185); -FfmpegCommand.availableCodecs = FfmpegCommand.getAvailableCodecs = function(callback) { - _$jscoverage_done("lib/fluent-ffmpeg.js", 187); - (new FfmpegCommand).availableCodecs(callback); -}; - -_$jscoverage_done("lib/fluent-ffmpeg.js", 190); -FfmpegCommand.availableFormats = FfmpegCommand.getAvailableFormats = function(callback) { - _$jscoverage_done("lib/fluent-ffmpeg.js", 192); - (new FfmpegCommand).availableFormats(callback); -}; - -_$jscoverage_done("lib/fluent-ffmpeg.js", 198); -require("./ffprobe")(FfmpegCommand.prototype); - -_$jscoverage_done("lib/fluent-ffmpeg.js", 200); -FfmpegCommand.ffprobe = function(file, callback) { - _$jscoverage_done("lib/fluent-ffmpeg.js", 201); - (new FfmpegCommand(file)).ffprobe(callback); -}; - -_$jscoverage_done("lib/fluent-ffmpeg.js", 206); -require("./recipes")(FfmpegCommand.prototype); \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/lib-cov/options/audio.js b/node_modules/fluent-ffmpeg/lib-cov/options/audio.js deleted file mode 100644 index 1f4e5af..0000000 --- a/node_modules/fluent-ffmpeg/lib-cov/options/audio.js +++ /dev/null @@ -1,104 +0,0 @@ -// instrument by jscoverage, do not modifly this file -(function () { - var BASE; - if (typeof global === 'object') { - BASE = global; - } else if (typeof window === 'object') { - BASE = window; - } else { - throw new Error('[jscoverage] unknow ENV!'); - } - if (!BASE._$jscoverage) { - BASE._$jscoverage = {}; - BASE._$jscoverage_cond = {}; - BASE._$jscoverage_done = function (file, line, express) { - if (arguments.length === 2) { - BASE._$jscoverage[file][line] ++; - } else { - BASE._$jscoverage_cond[file][line] ++; - return express; - } - }; - BASE._$jscoverage_init = function (base, file, lines) { - var tmp = []; - for (var i = 0; i < lines.length; i ++) { - tmp[lines[i]] = 0; - } - base[file] = tmp; - }; - } -})(); -_$jscoverage_init(_$jscoverage, "lib/options/audio.js",[4,11,20,22,23,24,26,40,42,43,57,59,60,74,76,77,91,93,94,108,110,111,162,166,167,170,171,174,175]); -_$jscoverage_init(_$jscoverage_cond, "lib/options/audio.js",[166,170]); -_$jscoverage["lib/options/audio.js"].source = ["/*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;"," };","};",""]; -"use strict"; - -_$jscoverage_done("lib/options/audio.js", 4); -var utils = require("../utils"); - -_$jscoverage_done("lib/options/audio.js", 11); -module.exports = function(proto) { - _$jscoverage_done("lib/options/audio.js", 20); - proto.withNoAudio = proto.noAudio = function() { - _$jscoverage_done("lib/options/audio.js", 22); - this._currentOutput.audio.clear(); - _$jscoverage_done("lib/options/audio.js", 23); - this._currentOutput.audioFilters.clear(); - _$jscoverage_done("lib/options/audio.js", 24); - this._currentOutput.audio("-an"); - _$jscoverage_done("lib/options/audio.js", 26); - return this; - }; - _$jscoverage_done("lib/options/audio.js", 40); - proto.withAudioCodec = proto.audioCodec = function(codec) { - _$jscoverage_done("lib/options/audio.js", 42); - this._currentOutput.audio("-acodec", codec); - _$jscoverage_done("lib/options/audio.js", 43); - return this; - }; - _$jscoverage_done("lib/options/audio.js", 57); - proto.withAudioBitrate = proto.audioBitrate = function(bitrate) { - _$jscoverage_done("lib/options/audio.js", 59); - this._currentOutput.audio("-b:a", ("" + bitrate).replace(/k?$/, "k")); - _$jscoverage_done("lib/options/audio.js", 60); - return this; - }; - _$jscoverage_done("lib/options/audio.js", 74); - proto.withAudioChannels = proto.audioChannels = function(channels) { - _$jscoverage_done("lib/options/audio.js", 76); - this._currentOutput.audio("-ac", channels); - _$jscoverage_done("lib/options/audio.js", 77); - return this; - }; - _$jscoverage_done("lib/options/audio.js", 91); - proto.withAudioFrequency = proto.audioFrequency = function(freq) { - _$jscoverage_done("lib/options/audio.js", 93); - this._currentOutput.audio("-ar", freq); - _$jscoverage_done("lib/options/audio.js", 94); - return this; - }; - _$jscoverage_done("lib/options/audio.js", 108); - proto.withAudioQuality = proto.audioQuality = function(quality) { - _$jscoverage_done("lib/options/audio.js", 110); - this._currentOutput.audio("-aq", quality); - _$jscoverage_done("lib/options/audio.js", 111); - return this; - }; - _$jscoverage_done("lib/options/audio.js", 162); - proto.withAudioFilter = proto.withAudioFilters = proto.audioFilter = proto.audioFilters = function(filters) { - _$jscoverage_done("lib/options/audio.js", 166); - if (_$jscoverage_done("lib/options/audio.js", 166, arguments.length > 1)) { - _$jscoverage_done("lib/options/audio.js", 167); - filters = [].slice.call(arguments); - } - _$jscoverage_done("lib/options/audio.js", 170); - if (_$jscoverage_done("lib/options/audio.js", 170, !Array.isArray(filters))) { - _$jscoverage_done("lib/options/audio.js", 171); - filters = [ filters ]; - } - _$jscoverage_done("lib/options/audio.js", 174); - this._currentOutput.audioFilters(utils.makeFilterStrings(filters)); - _$jscoverage_done("lib/options/audio.js", 175); - return this; - }; -}; \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/lib-cov/options/custom.js b/node_modules/fluent-ffmpeg/lib-cov/options/custom.js deleted file mode 100644 index d0351d7..0000000 --- a/node_modules/fluent-ffmpeg/lib-cov/options/custom.js +++ /dev/null @@ -1,144 +0,0 @@ -// instrument by jscoverage, do not modifly this file -(function () { - var BASE; - if (typeof global === 'object') { - BASE = global; - } else if (typeof window === 'object') { - BASE = window; - } else { - throw new Error('[jscoverage] unknow ENV!'); - } - if (!BASE._$jscoverage) { - BASE._$jscoverage = {}; - BASE._$jscoverage_cond = {}; - BASE._$jscoverage_done = function (file, line, express) { - if (arguments.length === 2) { - BASE._$jscoverage[file][line] ++; - } else { - BASE._$jscoverage_cond[file][line] ++; - return express; - } - }; - BASE._$jscoverage_init = function (base, file, lines) { - var tmp = []; - for (var i = 0; i < lines.length; i ++) { - tmp[lines[i]] = 0; - } - base[file] = tmp; - }; - } -})(); -_$jscoverage_init(_$jscoverage, "lib/options/custom.js",[4,11,36,42,43,46,48,49,50,53,54,57,58,60,61,63,66,68,91,101,103,104,105,108,109,112,113,115,116,118,121,123,191,193,195,196,199,201,202,203,204,206,207,210]); -_$jscoverage_init(_$jscoverage_cond, "lib/options/custom.js",[42,48,53,60,60,103,108,115,115,195,201,206]); -_$jscoverage["lib/options/custom.js"].source = ["/*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 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;"," };","};",""]; -"use strict"; - -_$jscoverage_done("lib/options/custom.js", 4); -var utils = require("../utils"); - -_$jscoverage_done("lib/options/custom.js", 11); -module.exports = function(proto) { - _$jscoverage_done("lib/options/custom.js", 36); - proto.addInputOption = proto.addInputOptions = proto.withInputOption = proto.withInputOptions = proto.inputOption = proto.inputOptions = function(options) { - _$jscoverage_done("lib/options/custom.js", 42); - if (_$jscoverage_done("lib/options/custom.js", 42, !this._currentInput)) { - _$jscoverage_done("lib/options/custom.js", 43); - throw new Error("No input specified"); - } - _$jscoverage_done("lib/options/custom.js", 46); - var doSplit = true; - _$jscoverage_done("lib/options/custom.js", 48); - if (_$jscoverage_done("lib/options/custom.js", 48, arguments.length > 1)) { - _$jscoverage_done("lib/options/custom.js", 49); - options = [].slice.call(arguments); - _$jscoverage_done("lib/options/custom.js", 50); - doSplit = false; - } - _$jscoverage_done("lib/options/custom.js", 53); - if (_$jscoverage_done("lib/options/custom.js", 53, !Array.isArray(options))) { - _$jscoverage_done("lib/options/custom.js", 54); - options = [ options ]; - } - _$jscoverage_done("lib/options/custom.js", 57); - this._currentInput.options(options.reduce(function(options, option) { - _$jscoverage_done("lib/options/custom.js", 58); - var split = option.split(" "); - _$jscoverage_done("lib/options/custom.js", 60); - if (_$jscoverage_done("lib/options/custom.js", 60, doSplit) && _$jscoverage_done("lib/options/custom.js", 60, split.length === 2)) { - _$jscoverage_done("lib/options/custom.js", 61); - options.push(split[0], split[1]); - } else { - _$jscoverage_done("lib/options/custom.js", 63); - options.push(option); - } - _$jscoverage_done("lib/options/custom.js", 66); - return options; - }, [])); - _$jscoverage_done("lib/options/custom.js", 68); - return this; - }; - _$jscoverage_done("lib/options/custom.js", 91); - proto.addOutputOption = proto.addOutputOptions = proto.addOption = proto.addOptions = proto.withOutputOption = proto.withOutputOptions = proto.withOption = proto.withOptions = proto.outputOption = proto.outputOptions = function(options) { - _$jscoverage_done("lib/options/custom.js", 101); - var doSplit = true; - _$jscoverage_done("lib/options/custom.js", 103); - if (_$jscoverage_done("lib/options/custom.js", 103, arguments.length > 1)) { - _$jscoverage_done("lib/options/custom.js", 104); - options = [].slice.call(arguments); - _$jscoverage_done("lib/options/custom.js", 105); - doSplit = false; - } - _$jscoverage_done("lib/options/custom.js", 108); - if (_$jscoverage_done("lib/options/custom.js", 108, !Array.isArray(options))) { - _$jscoverage_done("lib/options/custom.js", 109); - options = [ options ]; - } - _$jscoverage_done("lib/options/custom.js", 112); - this._currentOutput.options(options.reduce(function(options, option) { - _$jscoverage_done("lib/options/custom.js", 113); - var split = option.split(" "); - _$jscoverage_done("lib/options/custom.js", 115); - if (_$jscoverage_done("lib/options/custom.js", 115, doSplit) && _$jscoverage_done("lib/options/custom.js", 115, split.length === 2)) { - _$jscoverage_done("lib/options/custom.js", 116); - options.push(split[0], split[1]); - } else { - _$jscoverage_done("lib/options/custom.js", 118); - options.push(option); - } - _$jscoverage_done("lib/options/custom.js", 121); - return options; - }, [])); - _$jscoverage_done("lib/options/custom.js", 123); - return this; - }; - _$jscoverage_done("lib/options/custom.js", 191); - proto.filterGraph = proto.complexFilter = function(spec, map) { - _$jscoverage_done("lib/options/custom.js", 193); - this._complexFilters.clear(); - _$jscoverage_done("lib/options/custom.js", 195); - if (_$jscoverage_done("lib/options/custom.js", 195, !Array.isArray(spec))) { - _$jscoverage_done("lib/options/custom.js", 196); - spec = [ spec ]; - } - _$jscoverage_done("lib/options/custom.js", 199); - this._complexFilters("-filter_complex", utils.makeFilterStrings(spec).join(";")); - _$jscoverage_done("lib/options/custom.js", 201); - if (_$jscoverage_done("lib/options/custom.js", 201, Array.isArray(map))) { - _$jscoverage_done("lib/options/custom.js", 202); - var self = this; - _$jscoverage_done("lib/options/custom.js", 203); - map.forEach(function(streamSpec) { - _$jscoverage_done("lib/options/custom.js", 204); - self._complexFilters("-map", streamSpec.replace(utils.streamRegexp, "[$1]")); - }); - } else { - _$jscoverage_done("lib/options/custom.js", 206); - if (_$jscoverage_done("lib/options/custom.js", 206, typeof map === "string")) { - _$jscoverage_done("lib/options/custom.js", 207); - this._complexFilters("-map", map.replace(utils.streamRegexp, "[$1]")); - } - } - _$jscoverage_done("lib/options/custom.js", 210); - return this; - }; -}; \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/lib-cov/options/inputs.js b/node_modules/fluent-ffmpeg/lib-cov/options/inputs.js deleted file mode 100644 index 8eb7fe1..0000000 --- a/node_modules/fluent-ffmpeg/lib-cov/options/inputs.js +++ /dev/null @@ -1,132 +0,0 @@ -// instrument by jscoverage, do not modifly this file -(function () { - var BASE; - if (typeof global === 'object') { - BASE = global; - } else if (typeof window === 'object') { - BASE = window; - } else { - throw new Error('[jscoverage] unknow ENV!'); - } - if (!BASE._$jscoverage) { - BASE._$jscoverage = {}; - BASE._$jscoverage_cond = {}; - BASE._$jscoverage_done = function (file, line, express) { - if (arguments.length === 2) { - BASE._$jscoverage[file][line] ++; - } else { - BASE._$jscoverage_cond[file][line] ++; - return express; - } - }; - BASE._$jscoverage_init = function (base, file, lines) { - var tmp = []; - for (var i = 0; i < lines.length; i ++) { - tmp[lines[i]] = 0; - } - base[file] = tmp; - }; - } -})(); -_$jscoverage_init(_$jscoverage, "lib/options/inputs.js",[4,10,26,29,31,32,33,36,37,40,41,44,46,47,50,56,70,73,74,77,78,93,101,102,105,106,120,122,123,126,128,141,142,143,146,148,149,152]); -_$jscoverage_init(_$jscoverage_cond, "lib/options/inputs.js",[31,32,32,40,73,101,122,142,148]); -_$jscoverage["lib/options/inputs.js"].source = ["/*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;"," };","",""," /**"," * 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;"," };","};",""]; -"use strict"; - -_$jscoverage_done("lib/options/inputs.js", 4); -var utils = require("../utils"); - -_$jscoverage_done("lib/options/inputs.js", 10); -module.exports = function(proto) { - _$jscoverage_done("lib/options/inputs.js", 26); - proto.mergeAdd = proto.addInput = proto.input = function(source) { - _$jscoverage_done("lib/options/inputs.js", 29); - var isFile = false; - _$jscoverage_done("lib/options/inputs.js", 31); - if (_$jscoverage_done("lib/options/inputs.js", 31, typeof source !== "string")) { - _$jscoverage_done("lib/options/inputs.js", 32); - if (_$jscoverage_done("lib/options/inputs.js", 32, !("readable" in source)) || _$jscoverage_done("lib/options/inputs.js", 32, !source.readable)) { - _$jscoverage_done("lib/options/inputs.js", 33); - throw new Error("Invalid input"); - } - _$jscoverage_done("lib/options/inputs.js", 36); - var hasInputStream = this._inputs.some(function(input) { - _$jscoverage_done("lib/options/inputs.js", 37); - return typeof input.source !== "string"; - }); - _$jscoverage_done("lib/options/inputs.js", 40); - if (_$jscoverage_done("lib/options/inputs.js", 40, hasInputStream)) { - _$jscoverage_done("lib/options/inputs.js", 41); - throw new Error("Only one input stream is supported"); - } - _$jscoverage_done("lib/options/inputs.js", 44); - source.pause(); - } else { - _$jscoverage_done("lib/options/inputs.js", 46); - var protocol = source.match(/^([a-z]{2,}):/i); - _$jscoverage_done("lib/options/inputs.js", 47); - isFile = !protocol || protocol[0] === "file"; - } - _$jscoverage_done("lib/options/inputs.js", 50); - this._inputs.push(this._currentInput = { - source: source, - isFile: isFile, - options: utils.args() - }); - _$jscoverage_done("lib/options/inputs.js", 56); - return this; - }; - _$jscoverage_done("lib/options/inputs.js", 70); - proto.withInputFormat = proto.inputFormat = proto.fromFormat = function(format) { - _$jscoverage_done("lib/options/inputs.js", 73); - if (_$jscoverage_done("lib/options/inputs.js", 73, !this._currentInput)) { - _$jscoverage_done("lib/options/inputs.js", 74); - throw new Error("No input specified"); - } - _$jscoverage_done("lib/options/inputs.js", 77); - this._currentInput.options("-f", format); - _$jscoverage_done("lib/options/inputs.js", 78); - return this; - }; - _$jscoverage_done("lib/options/inputs.js", 93); - proto.withInputFps = proto.withInputFPS = proto.withFpsInput = proto.withFPSInput = proto.inputFPS = proto.inputFps = proto.fpsInput = proto.FPSInput = function(fps) { - _$jscoverage_done("lib/options/inputs.js", 101); - if (_$jscoverage_done("lib/options/inputs.js", 101, !this._currentInput)) { - _$jscoverage_done("lib/options/inputs.js", 102); - throw new Error("No input specified"); - } - _$jscoverage_done("lib/options/inputs.js", 105); - this._currentInput.options("-r", fps); - _$jscoverage_done("lib/options/inputs.js", 106); - return this; - }; - _$jscoverage_done("lib/options/inputs.js", 120); - proto.setStartTime = proto.seekInput = function(seek) { - _$jscoverage_done("lib/options/inputs.js", 122); - if (_$jscoverage_done("lib/options/inputs.js", 122, !this._currentInput)) { - _$jscoverage_done("lib/options/inputs.js", 123); - throw new Error("No input specified"); - } - _$jscoverage_done("lib/options/inputs.js", 126); - this._currentInput.options("-ss", seek); - _$jscoverage_done("lib/options/inputs.js", 128); - return this; - }; - _$jscoverage_done("lib/options/inputs.js", 141); - proto.loop = function(duration) { - _$jscoverage_done("lib/options/inputs.js", 142); - if (_$jscoverage_done("lib/options/inputs.js", 142, !this._currentInput)) { - _$jscoverage_done("lib/options/inputs.js", 143); - throw new Error("No input specified"); - } - _$jscoverage_done("lib/options/inputs.js", 146); - this._currentInput.options("-loop", "1"); - _$jscoverage_done("lib/options/inputs.js", 148); - if (_$jscoverage_done("lib/options/inputs.js", 148, typeof duration !== "undefined")) { - _$jscoverage_done("lib/options/inputs.js", 149); - this.duration(duration); - } - _$jscoverage_done("lib/options/inputs.js", 152); - return this; - }; -}; \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/lib-cov/options/misc.js b/node_modules/fluent-ffmpeg/lib-cov/options/misc.js deleted file mode 100644 index 18657ea..0000000 --- a/node_modules/fluent-ffmpeg/lib-cov/options/misc.js +++ /dev/null @@ -1,77 +0,0 @@ -// instrument by jscoverage, do not modifly this file -(function () { - var BASE; - if (typeof global === 'object') { - BASE = global; - } else if (typeof window === 'object') { - BASE = window; - } else { - throw new Error('[jscoverage] unknow ENV!'); - } - if (!BASE._$jscoverage) { - BASE._$jscoverage = {}; - BASE._$jscoverage_cond = {}; - BASE._$jscoverage_done = function (file, line, express) { - if (arguments.length === 2) { - BASE._$jscoverage[file][line] ++; - } else { - BASE._$jscoverage_cond[file][line] ++; - return express; - } - }; - BASE._$jscoverage_init = function (base, file, lines) { - var tmp = []; - for (var i = 0; i < lines.length; i ++) { - tmp[lines[i]] = 0; - } - base[file] = tmp; - }; - } -})(); -_$jscoverage_init(_$jscoverage, "lib/options/misc.js",[4,10,20,22,23,25,26,27,29,30,32,35,39,52,54,55]); -_$jscoverage_init(_$jscoverage_cond, "lib/options/misc.js",[22,29]); -_$jscoverage["lib/options/misc.js"].source = ["/*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;"," };","",""," /**"," * Enable experimental codecs"," *"," * @method FfmpegCommand#strict"," * @category Miscellaneous"," * @aliases withStrictExperimental"," *"," * @return FfmpegCommand"," */"," proto.withStrictExperimental ="," proto.strict = function() {"," this._global('-strict', 'experimental');"," return this;"," };","};",""]; -"use strict"; - -_$jscoverage_done("lib/options/misc.js", 4); -var path = require("path"); - -_$jscoverage_done("lib/options/misc.js", 10); -module.exports = function(proto) { - _$jscoverage_done("lib/options/misc.js", 20); - proto.usingPreset = proto.preset = function(preset) { - _$jscoverage_done("lib/options/misc.js", 22); - if (_$jscoverage_done("lib/options/misc.js", 22, typeof preset === "function")) { - _$jscoverage_done("lib/options/misc.js", 23); - preset(this); - } else { - _$jscoverage_done("lib/options/misc.js", 25); - try { - _$jscoverage_done("lib/options/misc.js", 26); - var modulePath = path.join(this.options.presets, preset); - _$jscoverage_done("lib/options/misc.js", 27); - var module = require(modulePath); - _$jscoverage_done("lib/options/misc.js", 29); - if (_$jscoverage_done("lib/options/misc.js", 29, typeof module.load === "function")) { - _$jscoverage_done("lib/options/misc.js", 30); - module.load(this); - } else { - _$jscoverage_done("lib/options/misc.js", 32); - throw new Error("preset " + modulePath + " has no load() function"); - } - } catch (err) { - _$jscoverage_done("lib/options/misc.js", 35); - throw new Error("preset " + modulePath + " could not be loaded: " + err.message); - } - } - _$jscoverage_done("lib/options/misc.js", 39); - return this; - }; - _$jscoverage_done("lib/options/misc.js", 52); - proto.withStrictExperimental = proto.strict = function() { - _$jscoverage_done("lib/options/misc.js", 54); - this._global("-strict", "experimental"); - _$jscoverage_done("lib/options/misc.js", 55); - return this; - }; -}; \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/lib-cov/options/output.js b/node_modules/fluent-ffmpeg/lib-cov/options/output.js deleted file mode 100644 index 3eebc33..0000000 --- a/node_modules/fluent-ffmpeg/lib-cov/options/output.js +++ /dev/null @@ -1,146 +0,0 @@ -// instrument by jscoverage, do not modifly this file -(function () { - var BASE; - if (typeof global === 'object') { - BASE = global; - } else if (typeof window === 'object') { - BASE = window; - } else { - throw new Error('[jscoverage] unknow ENV!'); - } - if (!BASE._$jscoverage) { - BASE._$jscoverage = {}; - BASE._$jscoverage_cond = {}; - BASE._$jscoverage_done = function (file, line, express) { - if (arguments.length === 2) { - BASE._$jscoverage[file][line] ++; - } else { - BASE._$jscoverage_cond[file][line] ++; - return express; - } - }; - BASE._$jscoverage_init = function (base, file, lines) { - var tmp = []; - for (var i = 0; i < lines.length; i ++) { - tmp[lines[i]] = 0; - } - base[file] = tmp; - }; - } -})(); -_$jscoverage_init(_$jscoverage, "lib/options/output.js",[4,11,23,25,27,29,32,33,34,36,37,38,41,43,44,45,47,48,49,52,53,57,64,65,66,69,71,75,89,91,92,106,109,110,124,128,129,142,143,144,157,159,160]); -_$jscoverage_init(_$jscoverage_cond, "lib/options/output.js",[27,27,32,32,33,33,36,41,41,47,47,52,69]); -_$jscoverage["lib/options/output.js"].source = ["/*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;"," };","};",""]; -"use strict"; - -_$jscoverage_done("lib/options/output.js", 4); -var utils = require("../utils"); - -_$jscoverage_done("lib/options/output.js", 11); -module.exports = function(proto) { - _$jscoverage_done("lib/options/output.js", 23); - proto.addOutput = proto.output = function(target, pipeopts) { - _$jscoverage_done("lib/options/output.js", 25); - var isFile = false; - _$jscoverage_done("lib/options/output.js", 27); - if (_$jscoverage_done("lib/options/output.js", 27, !target) && _$jscoverage_done("lib/options/output.js", 27, this._currentOutput)) { - _$jscoverage_done("lib/options/output.js", 29); - throw new Error("Invalid output"); - } - _$jscoverage_done("lib/options/output.js", 32); - if (_$jscoverage_done("lib/options/output.js", 32, target) && _$jscoverage_done("lib/options/output.js", 32, typeof target !== "string")) { - _$jscoverage_done("lib/options/output.js", 33); - if (_$jscoverage_done("lib/options/output.js", 33, !("writable" in target)) || _$jscoverage_done("lib/options/output.js", 33, !target.writable)) { - _$jscoverage_done("lib/options/output.js", 34); - throw new Error("Invalid output"); - } - } else { - _$jscoverage_done("lib/options/output.js", 36); - if (_$jscoverage_done("lib/options/output.js", 36, typeof target === "string")) { - _$jscoverage_done("lib/options/output.js", 37); - var protocol = target.match(/^([a-z]{2,}):/i); - _$jscoverage_done("lib/options/output.js", 38); - isFile = !protocol || protocol[0] === "file"; - } - } - _$jscoverage_done("lib/options/output.js", 41); - if (_$jscoverage_done("lib/options/output.js", 41, target) && _$jscoverage_done("lib/options/output.js", 41, !("target" in this._currentOutput))) { - _$jscoverage_done("lib/options/output.js", 43); - this._currentOutput.target = target; - _$jscoverage_done("lib/options/output.js", 44); - this._currentOutput.isFile = isFile; - _$jscoverage_done("lib/options/output.js", 45); - this._currentOutput.pipeopts = pipeopts || {}; - } else { - _$jscoverage_done("lib/options/output.js", 47); - if (_$jscoverage_done("lib/options/output.js", 47, target) && _$jscoverage_done("lib/options/output.js", 47, typeof target !== "string")) { - _$jscoverage_done("lib/options/output.js", 48); - var hasOutputStream = this._outputs.some(function(output) { - _$jscoverage_done("lib/options/output.js", 49); - return typeof output.target !== "string"; - }); - _$jscoverage_done("lib/options/output.js", 52); - if (_$jscoverage_done("lib/options/output.js", 52, hasOutputStream)) { - _$jscoverage_done("lib/options/output.js", 53); - throw new Error("Only one output stream is supported"); - } - } - _$jscoverage_done("lib/options/output.js", 57); - this._outputs.push(this._currentOutput = { - target: target, - isFile: isFile, - flags: {}, - pipeopts: pipeopts || {} - }); - _$jscoverage_done("lib/options/output.js", 64); - var self = this; - _$jscoverage_done("lib/options/output.js", 65); - [ "audio", "audioFilters", "video", "videoFilters", "sizeFilters", "options" ].forEach(function(key) { - _$jscoverage_done("lib/options/output.js", 66); - self._currentOutput[key] = utils.args(); - }); - _$jscoverage_done("lib/options/output.js", 69); - if (_$jscoverage_done("lib/options/output.js", 69, !target)) { - _$jscoverage_done("lib/options/output.js", 71); - delete this._currentOutput.target; - } - } - _$jscoverage_done("lib/options/output.js", 75); - return this; - }; - _$jscoverage_done("lib/options/output.js", 89); - proto.seekOutput = proto.seek = function(seek) { - _$jscoverage_done("lib/options/output.js", 91); - this._currentOutput.options("-ss", seek); - _$jscoverage_done("lib/options/output.js", 92); - return this; - }; - _$jscoverage_done("lib/options/output.js", 106); - proto.withDuration = proto.setDuration = proto.duration = function(duration) { - _$jscoverage_done("lib/options/output.js", 109); - this._currentOutput.options("-t", duration); - _$jscoverage_done("lib/options/output.js", 110); - return this; - }; - _$jscoverage_done("lib/options/output.js", 124); - proto.toFormat = proto.withOutputFormat = proto.outputFormat = proto.format = function(format) { - _$jscoverage_done("lib/options/output.js", 128); - this._currentOutput.options("-f", format); - _$jscoverage_done("lib/options/output.js", 129); - return this; - }; - _$jscoverage_done("lib/options/output.js", 142); - proto.map = function(spec) { - _$jscoverage_done("lib/options/output.js", 143); - this._currentOutput.options("-map", spec.replace(utils.streamRegexp, "[$1]")); - _$jscoverage_done("lib/options/output.js", 144); - return this; - }; - _$jscoverage_done("lib/options/output.js", 157); - proto.updateFlvMetadata = proto.flvmeta = function() { - _$jscoverage_done("lib/options/output.js", 159); - this._currentOutput.flags.flvmeta = true; - _$jscoverage_done("lib/options/output.js", 160); - return this; - }; -}; \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/lib-cov/options/video.js b/node_modules/fluent-ffmpeg/lib-cov/options/video.js deleted file mode 100644 index d726bb3..0000000 --- a/node_modules/fluent-ffmpeg/lib-cov/options/video.js +++ /dev/null @@ -1,104 +0,0 @@ -// instrument by jscoverage, do not modifly this file -(function () { - var BASE; - if (typeof global === 'object') { - BASE = global; - } else if (typeof window === 'object') { - BASE = window; - } else { - throw new Error('[jscoverage] unknow ENV!'); - } - if (!BASE._$jscoverage) { - BASE._$jscoverage = {}; - BASE._$jscoverage_cond = {}; - BASE._$jscoverage_done = function (file, line, express) { - if (arguments.length === 2) { - BASE._$jscoverage[file][line] ++; - } else { - BASE._$jscoverage_cond[file][line] ++; - return express; - } - }; - BASE._$jscoverage_init = function (base, file, lines) { - var tmp = []; - for (var i = 0; i < lines.length; i ++) { - tmp[lines[i]] = 0; - } - base[file] = tmp; - }; - } -})(); -_$jscoverage_init(_$jscoverage, "lib/options/video.js",[4,11,21,23,24,25,27,41,43,44,59,61,63,64,65,72,123,127,128,131,132,135,137,151,163,164,178,181,182]); -_$jscoverage_init(_$jscoverage_cond, "lib/options/video.js",[64,127,131]); -_$jscoverage["lib/options/video.js"].source = ["/*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;"," };","};",""]; -"use strict"; - -_$jscoverage_done("lib/options/video.js", 4); -var utils = require("../utils"); - -_$jscoverage_done("lib/options/video.js", 11); -module.exports = function(proto) { - _$jscoverage_done("lib/options/video.js", 21); - proto.withNoVideo = proto.noVideo = function() { - _$jscoverage_done("lib/options/video.js", 23); - this._currentOutput.video.clear(); - _$jscoverage_done("lib/options/video.js", 24); - this._currentOutput.videoFilters.clear(); - _$jscoverage_done("lib/options/video.js", 25); - this._currentOutput.video("-vn"); - _$jscoverage_done("lib/options/video.js", 27); - return this; - }; - _$jscoverage_done("lib/options/video.js", 41); - proto.withVideoCodec = proto.videoCodec = function(codec) { - _$jscoverage_done("lib/options/video.js", 43); - this._currentOutput.video("-vcodec", codec); - _$jscoverage_done("lib/options/video.js", 44); - return this; - }; - _$jscoverage_done("lib/options/video.js", 59); - proto.withVideoBitrate = proto.videoBitrate = function(bitrate, constant) { - _$jscoverage_done("lib/options/video.js", 61); - bitrate = ("" + bitrate).replace(/k?$/, "k"); - _$jscoverage_done("lib/options/video.js", 63); - this._currentOutput.video("-b:v", bitrate); - _$jscoverage_done("lib/options/video.js", 64); - if (_$jscoverage_done("lib/options/video.js", 64, constant)) { - _$jscoverage_done("lib/options/video.js", 65); - this._currentOutput.video("-maxrate", bitrate, "-minrate", bitrate, "-bufsize", "3M"); - } - _$jscoverage_done("lib/options/video.js", 72); - return this; - }; - _$jscoverage_done("lib/options/video.js", 123); - proto.withVideoFilter = proto.withVideoFilters = proto.videoFilter = proto.videoFilters = function(filters) { - _$jscoverage_done("lib/options/video.js", 127); - if (_$jscoverage_done("lib/options/video.js", 127, arguments.length > 1)) { - _$jscoverage_done("lib/options/video.js", 128); - filters = [].slice.call(arguments); - } - _$jscoverage_done("lib/options/video.js", 131); - if (_$jscoverage_done("lib/options/video.js", 131, !Array.isArray(filters))) { - _$jscoverage_done("lib/options/video.js", 132); - filters = [ filters ]; - } - _$jscoverage_done("lib/options/video.js", 135); - this._currentOutput.videoFilters(utils.makeFilterStrings(filters)); - _$jscoverage_done("lib/options/video.js", 137); - return this; - }; - _$jscoverage_done("lib/options/video.js", 151); - 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) { - _$jscoverage_done("lib/options/video.js", 163); - this._currentOutput.video("-r", fps); - _$jscoverage_done("lib/options/video.js", 164); - return this; - }; - _$jscoverage_done("lib/options/video.js", 178); - proto.takeFrames = proto.withFrames = proto.frames = function(frames) { - _$jscoverage_done("lib/options/video.js", 181); - this._currentOutput.video("-vframes", frames); - _$jscoverage_done("lib/options/video.js", 182); - return this; - }; -}; \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/lib-cov/options/videosize.js b/node_modules/fluent-ffmpeg/lib-cov/options/videosize.js deleted file mode 100644 index 2b17e24..0000000 --- a/node_modules/fluent-ffmpeg/lib-cov/options/videosize.js +++ /dev/null @@ -1,190 +0,0 @@ -// instrument by jscoverage, do not modifly this file -(function () { - var BASE; - if (typeof global === 'object') { - BASE = global; - } else if (typeof window === 'object') { - BASE = window; - } else { - throw new Error('[jscoverage] unknow ENV!'); - } - if (!BASE._$jscoverage) { - BASE._$jscoverage = {}; - BASE._$jscoverage_cond = {}; - BASE._$jscoverage_done = function (file, line, express) { - if (arguments.length === 2) { - BASE._$jscoverage[file][line] ++; - } else { - BASE._$jscoverage_cond[file][line] ++; - return express; - } - }; - BASE._$jscoverage_init = function (base, file, lines) { - var tmp = []; - for (var i = 0; i < lines.length; i ++) { - tmp[lines[i]] = 0; - } - base[file] = tmp; - }; - } -})(); -_$jscoverage_init(_$jscoverage, "lib/options/videosize.js",[27,74,75,77,79,83,84,85,86,87,89,90,91,92,94,95,97,99,100,103,105,106,108,109,112,113,115,116,119,124,125,127,131,140,154,158,183,186,188,189,191,205,211,212,213,214,215,217,221,223,224,226,240,251,252,253,257,258,261,263,264,266]); -_$jscoverage_init(_$jscoverage_cond, "lib/options/videosize.js",[77,89,92,99,105,105,106,115,124,212,214,251,257]); -_$jscoverage["lib/options/videosize.js"].source = ["/*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",""," scale="," w=if(gt(a, A), width, trunc(height*a/2)*2):"," h=if(lt(a, A), height, trunc(width/a/2)*2)"," */",""," 'scale=\\'' +"," '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",""," pad="," w=width:"," h=height:"," x=if(gt(a, A), 0, (width - iw)/2):"," y=if(lt(a, A), 0, (height - ih)/2)",""," (here iw and ih refer to the padding input, i.e the scaled output)"," */",""," 'pad=\\'' +"," '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 ['scale=trunc(iw*' + ratio + '/2)*2: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 ['scale=' + width + ':' + 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 ['scale=' + width + ':' + height];"," }"," } else {"," // Keep input aspect ratio",""," if (fixedWidth) {"," return ['scale=' + (Math.round(Number(fixedWidth[1]) / 2) * 2) + ':trunc(ow/a/2)*2'];"," } else {"," return ['scale=trunc(oh*a/2)*2:' + (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("," 'scale=\\'w=if(gt(sar,1),iw*sar,iw):h=if(lt(sar,1),ih/sar,ih)\\'',"," 'setsar=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;"," };","};",""]; -"use strict"; - -function getScalePadFilters(width, height, aspect, color) { - _$jscoverage_done("lib/options/videosize.js", 27); - return [ "scale='" + "w=if(gt(a," + aspect + ")," + width + ",trunc(" + height + "*a/2)*2):" + "h=if(lt(a," + aspect + ")," + height + ",trunc(" + width + "/a/2)*2)'", "pad='" + "w=" + width + ":" + "h=" + height + ":" + "x=if(gt(a," + aspect + "),0,(" + width + "-iw)/2):" + "y=if(lt(a," + aspect + "),0,(" + height + "-ih)/2):" + "color=" + color + "'" ]; -} - -function createSizeFilters(output, key, value) { - _$jscoverage_done("lib/options/videosize.js", 74); - var data = output.sizeData = output.sizeData || {}; - _$jscoverage_done("lib/options/videosize.js", 75); - data[key] = value; - _$jscoverage_done("lib/options/videosize.js", 77); - if (_$jscoverage_done("lib/options/videosize.js", 77, !("size" in data))) { - _$jscoverage_done("lib/options/videosize.js", 79); - return []; - } - _$jscoverage_done("lib/options/videosize.js", 83); - var fixedSize = data.size.match(/([0-9]+)x([0-9]+)/); - _$jscoverage_done("lib/options/videosize.js", 84); - var fixedWidth = data.size.match(/([0-9]+)x\?/); - _$jscoverage_done("lib/options/videosize.js", 85); - var fixedHeight = data.size.match(/\?x([0-9]+)/); - _$jscoverage_done("lib/options/videosize.js", 86); - var percentRatio = data.size.match(/\b([0-9]{1,3})%/); - _$jscoverage_done("lib/options/videosize.js", 87); - var width, height, aspect; - _$jscoverage_done("lib/options/videosize.js", 89); - if (_$jscoverage_done("lib/options/videosize.js", 89, percentRatio)) { - _$jscoverage_done("lib/options/videosize.js", 90); - var ratio = Number(percentRatio[1]) / 100; - _$jscoverage_done("lib/options/videosize.js", 91); - return [ "scale=trunc(iw*" + ratio + "/2)*2:trunc(ih*" + ratio + "/2)*2" ]; - } else { - _$jscoverage_done("lib/options/videosize.js", 92); - if (_$jscoverage_done("lib/options/videosize.js", 92, fixedSize)) { - _$jscoverage_done("lib/options/videosize.js", 94); - width = Math.round(Number(fixedSize[1]) / 2) * 2; - _$jscoverage_done("lib/options/videosize.js", 95); - height = Math.round(Number(fixedSize[2]) / 2) * 2; - _$jscoverage_done("lib/options/videosize.js", 97); - aspect = width / height; - _$jscoverage_done("lib/options/videosize.js", 99); - if (_$jscoverage_done("lib/options/videosize.js", 99, data.pad)) { - _$jscoverage_done("lib/options/videosize.js", 100); - return getScalePadFilters(width, height, aspect, data.pad); - } else { - _$jscoverage_done("lib/options/videosize.js", 103); - return [ "scale=" + width + ":" + height ]; - } - } else { - _$jscoverage_done("lib/options/videosize.js", 105); - if (_$jscoverage_done("lib/options/videosize.js", 105, fixedWidth) || _$jscoverage_done("lib/options/videosize.js", 105, fixedHeight)) { - _$jscoverage_done("lib/options/videosize.js", 106); - if (_$jscoverage_done("lib/options/videosize.js", 106, "aspect" in data)) { - _$jscoverage_done("lib/options/videosize.js", 108); - width = fixedWidth ? fixedWidth[1] : Math.round(Number(fixedHeight[1]) * data.aspect); - _$jscoverage_done("lib/options/videosize.js", 109); - height = fixedHeight ? fixedHeight[1] : Math.round(Number(fixedWidth[1]) / data.aspect); - _$jscoverage_done("lib/options/videosize.js", 112); - width = Math.round(width / 2) * 2; - _$jscoverage_done("lib/options/videosize.js", 113); - height = Math.round(height / 2) * 2; - _$jscoverage_done("lib/options/videosize.js", 115); - if (_$jscoverage_done("lib/options/videosize.js", 115, data.pad)) { - _$jscoverage_done("lib/options/videosize.js", 116); - return getScalePadFilters(width, height, data.aspect, data.pad); - } else { - _$jscoverage_done("lib/options/videosize.js", 119); - return [ "scale=" + width + ":" + height ]; - } - } else { - _$jscoverage_done("lib/options/videosize.js", 124); - if (_$jscoverage_done("lib/options/videosize.js", 124, fixedWidth)) { - _$jscoverage_done("lib/options/videosize.js", 125); - return [ "scale=" + Math.round(Number(fixedWidth[1]) / 2) * 2 + ":trunc(ow/a/2)*2" ]; - } else { - _$jscoverage_done("lib/options/videosize.js", 127); - return [ "scale=trunc(oh*a/2)*2:" + Math.round(Number(fixedHeight[1]) / 2) * 2 ]; - } - } - } else { - _$jscoverage_done("lib/options/videosize.js", 131); - throw new Error("Invalid size specified: " + data.size); - } - } - } -} - -_$jscoverage_done("lib/options/videosize.js", 140); -module.exports = function(proto) { - _$jscoverage_done("lib/options/videosize.js", 154); - proto.keepPixelAspect = proto.keepDisplayAspect = proto.keepDisplayAspectRatio = proto.keepDAR = function() { - _$jscoverage_done("lib/options/videosize.js", 158); - return this.videoFilters("scale='w=if(gt(sar,1),iw*sar,iw):h=if(lt(sar,1),ih/sar,ih)'", "setsar=1"); - }; - _$jscoverage_done("lib/options/videosize.js", 183); - proto.withSize = proto.setSize = proto.size = function(size) { - _$jscoverage_done("lib/options/videosize.js", 186); - var filters = createSizeFilters(this._currentOutput, "size", size); - _$jscoverage_done("lib/options/videosize.js", 188); - this._currentOutput.sizeFilters.clear(); - _$jscoverage_done("lib/options/videosize.js", 189); - this._currentOutput.sizeFilters(filters); - _$jscoverage_done("lib/options/videosize.js", 191); - return this; - }; - _$jscoverage_done("lib/options/videosize.js", 205); - proto.withAspect = proto.withAspectRatio = proto.setAspect = proto.setAspectRatio = proto.aspect = proto.aspectRatio = function(aspect) { - _$jscoverage_done("lib/options/videosize.js", 211); - var a = Number(aspect); - _$jscoverage_done("lib/options/videosize.js", 212); - if (_$jscoverage_done("lib/options/videosize.js", 212, isNaN(a))) { - _$jscoverage_done("lib/options/videosize.js", 213); - var match = aspect.match(/^(\d+):(\d+)$/); - _$jscoverage_done("lib/options/videosize.js", 214); - if (_$jscoverage_done("lib/options/videosize.js", 214, match)) { - _$jscoverage_done("lib/options/videosize.js", 215); - a = Number(match[1]) / Number(match[2]); - } else { - _$jscoverage_done("lib/options/videosize.js", 217); - throw new Error("Invalid aspect ratio: " + aspect); - } - } - _$jscoverage_done("lib/options/videosize.js", 221); - var filters = createSizeFilters(this._currentOutput, "aspect", a); - _$jscoverage_done("lib/options/videosize.js", 223); - this._currentOutput.sizeFilters.clear(); - _$jscoverage_done("lib/options/videosize.js", 224); - this._currentOutput.sizeFilters(filters); - _$jscoverage_done("lib/options/videosize.js", 226); - return this; - }; - _$jscoverage_done("lib/options/videosize.js", 240); - proto.applyAutopadding = proto.applyAutoPadding = proto.applyAutopad = proto.applyAutoPad = proto.withAutopadding = proto.withAutoPadding = proto.withAutopad = proto.withAutoPad = proto.autoPad = proto.autopad = function(pad, color) { - _$jscoverage_done("lib/options/videosize.js", 251); - if (_$jscoverage_done("lib/options/videosize.js", 251, typeof pad === "string")) { - _$jscoverage_done("lib/options/videosize.js", 252); - color = pad; - _$jscoverage_done("lib/options/videosize.js", 253); - pad = true; - } - _$jscoverage_done("lib/options/videosize.js", 257); - if (_$jscoverage_done("lib/options/videosize.js", 257, typeof pad === "undefined")) { - _$jscoverage_done("lib/options/videosize.js", 258); - pad = true; - } - _$jscoverage_done("lib/options/videosize.js", 261); - var filters = createSizeFilters(this._currentOutput, "pad", pad ? color || "black" : false); - _$jscoverage_done("lib/options/videosize.js", 263); - this._currentOutput.sizeFilters.clear(); - _$jscoverage_done("lib/options/videosize.js", 264); - this._currentOutput.sizeFilters(filters); - _$jscoverage_done("lib/options/videosize.js", 266); - return this; - }; -}; \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/lib-cov/presets/divx.js b/node_modules/fluent-ffmpeg/lib-cov/presets/divx.js deleted file mode 100644 index 8974bb6..0000000 --- a/node_modules/fluent-ffmpeg/lib-cov/presets/divx.js +++ /dev/null @@ -1,40 +0,0 @@ -// instrument by jscoverage, do not modifly this file -(function () { - var BASE; - if (typeof global === 'object') { - BASE = global; - } else if (typeof window === 'object') { - BASE = window; - } else { - throw new Error('[jscoverage] unknow ENV!'); - } - if (!BASE._$jscoverage) { - BASE._$jscoverage = {}; - BASE._$jscoverage_cond = {}; - BASE._$jscoverage_done = function (file, line, express) { - if (arguments.length === 2) { - BASE._$jscoverage[file][line] ++; - } else { - BASE._$jscoverage_cond[file][line] ++; - return express; - } - }; - BASE._$jscoverage_init = function (base, file, lines) { - var tmp = []; - for (var i = 0; i < lines.length; i ++) { - tmp[lines[i]] = 0; - } - base[file] = tmp; - }; - } -})(); -_$jscoverage_init(_$jscoverage, "lib/presets/divx.js",[4,5]); -_$jscoverage_init(_$jscoverage_cond, "lib/presets/divx.js",[]); -_$jscoverage["lib/presets/divx.js"].source = ["/*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']);","};"]; -"use strict"; - -_$jscoverage_done("lib/presets/divx.js", 4); -exports.load = function(ffmpeg) { - _$jscoverage_done("lib/presets/divx.js", 5); - 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/node_modules/fluent-ffmpeg/lib-cov/presets/flashvideo.js b/node_modules/fluent-ffmpeg/lib-cov/presets/flashvideo.js deleted file mode 100644 index 879702f..0000000 --- a/node_modules/fluent-ffmpeg/lib-cov/presets/flashvideo.js +++ /dev/null @@ -1,40 +0,0 @@ -// instrument by jscoverage, do not modifly this file -(function () { - var BASE; - if (typeof global === 'object') { - BASE = global; - } else if (typeof window === 'object') { - BASE = window; - } else { - throw new Error('[jscoverage] unknow ENV!'); - } - if (!BASE._$jscoverage) { - BASE._$jscoverage = {}; - BASE._$jscoverage_cond = {}; - BASE._$jscoverage_done = function (file, line, express) { - if (arguments.length === 2) { - BASE._$jscoverage[file][line] ++; - } else { - BASE._$jscoverage_cond[file][line] ++; - return express; - } - }; - BASE._$jscoverage_init = function (base, file, lines) { - var tmp = []; - for (var i = 0; i < lines.length; i ++) { - tmp[lines[i]] = 0; - } - base[file] = tmp; - }; - } -})(); -_$jscoverage_init(_$jscoverage, "lib/presets/flashvideo.js",[4,5]); -_$jscoverage_init(_$jscoverage_cond, "lib/presets/flashvideo.js",[]); -_$jscoverage["lib/presets/flashvideo.js"].source = ["/*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')"," .strict()"," .audioFrequency(22050)"," .audioChannels(2);","};",""]; -"use strict"; - -_$jscoverage_done("lib/presets/flashvideo.js", 4); -exports.load = function(ffmpeg) { - _$jscoverage_done("lib/presets/flashvideo.js", 5); - ffmpeg.format("flv").flvmeta().size("320x?").videoBitrate("512k").videoCodec("libx264").fps(24).audioBitrate("96k").audioCodec("aac").strict().audioFrequency(22050).audioChannels(2); -}; \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/lib-cov/presets/podcast.js b/node_modules/fluent-ffmpeg/lib-cov/presets/podcast.js deleted file mode 100644 index 4999100..0000000 --- a/node_modules/fluent-ffmpeg/lib-cov/presets/podcast.js +++ /dev/null @@ -1,40 +0,0 @@ -// instrument by jscoverage, do not modifly this file -(function () { - var BASE; - if (typeof global === 'object') { - BASE = global; - } else if (typeof window === 'object') { - BASE = window; - } else { - throw new Error('[jscoverage] unknow ENV!'); - } - if (!BASE._$jscoverage) { - BASE._$jscoverage = {}; - BASE._$jscoverage_cond = {}; - BASE._$jscoverage_done = function (file, line, express) { - if (arguments.length === 2) { - BASE._$jscoverage[file][line] ++; - } else { - BASE._$jscoverage_cond[file][line] ++; - return express; - } - }; - BASE._$jscoverage_init = function (base, file, lines) { - var tmp = []; - for (var i = 0; i < lines.length; i ++) { - tmp[lines[i]] = 0; - } - base[file] = tmp; - }; - } -})(); -_$jscoverage_init(_$jscoverage, "lib/presets/podcast.js",[4,5]); -_$jscoverage_init(_$jscoverage_cond, "lib/presets/podcast.js",[]); -_$jscoverage["lib/presets/podcast.js"].source = ["/*jshint node:true */","'use strict';","","exports.load = function(ffmpeg) {"," ffmpeg"," .format('m4v')"," .videoBitrate('512k')"," .videoCodec('libx264')"," .size('320x176')"," .audioBitrate('128k')"," .audioCodec('aac')"," .strict()"," .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' ]);","};",""]; -"use strict"; - -_$jscoverage_done("lib/presets/podcast.js", 4); -exports.load = function(ffmpeg) { - _$jscoverage_done("lib/presets/podcast.js", 5); - ffmpeg.format("m4v").videoBitrate("512k").videoCodec("libx264").size("320x176").audioBitrate("128k").audioCodec("aac").strict().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" ]); -}; \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/lib-cov/processor.js b/node_modules/fluent-ffmpeg/lib-cov/processor.js deleted file mode 100644 index c7648bf..0000000 --- a/node_modules/fluent-ffmpeg/lib-cov/processor.js +++ /dev/null @@ -1,578 +0,0 @@ -// instrument by jscoverage, do not modifly this file -(function () { - var BASE; - if (typeof global === 'object') { - BASE = global; - } else if (typeof window === 'object') { - BASE = window; - } else { - throw new Error('[jscoverage] unknow ENV!'); - } - if (!BASE._$jscoverage) { - BASE._$jscoverage = {}; - BASE._$jscoverage_cond = {}; - BASE._$jscoverage_done = function (file, line, express) { - if (arguments.length === 2) { - BASE._$jscoverage[file][line] ++; - } else { - BASE._$jscoverage_cond[file][line] ++; - return express; - } - }; - BASE._$jscoverage_init = function (base, file, lines) { - var tmp = []; - for (var i = 0; i < lines.length; i ++) { - tmp[lines[i]] = 0; - } - base[file] = tmp; - }; - } -})(); -_$jscoverage_init(_$jscoverage, "lib/processor.js",[4,5,6,7,8,23,24,29,100,102,103,104,105,109,110,111,115,116,117,118,119,123,124,125,128,129,131,132,135,137,138,141,142,146,148,149,152,155,160,161,162,164,165,166,167,169,174,175,177,178,181,182,183,188,189,191,192,195,196,197,202,214,215,217,218,221,224,227,244,245,246,248,249,250,251,253,256,280,281,283,286,291,292,295,296,297,300,306,308,309,310,313,316,317,318,321,327,328,329,331,334,338,341,343,346,347,348,363,366,369,370,373,374,378,379,383,384,388,390,391,393,394,396,401,402,403,407,408,409,415,416,419,420,421,422,425,426,430,431,432,433,435,436,440,442,445,446,452,453,454,458,459,460,461,465,466,467,472,473,474,476,477,480,481,483,484,487,493,495,496,498,501,504,505,508,509,511,514,516,519,520,527,532,533,535,541,561,562,563,565,566,569,570,572,573,574,575,577,578,581,582,583,584,585,587,593,606,607,608,610,613]); -_$jscoverage_init(_$jscoverage_cond, "lib/processor.js",[102,109,116,118,118,123,123,123,137,137,148,152,152,152,152,152,164,166,174,188,248,250,291,296,308,308,316,338,341,347,373,390,393,402,419,431,440,476,476,480,483,483,483,495,496,508,519,519,532,562,565,565,572,582,584,607]); -_$jscoverage["lib/processor.js"].source = ["/*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) {"," command.ffprobe(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 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|null} [filenames] generated filenames when taking screenshots, null otherwise"," */","",""," /**"," * Spawn an ffmpeg process"," *"," * The 'options' argument may contain the following keys:"," * - 'niceness': specify process niceness, ignored on Windows (default: 0)"," * - 'captureStdout': capture stdout and pass it to 'endCB' as its 2nd argument (default: false)"," * - 'captureStderr': capture stderr and pass it to 'endCB' as its 3rd argument (default: false)"," *"," * 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 when it has been created"," * @param {Function} endCB callback with signature (err, stdout, stderr)"," * @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() {};"," }",""," // 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 stdout = null;"," var stdoutClosed = false;",""," var stderr = null;"," var stderrClosed = false;",""," // Spawn process"," var ffmpegProc = spawn(command, args, options);",""," if (ffmpegProc.stderr && options.captureStderr) {"," 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 || !options.captureStderr)) {"," endCB(exitError, stdout, stderr);"," }"," }",""," // 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) {"," stdout = '';",""," ffmpegProc.stdout.on('data', function(data) {"," stdout += data;"," });",""," ffmpegProc.stdout.on('close', function() {"," stdoutClosed = true;"," handleExit();"," });"," }",""," // Capture stderr if specified"," if (options.captureStderr) {"," stderr = '';",""," ffmpegProc.stderr.on('data', function(data) {"," stderr += data;"," });",""," ffmpegProc.stderr.on('close', function() {"," stderrClosed = true;"," handleExit();"," });"," }",""," // Call process callback"," processCB(ffmpegProc);"," });"," };","",""," /**"," * 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 audioFilters = output.audioFilters.get();"," var videoFilters = output.videoFilters.get().concat(output.sizeFilters.get());"," 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(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);"," }"," ], 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"," var stdout = null;"," var stderr = '';"," self._spawnFfmpeg("," args,",""," { niceness: self.options.niceness },",""," function processCB(ffmpegProc) {"," 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);"," }",""," // 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), stdout, stderr);"," 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));"," ffmpegProc.kill();"," });"," } else {"," // Gather ffmpeg stdout"," stdout = '';"," ffmpegProc.stdout.on('data', function (data) {"," stdout += data;"," });"," }",""," // Process ffmpeg stderr data"," self._codecDataSent = false;"," ffmpegProc.stderr.on('data', function (data) {"," stderr += data;",""," if (!self._codecDataSent && self.listeners('codecData').length) {"," utils.extractCodecData(self, stderr);"," }",""," if (self.listeners('progress').length) {"," var duration = 0;",""," if (self._ffprobeData && self._ffprobeData.format && self._ffprobeData.format.duration) {"," duration = Number(self._ffprobeData.format.duration);"," }",""," utils.extractProgress(self, stderr, duration);"," }"," });"," },",""," function endCB(err) {"," delete self.ffmpegProc;",""," if (err) {"," if (err.message.match(/ffmpeg exited with code/)) {"," // Add ffmpeg error message"," err.message += ': ' + utils.extractError(stderr);"," }",""," emitEnd(err, stdout, stderr);"," } 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) {"," // No possible error here, _getFlvtoolPath was already called by _prepare"," 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, stdout, stderr);"," }"," }"," );"," });"," } else {"," emitEnd(null, stdout, stderr);"," }"," }"," }"," );"," });"," };","",""," /**"," * 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.options.logger.warn('No running ffmpeg process, cannot send signal');"," } else {"," this.ffmpegProc.kill(signal || 'SIGKILL');"," }",""," return this;"," };","};",""]; -"use strict"; - -_$jscoverage_done("lib/processor.js", 4); -var spawn = require("child_process").spawn; - -_$jscoverage_done("lib/processor.js", 5); -var path = require("path"); - -_$jscoverage_done("lib/processor.js", 6); -var fs = require("fs"); - -_$jscoverage_done("lib/processor.js", 7); -var async = require("async"); - -_$jscoverage_done("lib/processor.js", 8); -var utils = require("./utils"); - -function runFfprobe(command) { - _$jscoverage_done("lib/processor.js", 23); - command.ffprobe(function(err, data) { - _$jscoverage_done("lib/processor.js", 24); - command._ffprobeData = data; - }); -} - -_$jscoverage_done("lib/processor.js", 29); -module.exports = function(proto) { - _$jscoverage_done("lib/processor.js", 100); - proto._spawnFfmpeg = function(args, options, processCB, endCB) { - _$jscoverage_done("lib/processor.js", 102); - if (_$jscoverage_done("lib/processor.js", 102, typeof options === "function")) { - _$jscoverage_done("lib/processor.js", 103); - endCB = processCB; - _$jscoverage_done("lib/processor.js", 104); - processCB = options; - _$jscoverage_done("lib/processor.js", 105); - options = {}; - } - _$jscoverage_done("lib/processor.js", 109); - if (_$jscoverage_done("lib/processor.js", 109, typeof endCB === "undefined")) { - _$jscoverage_done("lib/processor.js", 110); - endCB = processCB; - _$jscoverage_done("lib/processor.js", 111); - processCB = function() {}; - } - _$jscoverage_done("lib/processor.js", 115); - this._getFfmpegPath(function(err, command) { - _$jscoverage_done("lib/processor.js", 116); - if (_$jscoverage_done("lib/processor.js", 116, err)) { - _$jscoverage_done("lib/processor.js", 117); - return endCB(err); - } else { - _$jscoverage_done("lib/processor.js", 118); - if (_$jscoverage_done("lib/processor.js", 118, !command) || _$jscoverage_done("lib/processor.js", 118, command.length === 0)) { - _$jscoverage_done("lib/processor.js", 119); - return endCB(new Error("Cannot find ffmpeg")); - } - } - _$jscoverage_done("lib/processor.js", 123); - if (_$jscoverage_done("lib/processor.js", 123, options.niceness) && _$jscoverage_done("lib/processor.js", 123, options.niceness !== 0) && _$jscoverage_done("lib/processor.js", 123, !utils.isWindows)) { - _$jscoverage_done("lib/processor.js", 124); - args.unshift("-n", options.niceness, command); - _$jscoverage_done("lib/processor.js", 125); - command = "nice"; - } - _$jscoverage_done("lib/processor.js", 128); - var stdout = null; - _$jscoverage_done("lib/processor.js", 129); - var stdoutClosed = false; - _$jscoverage_done("lib/processor.js", 131); - var stderr = null; - _$jscoverage_done("lib/processor.js", 132); - var stderrClosed = false; - _$jscoverage_done("lib/processor.js", 135); - var ffmpegProc = spawn(command, args, options); - _$jscoverage_done("lib/processor.js", 137); - if (_$jscoverage_done("lib/processor.js", 137, ffmpegProc.stderr) && _$jscoverage_done("lib/processor.js", 137, options.captureStderr)) { - _$jscoverage_done("lib/processor.js", 138); - ffmpegProc.stderr.setEncoding("utf8"); - } - _$jscoverage_done("lib/processor.js", 141); - ffmpegProc.on("error", function(err) { - _$jscoverage_done("lib/processor.js", 142); - endCB(err); - }); - _$jscoverage_done("lib/processor.js", 146); - var exitError = null; - function handleExit(err) { - _$jscoverage_done("lib/processor.js", 148); - if (_$jscoverage_done("lib/processor.js", 148, err)) { - _$jscoverage_done("lib/processor.js", 149); - exitError = err; - } - _$jscoverage_done("lib/processor.js", 152); - if (_$jscoverage_done("lib/processor.js", 152, processExited) && (_$jscoverage_done("lib/processor.js", 152, stdoutClosed) || _$jscoverage_done("lib/processor.js", 152, !options.captureStdout)) && (_$jscoverage_done("lib/processor.js", 152, stderrClosed) || _$jscoverage_done("lib/processor.js", 152, !options.captureStderr))) { - _$jscoverage_done("lib/processor.js", 155); - endCB(exitError, stdout, stderr); - } - } - _$jscoverage_done("lib/processor.js", 160); - var processExited = false; - _$jscoverage_done("lib/processor.js", 161); - ffmpegProc.on("exit", function(code, signal) { - _$jscoverage_done("lib/processor.js", 162); - processExited = true; - _$jscoverage_done("lib/processor.js", 164); - if (_$jscoverage_done("lib/processor.js", 164, signal)) { - _$jscoverage_done("lib/processor.js", 165); - handleExit(new Error("ffmpeg was killed with signal " + signal)); - } else { - _$jscoverage_done("lib/processor.js", 166); - if (_$jscoverage_done("lib/processor.js", 166, code)) { - _$jscoverage_done("lib/processor.js", 167); - handleExit(new Error("ffmpeg exited with code " + code)); - } else { - _$jscoverage_done("lib/processor.js", 169); - handleExit(); - } - } - }); - _$jscoverage_done("lib/processor.js", 174); - if (_$jscoverage_done("lib/processor.js", 174, options.captureStdout)) { - _$jscoverage_done("lib/processor.js", 175); - stdout = ""; - _$jscoverage_done("lib/processor.js", 177); - ffmpegProc.stdout.on("data", function(data) { - _$jscoverage_done("lib/processor.js", 178); - stdout += data; - }); - _$jscoverage_done("lib/processor.js", 181); - ffmpegProc.stdout.on("close", function() { - _$jscoverage_done("lib/processor.js", 182); - stdoutClosed = true; - _$jscoverage_done("lib/processor.js", 183); - handleExit(); - }); - } - _$jscoverage_done("lib/processor.js", 188); - if (_$jscoverage_done("lib/processor.js", 188, options.captureStderr)) { - _$jscoverage_done("lib/processor.js", 189); - stderr = ""; - _$jscoverage_done("lib/processor.js", 191); - ffmpegProc.stderr.on("data", function(data) { - _$jscoverage_done("lib/processor.js", 192); - stderr += data; - }); - _$jscoverage_done("lib/processor.js", 195); - ffmpegProc.stderr.on("close", function() { - _$jscoverage_done("lib/processor.js", 196); - stderrClosed = true; - _$jscoverage_done("lib/processor.js", 197); - handleExit(); - }); - } - _$jscoverage_done("lib/processor.js", 202); - processCB(ffmpegProc); - }); - }; - _$jscoverage_done("lib/processor.js", 214); - proto._getArguments = function() { - _$jscoverage_done("lib/processor.js", 215); - var complexFilters = this._complexFilters.get(); - _$jscoverage_done("lib/processor.js", 217); - var fileOutput = this._outputs.some(function(output) { - _$jscoverage_done("lib/processor.js", 218); - return output.isFile; - }); - _$jscoverage_done("lib/processor.js", 221); - return [].concat(this._inputs.reduce(function(args, input) { - _$jscoverage_done("lib/processor.js", 224); - var source = typeof input.source === "string" ? input.source : "pipe:0"; - _$jscoverage_done("lib/processor.js", 227); - return args.concat(input.options.get(), [ "-i", source ]); - }, []), this._global.get(), fileOutput ? [ "-y" ] : [], complexFilters, this._outputs.reduce(function(args, output) { - _$jscoverage_done("lib/processor.js", 244); - var audioFilters = output.audioFilters.get(); - _$jscoverage_done("lib/processor.js", 245); - var videoFilters = output.videoFilters.get().concat(output.sizeFilters.get()); - _$jscoverage_done("lib/processor.js", 246); - var outputArg; - _$jscoverage_done("lib/processor.js", 248); - if (_$jscoverage_done("lib/processor.js", 248, !output.target)) { - _$jscoverage_done("lib/processor.js", 249); - outputArg = []; - } else { - _$jscoverage_done("lib/processor.js", 250); - if (_$jscoverage_done("lib/processor.js", 250, typeof output.target === "string")) { - _$jscoverage_done("lib/processor.js", 251); - outputArg = [ output.target ]; - } else { - _$jscoverage_done("lib/processor.js", 253); - outputArg = [ "pipe:1" ]; - } - } - _$jscoverage_done("lib/processor.js", 256); - 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); - }, [])); - }; - _$jscoverage_done("lib/processor.js", 280); - proto._prepare = function(callback, readMetadata) { - _$jscoverage_done("lib/processor.js", 281); - var self = this; - _$jscoverage_done("lib/processor.js", 283); - async.waterfall([ function(cb) { - _$jscoverage_done("lib/processor.js", 286); - self._checkCapabilities(cb); - }, function(cb) { - _$jscoverage_done("lib/processor.js", 291); - if (_$jscoverage_done("lib/processor.js", 291, !readMetadata)) { - _$jscoverage_done("lib/processor.js", 292); - return cb(); - } - _$jscoverage_done("lib/processor.js", 295); - self.ffprobe(function(err, data) { - _$jscoverage_done("lib/processor.js", 296); - if (_$jscoverage_done("lib/processor.js", 296, !err)) { - _$jscoverage_done("lib/processor.js", 297); - self._ffprobeData = data; - } - _$jscoverage_done("lib/processor.js", 300); - cb(); - }); - }, function(cb) { - _$jscoverage_done("lib/processor.js", 306); - var flvmeta = self._outputs.some(function(output) { - _$jscoverage_done("lib/processor.js", 308); - if (_$jscoverage_done("lib/processor.js", 308, output.flags.flvmeta) && _$jscoverage_done("lib/processor.js", 308, !output.isFile)) { - _$jscoverage_done("lib/processor.js", 309); - self.logger.warn("Updating flv metadata is only supported for files"); - _$jscoverage_done("lib/processor.js", 310); - output.flags.flvmeta = false; - } - _$jscoverage_done("lib/processor.js", 313); - return output.flags.flvmeta; - }); - _$jscoverage_done("lib/processor.js", 316); - if (_$jscoverage_done("lib/processor.js", 316, flvmeta)) { - _$jscoverage_done("lib/processor.js", 317); - self._getFlvtoolPath(function(err) { - _$jscoverage_done("lib/processor.js", 318); - cb(err); - }); - } else { - _$jscoverage_done("lib/processor.js", 321); - cb(); - } - }, function(cb) { - _$jscoverage_done("lib/processor.js", 327); - var args; - _$jscoverage_done("lib/processor.js", 328); - try { - _$jscoverage_done("lib/processor.js", 329); - args = self._getArguments(); - } catch (e) { - _$jscoverage_done("lib/processor.js", 331); - return cb(e); - } - _$jscoverage_done("lib/processor.js", 334); - cb(null, args); - } ], callback); - _$jscoverage_done("lib/processor.js", 338); - if (_$jscoverage_done("lib/processor.js", 338, !readMetadata)) { - _$jscoverage_done("lib/processor.js", 341); - if (_$jscoverage_done("lib/processor.js", 341, this.listeners("progress").length > 0)) { - _$jscoverage_done("lib/processor.js", 343); - runFfprobe(this); - } else { - _$jscoverage_done("lib/processor.js", 346); - this.once("newListener", function(event) { - _$jscoverage_done("lib/processor.js", 347); - if (_$jscoverage_done("lib/processor.js", 347, event === "progress")) { - _$jscoverage_done("lib/processor.js", 348); - runFfprobe(this); - } - }); - } - } - }; - _$jscoverage_done("lib/processor.js", 363); - proto.exec = proto.execute = proto.run = function() { - _$jscoverage_done("lib/processor.js", 366); - var self = this; - _$jscoverage_done("lib/processor.js", 369); - var outputPresent = this._outputs.some(function(output) { - _$jscoverage_done("lib/processor.js", 370); - return "target" in output; - }); - _$jscoverage_done("lib/processor.js", 373); - if (_$jscoverage_done("lib/processor.js", 373, !outputPresent)) { - _$jscoverage_done("lib/processor.js", 374); - throw new Error("No output specified"); - } - _$jscoverage_done("lib/processor.js", 378); - var outputStream = this._outputs.filter(function(output) { - _$jscoverage_done("lib/processor.js", 379); - return typeof output.target !== "string"; - })[0]; - _$jscoverage_done("lib/processor.js", 383); - var inputStream = this._inputs.filter(function(input) { - _$jscoverage_done("lib/processor.js", 384); - return typeof input.source !== "string"; - })[0]; - _$jscoverage_done("lib/processor.js", 388); - var ended = false; - function emitEnd(err, stdout, stderr) { - _$jscoverage_done("lib/processor.js", 390); - if (_$jscoverage_done("lib/processor.js", 390, !ended)) { - _$jscoverage_done("lib/processor.js", 391); - ended = true; - _$jscoverage_done("lib/processor.js", 393); - if (_$jscoverage_done("lib/processor.js", 393, err)) { - _$jscoverage_done("lib/processor.js", 394); - self.emit("error", err, stdout, stderr); - } else { - _$jscoverage_done("lib/processor.js", 396); - self.emit("end", stdout, stderr); - } - } - } - _$jscoverage_done("lib/processor.js", 401); - self._prepare(function(err, args) { - _$jscoverage_done("lib/processor.js", 402); - if (_$jscoverage_done("lib/processor.js", 402, err)) { - _$jscoverage_done("lib/processor.js", 403); - return emitEnd(err); - } - _$jscoverage_done("lib/processor.js", 407); - var stdout = null; - _$jscoverage_done("lib/processor.js", 408); - var stderr = ""; - _$jscoverage_done("lib/processor.js", 409); - self._spawnFfmpeg(args, { - niceness: self.options.niceness - }, function processCB(ffmpegProc) { - _$jscoverage_done("lib/processor.js", 415); - self.ffmpegProc = ffmpegProc; - _$jscoverage_done("lib/processor.js", 416); - self.emit("start", "ffmpeg " + args.join(" ")); - _$jscoverage_done("lib/processor.js", 419); - if (_$jscoverage_done("lib/processor.js", 419, inputStream)) { - _$jscoverage_done("lib/processor.js", 420); - inputStream.source.on("error", function(err) { - _$jscoverage_done("lib/processor.js", 421); - emitEnd(new Error("Input stream error: " + err.message)); - _$jscoverage_done("lib/processor.js", 422); - ffmpegProc.kill(); - }); - _$jscoverage_done("lib/processor.js", 425); - inputStream.source.resume(); - _$jscoverage_done("lib/processor.js", 426); - inputStream.source.pipe(ffmpegProc.stdin); - } - _$jscoverage_done("lib/processor.js", 430); - var processTimer; - _$jscoverage_done("lib/processor.js", 431); - if (_$jscoverage_done("lib/processor.js", 431, self.options.timeout)) { - _$jscoverage_done("lib/processor.js", 432); - processTimer = setTimeout(function() { - _$jscoverage_done("lib/processor.js", 433); - var msg = "process ran into a timeout (" + self.options.timeout + "s)"; - _$jscoverage_done("lib/processor.js", 435); - emitEnd(new Error(msg), stdout, stderr); - _$jscoverage_done("lib/processor.js", 436); - ffmpegProc.kill(); - }, self.options.timeout * 1e3); - } - _$jscoverage_done("lib/processor.js", 440); - if (_$jscoverage_done("lib/processor.js", 440, outputStream)) { - _$jscoverage_done("lib/processor.js", 442); - ffmpegProc.stdout.pipe(outputStream.target, outputStream.pipeopts); - _$jscoverage_done("lib/processor.js", 445); - outputStream.target.on("close", function() { - _$jscoverage_done("lib/processor.js", 446); - self.logger.debug("Output stream closed, scheduling kill for ffmpgeg process"); - _$jscoverage_done("lib/processor.js", 452); - setTimeout(function() { - _$jscoverage_done("lib/processor.js", 453); - emitEnd(new Error("Output stream closed")); - _$jscoverage_done("lib/processor.js", 454); - ffmpegProc.kill(); - }, 20); - }); - _$jscoverage_done("lib/processor.js", 458); - outputStream.target.on("error", function(err) { - _$jscoverage_done("lib/processor.js", 459); - self.logger.debug("Output stream error, killing ffmpgeg process"); - _$jscoverage_done("lib/processor.js", 460); - emitEnd(new Error("Output stream error: " + err.message)); - _$jscoverage_done("lib/processor.js", 461); - ffmpegProc.kill(); - }); - } else { - _$jscoverage_done("lib/processor.js", 465); - stdout = ""; - _$jscoverage_done("lib/processor.js", 466); - ffmpegProc.stdout.on("data", function(data) { - _$jscoverage_done("lib/processor.js", 467); - stdout += data; - }); - } - _$jscoverage_done("lib/processor.js", 472); - self._codecDataSent = false; - _$jscoverage_done("lib/processor.js", 473); - ffmpegProc.stderr.on("data", function(data) { - _$jscoverage_done("lib/processor.js", 474); - stderr += data; - _$jscoverage_done("lib/processor.js", 476); - if (_$jscoverage_done("lib/processor.js", 476, !self._codecDataSent) && _$jscoverage_done("lib/processor.js", 476, self.listeners("codecData").length)) { - _$jscoverage_done("lib/processor.js", 477); - utils.extractCodecData(self, stderr); - } - _$jscoverage_done("lib/processor.js", 480); - if (_$jscoverage_done("lib/processor.js", 480, self.listeners("progress").length)) { - _$jscoverage_done("lib/processor.js", 481); - var duration = 0; - _$jscoverage_done("lib/processor.js", 483); - if (_$jscoverage_done("lib/processor.js", 483, self._ffprobeData) && _$jscoverage_done("lib/processor.js", 483, self._ffprobeData.format) && _$jscoverage_done("lib/processor.js", 483, self._ffprobeData.format.duration)) { - _$jscoverage_done("lib/processor.js", 484); - duration = Number(self._ffprobeData.format.duration); - } - _$jscoverage_done("lib/processor.js", 487); - utils.extractProgress(self, stderr, duration); - } - }); - }, function endCB(err) { - _$jscoverage_done("lib/processor.js", 493); - delete self.ffmpegProc; - _$jscoverage_done("lib/processor.js", 495); - if (_$jscoverage_done("lib/processor.js", 495, err)) { - _$jscoverage_done("lib/processor.js", 496); - if (_$jscoverage_done("lib/processor.js", 496, err.message.match(/ffmpeg exited with code/))) { - _$jscoverage_done("lib/processor.js", 498); - err.message += ": " + utils.extractError(stderr); - } - _$jscoverage_done("lib/processor.js", 501); - emitEnd(err, stdout, stderr); - } else { - _$jscoverage_done("lib/processor.js", 504); - var flvmeta = self._outputs.filter(function(output) { - _$jscoverage_done("lib/processor.js", 505); - return output.flags.flvmeta; - }); - _$jscoverage_done("lib/processor.js", 508); - if (_$jscoverage_done("lib/processor.js", 508, flvmeta.length)) { - _$jscoverage_done("lib/processor.js", 509); - self._getFlvtoolPath(function(err, flvtool) { - _$jscoverage_done("lib/processor.js", 511); - async.each(flvmeta, function(output, cb) { - _$jscoverage_done("lib/processor.js", 514); - spawn(flvtool, [ "-U", output.target ]).on("error", function(err) { - _$jscoverage_done("lib/processor.js", 516); - cb(new Error("Error running " + flvtool + " on " + output.target + ": " + err.message)); - }).on("exit", function(code, signal) { - _$jscoverage_done("lib/processor.js", 519); - if (_$jscoverage_done("lib/processor.js", 519, code !== 0) || _$jscoverage_done("lib/processor.js", 519, signal)) { - _$jscoverage_done("lib/processor.js", 520); - cb(new Error(flvtool + " " + (signal ? "received signal " + signal : "exited with code " + code)) + " when running on " + output.target); - } else { - _$jscoverage_done("lib/processor.js", 527); - cb(); - } - }); - }, function(err) { - _$jscoverage_done("lib/processor.js", 532); - if (_$jscoverage_done("lib/processor.js", 532, err)) { - _$jscoverage_done("lib/processor.js", 533); - emitEnd(err); - } else { - _$jscoverage_done("lib/processor.js", 535); - emitEnd(null, stdout, stderr); - } - }); - }); - } else { - _$jscoverage_done("lib/processor.js", 541); - emitEnd(null, stdout, stderr); - } - } - }); - }); - }; - _$jscoverage_done("lib/processor.js", 561); - proto.renice = function(niceness) { - _$jscoverage_done("lib/processor.js", 562); - if (_$jscoverage_done("lib/processor.js", 562, !utils.isWindows)) { - _$jscoverage_done("lib/processor.js", 563); - niceness = niceness || 0; - _$jscoverage_done("lib/processor.js", 565); - if (_$jscoverage_done("lib/processor.js", 565, niceness < -20) || _$jscoverage_done("lib/processor.js", 565, niceness > 20)) { - _$jscoverage_done("lib/processor.js", 566); - this.logger.warn("Invalid niceness value: " + niceness + ", must be between -20 and 20"); - } - _$jscoverage_done("lib/processor.js", 569); - niceness = Math.min(20, Math.max(-20, niceness)); - _$jscoverage_done("lib/processor.js", 570); - this.options.niceness = niceness; - _$jscoverage_done("lib/processor.js", 572); - if (_$jscoverage_done("lib/processor.js", 572, this.ffmpegProc)) { - _$jscoverage_done("lib/processor.js", 573); - var logger = this.logger; - _$jscoverage_done("lib/processor.js", 574); - var pid = this.ffmpegProc.pid; - _$jscoverage_done("lib/processor.js", 575); - var renice = spawn("renice", [ niceness, "-p", pid ]); - _$jscoverage_done("lib/processor.js", 577); - renice.on("error", function(err) { - _$jscoverage_done("lib/processor.js", 578); - logger.warn("could not renice process " + pid + ": " + err.message); - }); - _$jscoverage_done("lib/processor.js", 581); - renice.on("exit", function(code, signal) { - _$jscoverage_done("lib/processor.js", 582); - if (_$jscoverage_done("lib/processor.js", 582, signal)) { - _$jscoverage_done("lib/processor.js", 583); - logger.warn("could not renice process " + pid + ": renice was killed by signal " + signal); - } else { - _$jscoverage_done("lib/processor.js", 584); - if (_$jscoverage_done("lib/processor.js", 584, code)) { - _$jscoverage_done("lib/processor.js", 585); - logger.warn("could not renice process " + pid + ": renice exited with " + code); - } else { - _$jscoverage_done("lib/processor.js", 587); - logger.info("successfully reniced process " + pid + " to " + niceness + " niceness"); - } - } - }); - } - } - _$jscoverage_done("lib/processor.js", 593); - return this; - }; - _$jscoverage_done("lib/processor.js", 606); - proto.kill = function(signal) { - _$jscoverage_done("lib/processor.js", 607); - if (_$jscoverage_done("lib/processor.js", 607, !this.ffmpegProc)) { - _$jscoverage_done("lib/processor.js", 608); - this.options.logger.warn("No running ffmpeg process, cannot send signal"); - } else { - _$jscoverage_done("lib/processor.js", 610); - this.ffmpegProc.kill(signal || "SIGKILL"); - } - _$jscoverage_done("lib/processor.js", 613); - return this; - }; -}; \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/lib-cov/recipes.js b/node_modules/fluent-ffmpeg/lib-cov/recipes.js deleted file mode 100644 index 1e17ea3..0000000 --- a/node_modules/fluent-ffmpeg/lib-cov/recipes.js +++ /dev/null @@ -1,411 +0,0 @@ -// instrument by jscoverage, do not modifly this file -(function () { - var BASE; - if (typeof global === 'object') { - BASE = global; - } else if (typeof window === 'object') { - BASE = window; - } else { - throw new Error('[jscoverage] unknow ENV!'); - } - if (!BASE._$jscoverage) { - BASE._$jscoverage = {}; - BASE._$jscoverage_cond = {}; - BASE._$jscoverage_done = function (file, line, express) { - if (arguments.length === 2) { - BASE._$jscoverage[file][line] ++; - } else { - BASE._$jscoverage_cond[file][line] ++; - return express; - } - }; - BASE._$jscoverage_init = function (base, file, lines) { - var tmp = []; - for (var i = 0; i < lines.length; i ++) { - tmp[lines[i]] = 0; - } - base[file] = tmp; - }; - } -})(); -_$jscoverage_init(_$jscoverage, "lib/recipes.js",[4,5,6,7,8,15,26,28,29,48,51,52,53,56,57,58,61,64,65,97,102,103,104,107,108,114,115,119,122,123,124,127,128,129,130,135,136,137,138,139,141,142,147,149,150,152,153,154,159,162,162,163,164,167,168,169,171,173,174,177,178,179,181,185,189,195,197,198,201,202,203,206,211,212,213,216,221,226,227,228,231,232,233,236,237,238,240,244,245,248,249,251,252,253,254,255,256,257,258,259,262,265,271,276,281,282,285,286,290,295,296,297,298,299,301,305,310,311,314,315,317,318,319,321,326,327,331,332,335,350,354,355,358,359,360,361,364,365,368,369,373,385]); -_$jscoverage_init(_$jscoverage_cond, "lib/recipes.js",[51,51,56,57,107,114,122,123,135,141,141,141,141,149,162,163,168,173,178,197,201,201,211,212,226,227,232,237,237,244,251,254,257,296,298,310,326,360]); -_$jscoverage["lib/recipes.js"].source = ["/*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;"," };","",""," /**"," * @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 {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'"," config.timemarks = 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 {"," var 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();"," }"," },",""," // 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 > 0 && !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, width, height);"," });"," } 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;"," });"," });",""," 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 = 'split=' + count;",""," for (var i = 0; i < count; i++) {"," var stream = '[screen' + i + ']';"," split += stream;",""," self.output(path.join(config.folder, filenames[i]))"," .seek(config.timemarks[i])"," .frames(1)"," .map(stream);",""," if ('size' in config) {"," self.size(config.size);"," }"," }",""," self.complexFilter(split);"," 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 file input"," var fileInput = this._inputs.filter(function(input) {"," return input.isFile;"," })[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;"," };","};"]; -"use strict"; - -_$jscoverage_done("lib/recipes.js", 4); -var fs = require("fs"); - -_$jscoverage_done("lib/recipes.js", 5); -var path = require("path"); - -_$jscoverage_done("lib/recipes.js", 6); -var PassThrough = require("stream").PassThrough; - -_$jscoverage_done("lib/recipes.js", 7); -var async = require("async"); - -_$jscoverage_done("lib/recipes.js", 8); -var utils = require("./utils"); - -_$jscoverage_done("lib/recipes.js", 15); -module.exports = function recipes(proto) { - _$jscoverage_done("lib/recipes.js", 26); - proto.saveToFile = proto.save = function(output) { - _$jscoverage_done("lib/recipes.js", 28); - this.output(output).run(); - _$jscoverage_done("lib/recipes.js", 29); - return this; - }; - _$jscoverage_done("lib/recipes.js", 48); - proto.writeToStream = proto.pipe = proto.stream = function(stream, options) { - _$jscoverage_done("lib/recipes.js", 51); - if (_$jscoverage_done("lib/recipes.js", 51, stream) && _$jscoverage_done("lib/recipes.js", 51, !("writable" in stream))) { - _$jscoverage_done("lib/recipes.js", 52); - options = stream; - _$jscoverage_done("lib/recipes.js", 53); - stream = undefined; - } - _$jscoverage_done("lib/recipes.js", 56); - if (_$jscoverage_done("lib/recipes.js", 56, !stream)) { - _$jscoverage_done("lib/recipes.js", 57); - if (_$jscoverage_done("lib/recipes.js", 57, process.version.match(/v0\.8\./))) { - _$jscoverage_done("lib/recipes.js", 58); - throw new Error("PassThrough stream is not supported on node v0.8"); - } - _$jscoverage_done("lib/recipes.js", 61); - stream = new PassThrough; - } - _$jscoverage_done("lib/recipes.js", 64); - this.output(stream, options).run(); - _$jscoverage_done("lib/recipes.js", 65); - return stream; - }; - _$jscoverage_done("lib/recipes.js", 97); - proto.takeScreenshots = proto.thumbnail = proto.thumbnails = proto.screenshot = proto.screenshots = function(config, folder) { - _$jscoverage_done("lib/recipes.js", 102); - var self = this; - _$jscoverage_done("lib/recipes.js", 103); - var source = this._currentInput.source; - _$jscoverage_done("lib/recipes.js", 104); - config = config || { - count: 1 - }; - _$jscoverage_done("lib/recipes.js", 107); - if (_$jscoverage_done("lib/recipes.js", 107, typeof config === "number")) { - _$jscoverage_done("lib/recipes.js", 108); - config = { - count: config - }; - } - _$jscoverage_done("lib/recipes.js", 114); - if (_$jscoverage_done("lib/recipes.js", 114, !("folder" in config))) { - _$jscoverage_done("lib/recipes.js", 115); - config.folder = folder || "."; - } - _$jscoverage_done("lib/recipes.js", 119); - config.timemarks = config.timemarks || config.timestamps; - _$jscoverage_done("lib/recipes.js", 122); - if (_$jscoverage_done("lib/recipes.js", 122, !("timemarks" in config))) { - _$jscoverage_done("lib/recipes.js", 123); - if (_$jscoverage_done("lib/recipes.js", 123, !config.count)) { - _$jscoverage_done("lib/recipes.js", 124); - throw new Error("Cannot take screenshots: neither a count nor a timemark list are specified"); - } - _$jscoverage_done("lib/recipes.js", 127); - var interval = 100 / (1 + config.count); - _$jscoverage_done("lib/recipes.js", 128); - config.timemarks = []; - _$jscoverage_done("lib/recipes.js", 129); - for (var i = 0; i <= config.count; i++) { - _$jscoverage_done("lib/recipes.js", 130); - config.timemarks.push(interval * (i + 1) + "%"); - } - } - _$jscoverage_done("lib/recipes.js", 135); - if (_$jscoverage_done("lib/recipes.js", 135, "size" in config)) { - _$jscoverage_done("lib/recipes.js", 136); - var fixedSize = config.size.match(/^(\d+)x(\d+)$/); - _$jscoverage_done("lib/recipes.js", 137); - var fixedWidth = config.size.match(/^(\d+)x\?$/); - _$jscoverage_done("lib/recipes.js", 138); - var fixedHeight = config.size.match(/^\?x(\d+)$/); - _$jscoverage_done("lib/recipes.js", 139); - var percentSize = config.size.match(/^(\d+)%$/); - _$jscoverage_done("lib/recipes.js", 141); - if (_$jscoverage_done("lib/recipes.js", 141, !fixedSize) && _$jscoverage_done("lib/recipes.js", 141, !fixedWidth) && _$jscoverage_done("lib/recipes.js", 141, !fixedHeight) && _$jscoverage_done("lib/recipes.js", 141, !percentSize)) { - _$jscoverage_done("lib/recipes.js", 142); - throw new Error("Invalid size parameter: " + config.size); - } - } - _$jscoverage_done("lib/recipes.js", 147); - var metadata; - function getMetadata(cb) { - _$jscoverage_done("lib/recipes.js", 149); - if (_$jscoverage_done("lib/recipes.js", 149, metadata)) { - _$jscoverage_done("lib/recipes.js", 150); - cb(null, metadata); - } else { - _$jscoverage_done("lib/recipes.js", 152); - self.ffprobe(function(err, meta) { - _$jscoverage_done("lib/recipes.js", 153); - metadata = meta; - _$jscoverage_done("lib/recipes.js", 154); - cb(err, meta); - }); - } - } - _$jscoverage_done("lib/recipes.js", 159); - async.waterfall([ function computeTimemarks(next) { - _$jscoverage_done("lib/recipes.js", 162); - if (_$jscoverage_done("lib/recipes.js", 162, config.timemarks.some(function(t) { - _$jscoverage_done("lib/recipes.js", 162); - return ("" + t).match(/^[\d.]+%$/); - }))) { - _$jscoverage_done("lib/recipes.js", 163); - if (_$jscoverage_done("lib/recipes.js", 163, typeof source !== "string")) { - _$jscoverage_done("lib/recipes.js", 164); - return next(new Error("Cannot compute screenshot timemarks with an input stream, please specify fixed timemarks")); - } - _$jscoverage_done("lib/recipes.js", 167); - getMetadata(function(err, meta) { - _$jscoverage_done("lib/recipes.js", 168); - if (_$jscoverage_done("lib/recipes.js", 168, err)) { - _$jscoverage_done("lib/recipes.js", 169); - next(err); - } else { - _$jscoverage_done("lib/recipes.js", 171); - var duration = Number(meta.format.duration); - _$jscoverage_done("lib/recipes.js", 173); - if (_$jscoverage_done("lib/recipes.js", 173, isNaN(duration))) { - _$jscoverage_done("lib/recipes.js", 174); - return next(new Error("Could not get input duration, please specify fixed timemarks")); - } - _$jscoverage_done("lib/recipes.js", 177); - config.timemarks = config.timemarks.map(function(mark) { - _$jscoverage_done("lib/recipes.js", 178); - if (_$jscoverage_done("lib/recipes.js", 178, ("" + mark).match(/^([\d.]+)%$/))) { - _$jscoverage_done("lib/recipes.js", 179); - return duration * parseFloat(mark) / 100; - } else { - _$jscoverage_done("lib/recipes.js", 181); - return mark; - } - }); - _$jscoverage_done("lib/recipes.js", 185); - next(); - } - }); - } else { - _$jscoverage_done("lib/recipes.js", 189); - next(); - } - }, function fixPattern(next) { - _$jscoverage_done("lib/recipes.js", 195); - var pattern = config.filename || "tn.png"; - _$jscoverage_done("lib/recipes.js", 197); - if (_$jscoverage_done("lib/recipes.js", 197, pattern.indexOf(".") === -1)) { - _$jscoverage_done("lib/recipes.js", 198); - pattern += ".png"; - } - _$jscoverage_done("lib/recipes.js", 201); - if (_$jscoverage_done("lib/recipes.js", 201, config.timemarks.length > 0) && _$jscoverage_done("lib/recipes.js", 201, !pattern.match(/%(s|0*i)/))) { - _$jscoverage_done("lib/recipes.js", 202); - var ext = path.extname(pattern); - _$jscoverage_done("lib/recipes.js", 203); - pattern = path.join(path.dirname(pattern), path.basename(pattern, ext) + "_%i" + ext); - } - _$jscoverage_done("lib/recipes.js", 206); - next(null, pattern); - }, function replaceFilenameTokens(pattern, next) { - _$jscoverage_done("lib/recipes.js", 211); - if (_$jscoverage_done("lib/recipes.js", 211, pattern.match(/%[bf]/))) { - _$jscoverage_done("lib/recipes.js", 212); - if (_$jscoverage_done("lib/recipes.js", 212, typeof source !== "string")) { - _$jscoverage_done("lib/recipes.js", 213); - return next(new Error("Cannot replace %f or %b when using an input stream")); - } - _$jscoverage_done("lib/recipes.js", 216); - pattern = pattern.replace(/%f/g, path.basename(source)).replace(/%b/g, path.basename(source, path.extname(source))); - } - _$jscoverage_done("lib/recipes.js", 221); - next(null, pattern); - }, function getSize(pattern, next) { - _$jscoverage_done("lib/recipes.js", 226); - if (_$jscoverage_done("lib/recipes.js", 226, pattern.match(/%[whr]/))) { - _$jscoverage_done("lib/recipes.js", 227); - if (_$jscoverage_done("lib/recipes.js", 227, fixedSize)) { - _$jscoverage_done("lib/recipes.js", 228); - return next(null, pattern, fixedSize[1], fixedSize[2]); - } - _$jscoverage_done("lib/recipes.js", 231); - getMetadata(function(err, meta) { - _$jscoverage_done("lib/recipes.js", 232); - if (_$jscoverage_done("lib/recipes.js", 232, err)) { - _$jscoverage_done("lib/recipes.js", 233); - return next(new Error("Could not determine video resolution to replace %w, %h or %r")); - } - _$jscoverage_done("lib/recipes.js", 236); - var vstream = meta.streams.reduce(function(biggest, stream) { - _$jscoverage_done("lib/recipes.js", 237); - if (_$jscoverage_done("lib/recipes.js", 237, stream.codec_type === "video") && _$jscoverage_done("lib/recipes.js", 237, stream.width * stream.height > biggest.width * biggest.height)) { - _$jscoverage_done("lib/recipes.js", 238); - return stream; - } else { - _$jscoverage_done("lib/recipes.js", 240); - return biggest; - } - }, { - width: 0, - height: 0 - }); - _$jscoverage_done("lib/recipes.js", 244); - if (_$jscoverage_done("lib/recipes.js", 244, vstream.width === 0)) { - _$jscoverage_done("lib/recipes.js", 245); - return next(new Error("No video stream in input, cannot replace %w, %h or %r")); - } - _$jscoverage_done("lib/recipes.js", 248); - var width = vstream.width; - _$jscoverage_done("lib/recipes.js", 249); - var height = vstream.height; - _$jscoverage_done("lib/recipes.js", 251); - if (_$jscoverage_done("lib/recipes.js", 251, fixedWidth)) { - _$jscoverage_done("lib/recipes.js", 252); - height = height * Number(fixedWidth[1]) / width; - _$jscoverage_done("lib/recipes.js", 253); - width = Number(fixedWidth[1]); - } else { - _$jscoverage_done("lib/recipes.js", 254); - if (_$jscoverage_done("lib/recipes.js", 254, fixedHeight)) { - _$jscoverage_done("lib/recipes.js", 255); - width = width * Number(fixedHeight[1]) / height; - _$jscoverage_done("lib/recipes.js", 256); - height = Number(fixedHeight[1]); - } else { - _$jscoverage_done("lib/recipes.js", 257); - if (_$jscoverage_done("lib/recipes.js", 257, percentSize)) { - _$jscoverage_done("lib/recipes.js", 258); - width = width * Number(percentSize[1]) / 100; - _$jscoverage_done("lib/recipes.js", 259); - height = height * Number(percentSize[1]) / 100; - } - } - } - _$jscoverage_done("lib/recipes.js", 262); - next(null, pattern, width, height); - }); - } else { - _$jscoverage_done("lib/recipes.js", 265); - next(null, pattern, -1, -1); - } - }, function replaceSizeTokens(pattern, width, height, next) { - _$jscoverage_done("lib/recipes.js", 271); - pattern = pattern.replace(/%r/g, "%wx%h").replace(/%w/g, width).replace(/%h/g, height); - _$jscoverage_done("lib/recipes.js", 276); - next(null, pattern); - }, function replaceVariableTokens(pattern, next) { - _$jscoverage_done("lib/recipes.js", 281); - var filenames = config.timemarks.map(function(t, i) { - _$jscoverage_done("lib/recipes.js", 282); - return pattern.replace(/%s/g, utils.timemarkToSeconds(t)).replace(/%(0*)i/g, function(match, padding) { - _$jscoverage_done("lib/recipes.js", 285); - var idx = "" + (i + 1); - _$jscoverage_done("lib/recipes.js", 286); - return padding.substr(0, Math.max(0, padding.length + 1 - idx.length)) + idx; - }); - }); - _$jscoverage_done("lib/recipes.js", 290); - next(null, filenames); - }, function createDirectory(filenames, next) { - _$jscoverage_done("lib/recipes.js", 295); - fs.exists(config.folder, function(exists) { - _$jscoverage_done("lib/recipes.js", 296); - if (_$jscoverage_done("lib/recipes.js", 296, !exists)) { - _$jscoverage_done("lib/recipes.js", 297); - fs.mkdir(config.folder, function(err) { - _$jscoverage_done("lib/recipes.js", 298); - if (_$jscoverage_done("lib/recipes.js", 298, err)) { - _$jscoverage_done("lib/recipes.js", 299); - next(err); - } else { - _$jscoverage_done("lib/recipes.js", 301); - next(null, filenames); - } - }); - } else { - _$jscoverage_done("lib/recipes.js", 305); - next(null, filenames); - } - }); - } ], function runCommand(err, filenames) { - _$jscoverage_done("lib/recipes.js", 310); - if (_$jscoverage_done("lib/recipes.js", 310, err)) { - _$jscoverage_done("lib/recipes.js", 311); - return self.emit("error", err); - } - _$jscoverage_done("lib/recipes.js", 314); - var count = config.timemarks.length; - _$jscoverage_done("lib/recipes.js", 315); - var split = "split=" + count; - _$jscoverage_done("lib/recipes.js", 317); - for (var i = 0; i < count; i++) { - _$jscoverage_done("lib/recipes.js", 318); - var stream = "[screen" + i + "]"; - _$jscoverage_done("lib/recipes.js", 319); - split += stream; - _$jscoverage_done("lib/recipes.js", 321); - self.output(path.join(config.folder, filenames[i])).seek(config.timemarks[i]).frames(1).map(stream); - _$jscoverage_done("lib/recipes.js", 326); - if (_$jscoverage_done("lib/recipes.js", 326, "size" in config)) { - _$jscoverage_done("lib/recipes.js", 327); - self.size(config.size); - } - } - _$jscoverage_done("lib/recipes.js", 331); - self.complexFilter(split); - _$jscoverage_done("lib/recipes.js", 332); - self.run(); - }); - _$jscoverage_done("lib/recipes.js", 335); - return this; - }; - _$jscoverage_done("lib/recipes.js", 350); - proto.mergeToFile = proto.concatenate = proto.concat = function(target, options) { - _$jscoverage_done("lib/recipes.js", 354); - var fileInput = this._inputs.filter(function(input) { - _$jscoverage_done("lib/recipes.js", 355); - return input.isFile; - })[0]; - _$jscoverage_done("lib/recipes.js", 358); - var self = this; - _$jscoverage_done("lib/recipes.js", 359); - this.ffprobe(this._inputs.indexOf(fileInput), function(err, data) { - _$jscoverage_done("lib/recipes.js", 360); - if (_$jscoverage_done("lib/recipes.js", 360, err)) { - _$jscoverage_done("lib/recipes.js", 361); - return self.emit("error", err); - } - _$jscoverage_done("lib/recipes.js", 364); - var hasAudioStreams = data.streams.some(function(stream) { - _$jscoverage_done("lib/recipes.js", 365); - return stream.codec_type === "audio"; - }); - _$jscoverage_done("lib/recipes.js", 368); - var hasVideoStreams = data.streams.some(function(stream) { - _$jscoverage_done("lib/recipes.js", 369); - return stream.codec_type === "video"; - }); - _$jscoverage_done("lib/recipes.js", 373); - self.output(target, options).complexFilter({ - filter: "concat", - options: { - n: self._inputs.length, - v: hasVideoStreams ? 1 : 0, - a: hasAudioStreams ? 1 : 0 - } - }).run(); - }); - _$jscoverage_done("lib/recipes.js", 385); - return this; - }; -}; \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/lib-cov/utils.js b/node_modules/fluent-ffmpeg/lib-cov/utils.js deleted file mode 100644 index 89cfdfa..0000000 --- a/node_modules/fluent-ffmpeg/lib-cov/utils.js +++ /dev/null @@ -1,360 +0,0 @@ -// instrument by jscoverage, do not modifly this file -(function () { - var BASE; - if (typeof global === 'object') { - BASE = global; - } else if (typeof window === 'object') { - BASE = window; - } else { - throw new Error('[jscoverage] unknow ENV!'); - } - if (!BASE._$jscoverage) { - BASE._$jscoverage = {}; - BASE._$jscoverage_cond = {}; - BASE._$jscoverage_done = function (file, line, express) { - if (arguments.length === 2) { - BASE._$jscoverage[file][line] ++; - } else { - BASE._$jscoverage_cond[file][line] ++; - return express; - } - }; - BASE._$jscoverage_init = function (base, file, lines) { - var tmp = []; - for (var i = 0; i < lines.length; i ++) { - tmp[lines[i]] = 0; - } - base[file] = tmp; - }; - } -})(); -_$jscoverage_init(_$jscoverage, "lib/utils.js",[4,5,7,8,9,19,22,23,26,27,28,29,32,33,35,38,42,55,56,74,75,76,77,79,83,84,87,88,91,92,93,94,98,99,100,101,105,106,107,108,111,130,131,132,135,144,145,146,148,149,153,156,157,159,160,162,163,165,166,172,173,174,176,177,180,195,196,199,200,201,204,205,207,209,223,224,226,229,231,233,236,238,241,253,254,255,256,257,259,260,263,264,267,268,269,270,272,273,274,275,278,279,280,281,295,296,297,299,300,303,305,314,315,318,332,333,334,336,337]); -_$jscoverage_init(_$jscoverage_cond, "lib/utils.js",[32,76,76,93,100,131,144,148,156,157,160,163,172,176,195,200,205,223,223,231,236,259,259,263,263,267,267,272,272,279,299,303,314,314,333]); -_$jscoverage["lib/utils.js"].source = ["/*jshint node:true*/","'use strict';","","var exec = require('child_process').exec;","var isWindows = require('os').platform().match(/win(32|64)/);","","var nlRegexp = /\\r\\n|\\r|\\n/g;","var streamRegexp = /^\\[?(.*?)\\]?$/;","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 = [];"," var argfunc = function() {"," if (arguments.length === 1 && Array.isArray(arguments[0])) {"," list = list.concat(arguments[0]);"," } else {"," list = list.concat([].slice.call(arguments));"," }"," };",""," argfunc.clear = function() {"," list = [];"," };",""," argfunc.get = function() {"," return list;"," };",""," argfunc.find = function(arg, count) {"," var index = list.indexOf(arg);"," if (index !== -1) {"," return list.slice(index + 1, index + 1 + (count || 0));"," }"," };",""," argfunc.remove = function(arg, count) {"," var index = list.indexOf(arg);"," if (index !== -1) {"," list.splice(index, (count || 0) + 1);"," }"," };",""," 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') {"," // Option string"," filterString += '=' + filterSpec.options;"," } else if (Array.isArray(filterSpec.options)) {"," // Option array (unnamed options)"," filterString += '=' + filterSpec.options.join(':');"," } else if (Object.keys(filterSpec.options).length) {"," // Option object (named options)"," filterString += '=' + Object.keys(filterSpec.options).map(function(option) {"," return option + '=' + filterSpec.options[option];"," }).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]);"," }",""," var cmd = 'which ' + name;"," if (isWindows) {"," cmd = 'where ' + name + '.exe';"," }",""," exec(cmd, function(err, stdout) {"," if (err) {"," // Treat errors as not found"," callback(null, whichCache[name] = '');"," } else {"," callback(null, whichCache[name] = stdout.replace(/\\n$/, ''));"," }"," });"," },","",""," /**"," * Convert a [[hh:]mm:]ss[.xxx] timemark into seconds"," *"," * @param {String} timemark timemark string"," * @return Number"," * @private"," */"," timemarkToSeconds: function(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"," *"," * @param {FfmpegCommand} command event emitter"," * @param {String} stderr ffmpeg stderr output"," * @private"," */"," extractCodecData: function(command, stderr) {"," var format= /Input #[0-9]+, ([^ ]+),/.exec(stderr);"," var dur = /Duration\\: ([^,]+)/.exec(stderr);"," var audio = /Audio\\: (.*)/.exec(stderr);"," var video = /Video\\: (.*)/.exec(stderr);"," var codecObject = { format: '', audio: '', video: '', duration: '' };",""," if (format && format.length > 1) {"," codecObject.format = format[1];"," }",""," if (dur && dur.length > 1) {"," codecObject.duration = dur[1];"," }",""," if (audio && audio.length > 1) {"," audio = audio[1].split(', ');"," codecObject.audio = audio[0];"," codecObject.audio_details = audio;"," }"," if (video && video.length > 1) {"," video = video[1].split(', ');"," codecObject.video = video[0];"," codecObject.video_details = video;"," }",""," var codecInfoPassed = /Press (\\[q\\]|ctrl-c) to stop/.test(stderr);"," if (codecInfoPassed) {"," command.emit('codecData', codecObject);"," command._codecDataSent = true;"," }"," },","",""," /**"," * Extract progress data from ffmpeg stderr and emit 'progress' event if appropriate"," *"," * @param {FfmpegCommand} command event emitter"," * @param {String} stderr ffmpeg stderr data"," * @param {Number} [duration=0] expected output duration in seconds"," * @private"," */"," extractProgress: function(command, stderr, duration) {"," var lines = stderr.split(nlRegexp);"," var lastline = lines[lines.length - 2];"," var progress;",""," if (lastline) {"," progress = parseProgressLine(lastline);"," }",""," if (progress) {"," // build progress report object"," var ret = {"," frames: parseInt(progress.frame, 10),"," currentFps: parseInt(progress.fps, 10),"," currentKbps: parseFloat(progress.bitrate.replace('kbits/s', '')),"," 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"," return stderr.split(nlRegexp).reduce(function(messages, message) {"," if (message.charAt(0) === ' ') {"," return [];"," } else {"," messages.push(message);"," return messages;"," }"," }, []).join('\\n');"," }","};",""]; -"use strict"; - -_$jscoverage_done("lib/utils.js", 4); -var exec = require("child_process").exec; - -_$jscoverage_done("lib/utils.js", 5); -var isWindows = require("os").platform().match(/win(32|64)/); - -_$jscoverage_done("lib/utils.js", 7); -var nlRegexp = /\r\n|\r|\n/g; - -_$jscoverage_done("lib/utils.js", 8); -var streamRegexp = /^\[?(.*?)\]?$/; - -_$jscoverage_done("lib/utils.js", 9); -var whichCache = {}; - -function parseProgressLine(line) { - _$jscoverage_done("lib/utils.js", 19); - var progress = {}; - _$jscoverage_done("lib/utils.js", 22); - line = line.replace(/=\s+/g, "=").trim(); - _$jscoverage_done("lib/utils.js", 23); - var progressParts = line.split(" "); - _$jscoverage_done("lib/utils.js", 26); - for (var i = 0; i < progressParts.length; i++) { - _$jscoverage_done("lib/utils.js", 27); - var progressSplit = progressParts[i].split("=", 2); - _$jscoverage_done("lib/utils.js", 28); - var key = progressSplit[0]; - _$jscoverage_done("lib/utils.js", 29); - var value = progressSplit[1]; - _$jscoverage_done("lib/utils.js", 32); - if (_$jscoverage_done("lib/utils.js", 32, typeof value === "undefined")) { - _$jscoverage_done("lib/utils.js", 33); - return null; - } - _$jscoverage_done("lib/utils.js", 35); - progress[key] = value; - } - _$jscoverage_done("lib/utils.js", 38); - return progress; -} - -_$jscoverage_done("lib/utils.js", 42); -var utils = module.exports = { - isWindows: isWindows, - streamRegexp: streamRegexp, - copy: function(source, dest) { - _$jscoverage_done("lib/utils.js", 55); - Object.keys(source).forEach(function(key) { - _$jscoverage_done("lib/utils.js", 56); - dest[key] = source[key]; - }); - }, - args: function() { - _$jscoverage_done("lib/utils.js", 74); - var list = []; - _$jscoverage_done("lib/utils.js", 75); - var argfunc = function() { - _$jscoverage_done("lib/utils.js", 76); - if (_$jscoverage_done("lib/utils.js", 76, arguments.length === 1) && _$jscoverage_done("lib/utils.js", 76, Array.isArray(arguments[0]))) { - _$jscoverage_done("lib/utils.js", 77); - list = list.concat(arguments[0]); - } else { - _$jscoverage_done("lib/utils.js", 79); - list = list.concat([].slice.call(arguments)); - } - }; - _$jscoverage_done("lib/utils.js", 83); - argfunc.clear = function() { - _$jscoverage_done("lib/utils.js", 84); - list = []; - }; - _$jscoverage_done("lib/utils.js", 87); - argfunc.get = function() { - _$jscoverage_done("lib/utils.js", 88); - return list; - }; - _$jscoverage_done("lib/utils.js", 91); - argfunc.find = function(arg, count) { - _$jscoverage_done("lib/utils.js", 92); - var index = list.indexOf(arg); - _$jscoverage_done("lib/utils.js", 93); - if (_$jscoverage_done("lib/utils.js", 93, index !== -1)) { - _$jscoverage_done("lib/utils.js", 94); - return list.slice(index + 1, index + 1 + (count || 0)); - } - }; - _$jscoverage_done("lib/utils.js", 98); - argfunc.remove = function(arg, count) { - _$jscoverage_done("lib/utils.js", 99); - var index = list.indexOf(arg); - _$jscoverage_done("lib/utils.js", 100); - if (_$jscoverage_done("lib/utils.js", 100, index !== -1)) { - _$jscoverage_done("lib/utils.js", 101); - list.splice(index, (count || 0) + 1); - } - }; - _$jscoverage_done("lib/utils.js", 105); - argfunc.clone = function() { - _$jscoverage_done("lib/utils.js", 106); - var cloned = utils.args(); - _$jscoverage_done("lib/utils.js", 107); - cloned(list); - _$jscoverage_done("lib/utils.js", 108); - return cloned; - }; - _$jscoverage_done("lib/utils.js", 111); - return argfunc; - }, - makeFilterStrings: function(filters) { - _$jscoverage_done("lib/utils.js", 130); - return filters.map(function(filterSpec) { - _$jscoverage_done("lib/utils.js", 131); - if (_$jscoverage_done("lib/utils.js", 131, typeof filterSpec === "string")) { - _$jscoverage_done("lib/utils.js", 132); - return filterSpec; - } - _$jscoverage_done("lib/utils.js", 135); - var filterString = ""; - _$jscoverage_done("lib/utils.js", 144); - if (_$jscoverage_done("lib/utils.js", 144, Array.isArray(filterSpec.inputs))) { - _$jscoverage_done("lib/utils.js", 145); - filterString += filterSpec.inputs.map(function(streamSpec) { - _$jscoverage_done("lib/utils.js", 146); - return streamSpec.replace(streamRegexp, "[$1]"); - }).join(""); - } else { - _$jscoverage_done("lib/utils.js", 148); - if (_$jscoverage_done("lib/utils.js", 148, typeof filterSpec.inputs === "string")) { - _$jscoverage_done("lib/utils.js", 149); - filterString += filterSpec.inputs.replace(streamRegexp, "[$1]"); - } - } - _$jscoverage_done("lib/utils.js", 153); - filterString += filterSpec.filter; - _$jscoverage_done("lib/utils.js", 156); - if (_$jscoverage_done("lib/utils.js", 156, filterSpec.options)) { - _$jscoverage_done("lib/utils.js", 157); - if (_$jscoverage_done("lib/utils.js", 157, typeof filterSpec.options === "string")) { - _$jscoverage_done("lib/utils.js", 159); - filterString += "=" + filterSpec.options; - } else { - _$jscoverage_done("lib/utils.js", 160); - if (_$jscoverage_done("lib/utils.js", 160, Array.isArray(filterSpec.options))) { - _$jscoverage_done("lib/utils.js", 162); - filterString += "=" + filterSpec.options.join(":"); - } else { - _$jscoverage_done("lib/utils.js", 163); - if (_$jscoverage_done("lib/utils.js", 163, Object.keys(filterSpec.options).length)) { - _$jscoverage_done("lib/utils.js", 165); - filterString += "=" + Object.keys(filterSpec.options).map(function(option) { - _$jscoverage_done("lib/utils.js", 166); - return option + "=" + filterSpec.options[option]; - }).join(":"); - } - } - } - } - _$jscoverage_done("lib/utils.js", 172); - if (_$jscoverage_done("lib/utils.js", 172, Array.isArray(filterSpec.outputs))) { - _$jscoverage_done("lib/utils.js", 173); - filterString += filterSpec.outputs.map(function(streamSpec) { - _$jscoverage_done("lib/utils.js", 174); - return streamSpec.replace(streamRegexp, "[$1]"); - }).join(""); - } else { - _$jscoverage_done("lib/utils.js", 176); - if (_$jscoverage_done("lib/utils.js", 176, typeof filterSpec.outputs === "string")) { - _$jscoverage_done("lib/utils.js", 177); - filterString += filterSpec.outputs.replace(streamRegexp, "[$1]"); - } - } - _$jscoverage_done("lib/utils.js", 180); - return filterString; - }); - }, - which: function(name, callback) { - _$jscoverage_done("lib/utils.js", 195); - if (_$jscoverage_done("lib/utils.js", 195, name in whichCache)) { - _$jscoverage_done("lib/utils.js", 196); - return callback(null, whichCache[name]); - } - _$jscoverage_done("lib/utils.js", 199); - var cmd = "which " + name; - _$jscoverage_done("lib/utils.js", 200); - if (_$jscoverage_done("lib/utils.js", 200, isWindows)) { - _$jscoverage_done("lib/utils.js", 201); - cmd = "where " + name + ".exe"; - } - _$jscoverage_done("lib/utils.js", 204); - exec(cmd, function(err, stdout) { - _$jscoverage_done("lib/utils.js", 205); - if (_$jscoverage_done("lib/utils.js", 205, err)) { - _$jscoverage_done("lib/utils.js", 207); - callback(null, whichCache[name] = ""); - } else { - _$jscoverage_done("lib/utils.js", 209); - callback(null, whichCache[name] = stdout.replace(/\n$/, "")); - } - }); - }, - timemarkToSeconds: function(timemark) { - _$jscoverage_done("lib/utils.js", 223); - if (_$jscoverage_done("lib/utils.js", 223, timemark.indexOf(":") === -1) && _$jscoverage_done("lib/utils.js", 223, timemark.indexOf(".") >= 0)) { - _$jscoverage_done("lib/utils.js", 224); - return Number(timemark); - } - _$jscoverage_done("lib/utils.js", 226); - var parts = timemark.split(":"); - _$jscoverage_done("lib/utils.js", 229); - var secs = Number(parts.pop()); - _$jscoverage_done("lib/utils.js", 231); - if (_$jscoverage_done("lib/utils.js", 231, parts.length)) { - _$jscoverage_done("lib/utils.js", 233); - secs += Number(parts.pop()) * 60; - } - _$jscoverage_done("lib/utils.js", 236); - if (_$jscoverage_done("lib/utils.js", 236, parts.length)) { - _$jscoverage_done("lib/utils.js", 238); - secs += Number(parts.pop()) * 3600; - } - _$jscoverage_done("lib/utils.js", 241); - return secs; - }, - extractCodecData: function(command, stderr) { - _$jscoverage_done("lib/utils.js", 253); - var format = /Input #[0-9]+, ([^ ]+),/.exec(stderr); - _$jscoverage_done("lib/utils.js", 254); - var dur = /Duration\: ([^,]+)/.exec(stderr); - _$jscoverage_done("lib/utils.js", 255); - var audio = /Audio\: (.*)/.exec(stderr); - _$jscoverage_done("lib/utils.js", 256); - var video = /Video\: (.*)/.exec(stderr); - _$jscoverage_done("lib/utils.js", 257); - var codecObject = { - format: "", - audio: "", - video: "", - duration: "" - }; - _$jscoverage_done("lib/utils.js", 259); - if (_$jscoverage_done("lib/utils.js", 259, format) && _$jscoverage_done("lib/utils.js", 259, format.length > 1)) { - _$jscoverage_done("lib/utils.js", 260); - codecObject.format = format[1]; - } - _$jscoverage_done("lib/utils.js", 263); - if (_$jscoverage_done("lib/utils.js", 263, dur) && _$jscoverage_done("lib/utils.js", 263, dur.length > 1)) { - _$jscoverage_done("lib/utils.js", 264); - codecObject.duration = dur[1]; - } - _$jscoverage_done("lib/utils.js", 267); - if (_$jscoverage_done("lib/utils.js", 267, audio) && _$jscoverage_done("lib/utils.js", 267, audio.length > 1)) { - _$jscoverage_done("lib/utils.js", 268); - audio = audio[1].split(", "); - _$jscoverage_done("lib/utils.js", 269); - codecObject.audio = audio[0]; - _$jscoverage_done("lib/utils.js", 270); - codecObject.audio_details = audio; - } - _$jscoverage_done("lib/utils.js", 272); - if (_$jscoverage_done("lib/utils.js", 272, video) && _$jscoverage_done("lib/utils.js", 272, video.length > 1)) { - _$jscoverage_done("lib/utils.js", 273); - video = video[1].split(", "); - _$jscoverage_done("lib/utils.js", 274); - codecObject.video = video[0]; - _$jscoverage_done("lib/utils.js", 275); - codecObject.video_details = video; - } - _$jscoverage_done("lib/utils.js", 278); - var codecInfoPassed = /Press (\[q\]|ctrl-c) to stop/.test(stderr); - _$jscoverage_done("lib/utils.js", 279); - if (_$jscoverage_done("lib/utils.js", 279, codecInfoPassed)) { - _$jscoverage_done("lib/utils.js", 280); - command.emit("codecData", codecObject); - _$jscoverage_done("lib/utils.js", 281); - command._codecDataSent = true; - } - }, - extractProgress: function(command, stderr, duration) { - _$jscoverage_done("lib/utils.js", 295); - var lines = stderr.split(nlRegexp); - _$jscoverage_done("lib/utils.js", 296); - var lastline = lines[lines.length - 2]; - _$jscoverage_done("lib/utils.js", 297); - var progress; - _$jscoverage_done("lib/utils.js", 299); - if (_$jscoverage_done("lib/utils.js", 299, lastline)) { - _$jscoverage_done("lib/utils.js", 300); - progress = parseProgressLine(lastline); - } - _$jscoverage_done("lib/utils.js", 303); - if (_$jscoverage_done("lib/utils.js", 303, progress)) { - _$jscoverage_done("lib/utils.js", 305); - var ret = { - frames: parseInt(progress.frame, 10), - currentFps: parseInt(progress.fps, 10), - currentKbps: parseFloat(progress.bitrate.replace("kbits/s", "")), - targetSize: parseInt(progress.size, 10), - timemark: progress.time - }; - _$jscoverage_done("lib/utils.js", 314); - if (_$jscoverage_done("lib/utils.js", 314, duration) && _$jscoverage_done("lib/utils.js", 314, duration > 0)) { - _$jscoverage_done("lib/utils.js", 315); - ret.percent = utils.timemarkToSeconds(ret.timemark) / duration * 100; - } - _$jscoverage_done("lib/utils.js", 318); - command.emit("progress", ret); - } - }, - extractError: function(stderr) { - _$jscoverage_done("lib/utils.js", 332); - return stderr.split(nlRegexp).reduce(function(messages, message) { - _$jscoverage_done("lib/utils.js", 333); - if (_$jscoverage_done("lib/utils.js", 333, message.charAt(0) === " ")) { - _$jscoverage_done("lib/utils.js", 334); - return []; - } else { - _$jscoverage_done("lib/utils.js", 336); - messages.push(message); - _$jscoverage_done("lib/utils.js", 337); - return messages; - } - }, []).join("\n"); - } -}; \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/lib/capabilities.js b/node_modules/fluent-ffmpeg/lib/capabilities.js deleted file mode 100644 index c210cdb..0000000 --- a/node_modules/fluent-ffmpeg/lib/capabilities.js +++ /dev/null @@ -1,661 +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 }, function (err, stdout) { - if (err) { - return callback(err); - } - - 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 }, function(err, stdout) { - if (err) { - return callback(err); - } - - 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 }, function(err, stdout) { - if (err) { - return callback(err); - } - - 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 }, function (err, stdout) { - if (err) { - return callback(err); - } - - // Parse output - 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/node_modules/fluent-ffmpeg/lib/ffprobe.js b/node_modules/fluent-ffmpeg/lib/ffprobe.js deleted file mode 100644 index 397bd1a..0000000 --- a/node_modules/fluent-ffmpeg/lib/ffprobe.js +++ /dev/null @@ -1,215 +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/); - var data = { - streams: [] - }; - - function parseBlock() { - var data = {}; - - var line = lines.shift(); - while (line) { - if (line.match(/^\[\//)) { - return data; - } else if (line.match(/^\[/)) { - lines.unshift(line); - return data; - } - - 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 (line) { - if (line.match(/^\[stream/i)) { - var stream = parseBlock(); - data.streams.push(stream); - } else if (line.toLowerCase() === '[format]') { - data.format = parseBlock(); - } - - 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 {FfmpegCommand~ffprobeCallback} callback callback function - * - */ - proto.ffprobe = function(index, callback) { - var input; - - if (typeof callback === 'undefined') { - callback = index; - - if (!this._currentInput) { - return callback(new Error('No input specified')); - } - - input = this._currentInput; - } else { - input = this._inputs[index]; - - if (!input) { - return callback(new Error('Invalid input index')); - } - } - - if (input.isStream) { - return callback(new Error('Cannot run ffprobe on stream input')); - } - - // Find ffprobe - this._getFfprobePath(function(err, path) { - if (err) { - return callback(err); - } else if (!path) { - return callback(new Error('Cannot find ffprobe')); - } - - var stdout = ''; - var stdoutClosed = false; - var stderr = ''; - var stderrClosed = false; - - // Spawn ffprobe - var ffprobe = spawn(path, [ - '-show_streams', - '-show_format', - input.source - ]); - - ffprobe.on('error', function(err) { - callback(err); - }); - - // 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 callback(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) { - 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]; - }); - } - }); - - callback(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/node_modules/fluent-ffmpeg/lib/fluent-ffmpeg.js b/node_modules/fluent-ffmpeg/lib/fluent-ffmpeg.js deleted file mode 100644 index 4505e8a..0000000 --- a/node_modules/fluent-ffmpeg/lib/fluent-ffmpeg.js +++ /dev/null @@ -1,218 +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 {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.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, callback) { - (new FfmpegCommand(file)).ffprobe(callback); -}; - -/* Add processing recipes */ - -require('./recipes')(FfmpegCommand.prototype); diff --git a/node_modules/fluent-ffmpeg/lib/options/audio.js b/node_modules/fluent-ffmpeg/lib/options/audio.js deleted file mode 100644 index 607fdb3..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/lib/options/custom.js b/node_modules/fluent-ffmpeg/lib/options/custom.js deleted file mode 100644 index d743566..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/lib/options/inputs.js b/node_modules/fluent-ffmpeg/lib/options/inputs.js deleted file mode 100644 index 804a21a..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/lib/options/misc.js b/node_modules/fluent-ffmpeg/lib/options/misc.js deleted file mode 100644 index a92f7aa..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/lib/options/output.js b/node_modules/fluent-ffmpeg/lib/options/output.js deleted file mode 100644 index da4f771..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/lib/options/video.js b/node_modules/fluent-ffmpeg/lib/options/video.js deleted file mode 100644 index bb13c66..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/lib/options/videosize.js b/node_modules/fluent-ffmpeg/lib/options/videosize.js deleted file mode 100644 index b175dcd..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/lib/presets/divx.js b/node_modules/fluent-ffmpeg/lib/presets/divx.js deleted file mode 100644 index 090571b..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/lib/presets/flashvideo.js b/node_modules/fluent-ffmpeg/lib/presets/flashvideo.js deleted file mode 100644 index 22aef8e..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/lib/presets/podcast.js b/node_modules/fluent-ffmpeg/lib/presets/podcast.js deleted file mode 100644 index a7a0dc1..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/lib/processor.js b/node_modules/fluent-ffmpeg/lib/processor.js deleted file mode 100644 index 00c8426..0000000 --- a/node_modules/fluent-ffmpeg/lib/processor.js +++ /dev/null @@ -1,638 +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) { - 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 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|null} [filenames] generated filenames when taking screenshots, null otherwise - */ - - - /** - * Spawn an ffmpeg process - * - * The 'options' argument may contain the following keys: - * - 'niceness': specify process niceness, ignored on Windows (default: 0) - * - 'captureStdout': capture stdout and pass it to 'endCB' as its 2nd argument (default: false) - * - 'captureStderr': capture stderr and pass it to 'endCB' as its 3rd argument (default: false) - * - * 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 when it has been created - * @param {Function} endCB callback with signature (err, stdout, stderr) - * @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() {}; - } - - // 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 stdout = null; - var stdoutClosed = false; - - var stderr = null; - var stderrClosed = false; - - // Spawn process - var ffmpegProc = spawn(command, args, options); - - if (ffmpegProc.stderr && options.captureStderr) { - 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 || !options.captureStderr)) { - endCB(exitError, stdout, stderr); - } - } - - // 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) { - stdout = ''; - - ffmpegProc.stdout.on('data', function(data) { - stdout += data; - }); - - ffmpegProc.stdout.on('close', function() { - stdoutClosed = true; - handleExit(); - }); - } - - // Capture stderr if specified - if (options.captureStderr) { - stderr = ''; - - ffmpegProc.stderr.on('data', function(data) { - stderr += data; - }); - - ffmpegProc.stderr.on('close', function() { - stderrClosed = true; - handleExit(); - }); - } - - // Call process callback - processCB(ffmpegProc); - }); - }; - - - /** - * 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 - var stdout = null; - var stderr = ''; - self._spawnFfmpeg( - args, - - { niceness: self.options.niceness }, - - function processCB(ffmpegProc) { - 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), stdout, stderr); - 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)); - ffmpegProc.kill(); - }); - } else { - // Gather ffmpeg stdout - stdout = ''; - ffmpegProc.stdout.on('data', function (data) { - stdout += data; - }); - } - - // Process ffmpeg stderr data - self._codecDataSent = false; - ffmpegProc.stderr.on('data', function (data) { - stderr += data; - - if (!self._codecDataSent && self.listeners('codecData').length) { - utils.extractCodecData(self, stderr); - } - - if (self.listeners('progress').length) { - var duration = 0; - - if (self._ffprobeData && self._ffprobeData.format && self._ffprobeData.format.duration) { - duration = Number(self._ffprobeData.format.duration); - } - - utils.extractProgress(self, stderr, duration); - } - }); - }, - - function endCB(err) { - delete self.ffmpegProc; - - if (err) { - if (err.message.match(/ffmpeg exited with code/)) { - // Add ffmpeg error message - err.message += ': ' + utils.extractError(stderr); - } - - emitEnd(err, stdout, stderr); - } 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) { - // No possible error here, getFlvtoolPath was already called by _prepare - 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, stdout, stderr); - } - } - ); - }); - } else { - emitEnd(null, stdout, stderr); - } - } - } - ); - }); - }; - - - /** - * 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/node_modules/fluent-ffmpeg/lib/recipes.js b/node_modules/fluent-ffmpeg/lib/recipes.js deleted file mode 100644 index 6b3ad71..0000000 --- a/node_modules/fluent-ffmpeg/lib/recipes.js +++ /dev/null @@ -1,453 +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)) { - 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/node_modules/fluent-ffmpeg/lib/utils.js b/node_modules/fluent-ffmpeg/lib/utils.js deleted file mode 100644 index dade526..0000000 --- a/node_modules/fluent-ffmpeg/lib/utils.js +++ /dev/null @@ -1,366 +0,0 @@ -/*jshint node:true*/ -'use strict'; - -var exec = require('child_process').exec; -var isWindows = require('os').platform().match(/win(32|64)/); - -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]); - } - - var cmd = 'which ' + name; - if (isWindows) { - cmd = 'where ' + name + '.exe'; - } - - exec(cmd, function(err, stdout) { - if (err) { - // Treat errors as not found - callback(null, whichCache[name] = ''); - } else { - callback(null, whichCache[name] = stdout.trim()); - } - }); - }, - - - /** - * 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 - * - * @param {FfmpegCommand} command event emitter - * @param {String} stderr ffmpeg stderr output - * @private - */ - extractCodecData: function(command, stderr) { - var format= /Input #[0-9]+, ([^ ]+),/.exec(stderr); - var dur = /Duration\: ([^,]+)/.exec(stderr); - var audio = /Audio\: (.*)/.exec(stderr); - var video = /Video\: (.*)/.exec(stderr); - var codecObject = { format: '', audio: '', video: '', duration: '' }; - - if (format && format.length > 1) { - codecObject.format = format[1]; - } - - if (dur && dur.length > 1) { - codecObject.duration = dur[1]; - } - - if (audio && audio.length > 1) { - audio = audio[1].split(', '); - codecObject.audio = audio[0]; - codecObject.audio_details = audio; - } - if (video && video.length > 1) { - video = video[1].split(', '); - codecObject.video = video[0]; - codecObject.video_details = video; - } - - var codecInfoPassed = /Press (\[q\]|ctrl-c) to stop/.test(stderr); - if (codecInfoPassed) { - command.emit('codecData', codecObject); - command._codecDataSent = true; - } - }, - - - /** - * Extract progress data from ffmpeg stderr and emit 'progress' event if appropriate - * - * @param {FfmpegCommand} command event emitter - * @param {String} stderr ffmpeg stderr data - * @param {Number} [duration=0] expected output duration in seconds - * @private - */ - extractProgress: function(command, stderr, duration) { - var lines = stderr.split(nlRegexp); - var lastline = lines[lines.length - 2]; - var progress; - - if (lastline) { - progress = parseProgressLine(lastline); - } - - if (progress) { - // build progress report object - var ret = { - frames: parseInt(progress.frame, 10), - currentFps: parseInt(progress.fps, 10), - currentKbps: parseFloat(progress.bitrate.replace('kbits/s', '')), - 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'); - } -}; diff --git a/node_modules/fluent-ffmpeg/node_modules/async/CHANGELOG.md b/node_modules/fluent-ffmpeg/node_modules/async/CHANGELOG.md deleted file mode 100644 index f15e081..0000000 --- a/node_modules/fluent-ffmpeg/node_modules/async/CHANGELOG.md +++ /dev/null @@ -1,125 +0,0 @@ -# v1.5.2 -- Allow using `"consructor"` as an argument in `memoize` (#998) -- Give a better error messsage when `auto` dependency checking fails (#994) -- Various doc updates (#936, #956, #979, #1002) - -# v1.5.1 -- Fix issue with `pause` in `queue` with concurrency enabled (#946) -- `while` and `until` now pass the final result to callback (#963) -- `auto` will properly handle concurrency when there is no callback (#966) -- `auto` will now properly stop execution when an error occurs (#988, #993) -- Various doc fixes (#971, #980) - -# v1.5.0 - -- Added `transform`, analogous to [`_.transform`](http://lodash.com/docs#transform) (#892) -- `map` now returns an object when an object is passed in, rather than array with non-numeric keys. `map` will begin always returning an array with numeric indexes in the next major release. (#873) -- `auto` now accepts an optional `concurrency` argument to limit the number of running tasks (#637) -- Added `queue#workersList()`, to retrieve the list of currently running tasks. (#891) -- Various code simplifications (#896, #904) -- Various doc fixes :scroll: (#890, #894, #903, #905, #912) - -# v1.4.2 - -- Ensure coverage files don't get published on npm (#879) - -# v1.4.1 - -- Add in overlooked `detectLimit` method (#866) -- Removed unnecessary files from npm releases (#861) -- Removed usage of a reserved word to prevent :boom: in older environments (#870) - -# v1.4.0 - -- `asyncify` now supports promises (#840) -- Added `Limit` versions of `filter` and `reject` (#836) -- Add `Limit` versions of `detect`, `some` and `every` (#828, #829) -- `some`, `every` and `detect` now short circuit early (#828, #829) -- Improve detection of the global object (#804), enabling use in WebWorkers -- `whilst` now called with arguments from iterator (#823) -- `during` now gets called with arguments from iterator (#824) -- Code simplifications and optimizations aplenty ([diff](https://github.com/caolan/async/compare/v1.3.0...v1.4.0)) - - -# v1.3.0 - -New Features: -- Added `constant` -- Added `asyncify`/`wrapSync` for making sync functions work with callbacks. (#671, #806) -- Added `during` and `doDuring`, which are like `whilst` with an async truth test. (#800) -- `retry` now accepts an `interval` parameter to specify a delay between retries. (#793) -- `async` should work better in Web Workers due to better `root` detection (#804) -- Callbacks are now optional in `whilst`, `doWhilst`, `until`, and `doUntil` (#642) -- Various internal updates (#786, #801, #802, #803) -- Various doc fixes (#790, #794) - -Bug Fixes: -- `cargo` now exposes the `payload` size, and `cargo.payload` can be changed on the fly after the `cargo` is created. (#740, #744, #783) - - -# v1.2.1 - -Bug Fix: - -- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. (#782) - - -# v1.2.0 - -New Features: - -- Added `timesLimit` (#743) -- `concurrency` can be changed after initialization in `queue` by setting `q.concurrency`. The new concurrency will be reflected the next time a task is processed. (#747, #772) - -Bug Fixes: - -- Fixed a regression in `each` and family with empty arrays that have additional properties. (#775, #777) - - -# v1.1.1 - -Bug Fix: - -- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. (#782) - - -# v1.1.0 - -New Features: - -- `cargo` now supports all of the same methods and event callbacks as `queue`. -- Added `ensureAsync` - A wrapper that ensures an async function calls its callback on a later tick. (#769) -- Optimized `map`, `eachOf`, and `waterfall` families of functions -- Passing a `null` or `undefined` array to `map`, `each`, `parallel` and families will be treated as an empty array (#667). -- The callback is now optional for the composed results of `compose` and `seq`. (#618) -- Reduced file size by 4kb, (minified version by 1kb) -- Added code coverage through `nyc` and `coveralls` (#768) - -Bug Fixes: - -- `forever` will no longer stack overflow with a synchronous iterator (#622) -- `eachLimit` and other limit functions will stop iterating once an error occurs (#754) -- Always pass `null` in callbacks when there is no error (#439) -- Ensure proper conditions when calling `drain()` after pushing an empty data set to a queue (#668) -- `each` and family will properly handle an empty array (#578) -- `eachSeries` and family will finish if the underlying array is modified during execution (#557) -- `queue` will throw if a non-function is passed to `q.push()` (#593) -- Doc fixes (#629, #766) - - -# v1.0.0 - -No known breaking changes, we are simply complying with semver from here on out. - -Changes: - -- Start using a changelog! -- Add `forEachOf` for iterating over Objects (or to iterate Arrays with indexes available) (#168 #704 #321) -- Detect deadlocks in `auto` (#663) -- Better support for require.js (#527) -- Throw if queue created with concurrency `0` (#714) -- Fix unneeded iteration in `queue.resume()` (#758) -- Guard against timer mocking overriding `setImmediate` (#609 #611) -- Miscellaneous doc fixes (#542 #596 #615 #628 #631 #690 #729) -- Use single noop function internally (#546) -- Optimize internal `_each`, `_map` and `_keys` functions. diff --git a/node_modules/fluent-ffmpeg/node_modules/async/LICENSE b/node_modules/fluent-ffmpeg/node_modules/async/LICENSE deleted file mode 100644 index 8f29698..0000000 --- a/node_modules/fluent-ffmpeg/node_modules/async/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010-2014 Caolan McMahon - -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. diff --git a/node_modules/fluent-ffmpeg/node_modules/async/README.md b/node_modules/fluent-ffmpeg/node_modules/async/README.md deleted file mode 100644 index 316c405..0000000 --- a/node_modules/fluent-ffmpeg/node_modules/async/README.md +++ /dev/null @@ -1,1877 +0,0 @@ -# Async.js - -[![Build Status via Travis CI](https://travis-ci.org/caolan/async.svg?branch=master)](https://travis-ci.org/caolan/async) -[![NPM version](http://img.shields.io/npm/v/async.svg)](https://www.npmjs.org/package/async) -[![Coverage Status](https://coveralls.io/repos/caolan/async/badge.svg?branch=master)](https://coveralls.io/r/caolan/async?branch=master) -[![Join the chat at https://gitter.im/caolan/async](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/caolan/async?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - - -Async is a utility module which provides straight-forward, powerful functions -for working with asynchronous JavaScript. Although originally designed for -use with [Node.js](http://nodejs.org) and installable via `npm install async`, -it can also be used directly in the browser. - -Async is also installable via: - -- [bower](http://bower.io/): `bower install async` -- [component](https://github.com/component/component): `component install - caolan/async` -- [jam](http://jamjs.org/): `jam install async` -- [spm](http://spmjs.io/): `spm install async` - -Async provides around 20 functions that include the usual 'functional' -suspects (`map`, `reduce`, `filter`, `each`…) as well as some common patterns -for asynchronous control flow (`parallel`, `series`, `waterfall`…). All these -functions assume you follow the Node.js convention of providing a single -callback as the last argument of your `async` function. - - -## Quick Examples - -```javascript -async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file -}); - -async.filter(['file1','file2','file3'], fs.exists, function(results){ - // results now equals an array of the existing files -}); - -async.parallel([ - function(){ ... }, - function(){ ... } -], callback); - -async.series([ - function(){ ... }, - function(){ ... } -]); -``` - -There are many more functions available so take a look at the docs below for a -full list. This module aims to be comprehensive, so if you feel anything is -missing please create a GitHub issue for it. - -## Common Pitfalls [(StackOverflow)](http://stackoverflow.com/questions/tagged/async.js) -### Synchronous iteration functions - -If you get an error like `RangeError: Maximum call stack size exceeded.` or other stack overflow issues when using async, you are likely using a synchronous iterator. By *synchronous* we mean a function that calls its callback on the same tick in the javascript event loop, without doing any I/O or using any timers. Calling many callbacks iteratively will quickly overflow the stack. If you run into this issue, just defer your callback with `async.setImmediate` to start a new call stack on the next tick of the event loop. - -This can also arise by accident if you callback early in certain cases: - -```js -async.eachSeries(hugeArray, function iterator(item, callback) { - if (inCache(item)) { - callback(null, cache[item]); // if many items are cached, you'll overflow - } else { - doSomeIO(item, callback); - } -}, function done() { - //... -}); -``` - -Just change it to: - -```js -async.eachSeries(hugeArray, function iterator(item, callback) { - if (inCache(item)) { - async.setImmediate(function () { - callback(null, cache[item]); - }); - } else { - doSomeIO(item, callback); - //... -``` - -Async guards against synchronous functions in some, but not all, cases. If you are still running into stack overflows, you can defer as suggested above, or wrap functions with [`async.ensureAsync`](#ensureAsync) Functions that are asynchronous by their nature do not have this problem and don't need the extra callback deferral. - -If JavaScript's event loop is still a bit nebulous, check out [this article](http://blog.carbonfive.com/2013/10/27/the-javascript-event-loop-explained/) or [this talk](http://2014.jsconf.eu/speakers/philip-roberts-what-the-heck-is-the-event-loop-anyway.html) for more detailed information about how it works. - - -### Multiple callbacks - -Make sure to always `return` when calling a callback early, otherwise you will cause multiple callbacks and unpredictable behavior in many cases. - -```js -async.waterfall([ - function (callback) { - getSomething(options, function (err, result) { - if (err) { - callback(new Error("failed getting something:" + err.message)); - // we should return here - } - // since we did not return, this callback still will be called and - // `processData` will be called twice - callback(null, result); - }); - }, - processData -], done) -``` - -It is always good practice to `return callback(err, result)` whenever a callback call is not the last statement of a function. - - -### Binding a context to an iterator - -This section is really about `bind`, not about `async`. If you are wondering how to -make `async` execute your iterators in a given context, or are confused as to why -a method of another library isn't working as an iterator, study this example: - -```js -// Here is a simple object with an (unnecessarily roundabout) squaring method -var AsyncSquaringLibrary = { - squareExponent: 2, - square: function(number, callback){ - var result = Math.pow(number, this.squareExponent); - setTimeout(function(){ - callback(null, result); - }, 200); - } -}; - -async.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){ - // result is [NaN, NaN, NaN] - // This fails because the `this.squareExponent` expression in the square - // function is not evaluated in the context of AsyncSquaringLibrary, and is - // therefore undefined. -}); - -async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){ - // result is [1, 4, 9] - // With the help of bind we can attach a context to the iterator before - // passing it to async. Now the square function will be executed in its - // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent` - // will be as expected. -}); -``` - -## Download - -The source is available for download from -[GitHub](https://github.com/caolan/async/blob/master/lib/async.js). -Alternatively, you can install using Node Package Manager (`npm`): - - npm install async - -As well as using Bower: - - bower install async - -__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed - -## In the Browser - -So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. - -Usage: - -```html - - -``` - -## Documentation - -Some functions are also available in the following forms: -* `Series` - the same as `` but runs only a single async operation at a time -* `Limit` - the same as `` but runs a maximum of `limit` async operations at a time - -### Collections - -* [`each`](#each), `eachSeries`, `eachLimit` -* [`forEachOf`](#forEachOf), `forEachOfSeries`, `forEachOfLimit` -* [`map`](#map), `mapSeries`, `mapLimit` -* [`filter`](#filter), `filterSeries`, `filterLimit` -* [`reject`](#reject), `rejectSeries`, `rejectLimit` -* [`reduce`](#reduce), [`reduceRight`](#reduceRight) -* [`detect`](#detect), `detectSeries`, `detectLimit` -* [`sortBy`](#sortBy) -* [`some`](#some), `someLimit` -* [`every`](#every), `everyLimit` -* [`concat`](#concat), `concatSeries` - -### Control Flow - -* [`series`](#seriestasks-callback) -* [`parallel`](#parallel), `parallelLimit` -* [`whilst`](#whilst), [`doWhilst`](#doWhilst) -* [`until`](#until), [`doUntil`](#doUntil) -* [`during`](#during), [`doDuring`](#doDuring) -* [`forever`](#forever) -* [`waterfall`](#waterfall) -* [`compose`](#compose) -* [`seq`](#seq) -* [`applyEach`](#applyEach), `applyEachSeries` -* [`queue`](#queue), [`priorityQueue`](#priorityQueue) -* [`cargo`](#cargo) -* [`auto`](#auto) -* [`retry`](#retry) -* [`iterator`](#iterator) -* [`times`](#times), `timesSeries`, `timesLimit` - -### Utils - -* [`apply`](#apply) -* [`nextTick`](#nextTick) -* [`memoize`](#memoize) -* [`unmemoize`](#unmemoize) -* [`ensureAsync`](#ensureAsync) -* [`constant`](#constant) -* [`asyncify`](#asyncify) -* [`wrapSync`](#wrapSync) -* [`log`](#log) -* [`dir`](#dir) -* [`noConflict`](#noConflict) - -## Collections - - - -### each(arr, iterator, [callback]) - -Applies the function `iterator` to each item in `arr`, in parallel. -The `iterator` is called with an item from the list, and a callback for when it -has finished. If the `iterator` passes an error to its `callback`, the main -`callback` (for the `each` function) is immediately called with the error. - -Note, that since this function applies `iterator` to each item in parallel, -there is no guarantee that the iterator functions will complete in order. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err)` which must be called once it has - completed. If no error has occurred, the `callback` should be run without - arguments or with an explicit `null` argument. The array index is not passed - to the iterator. If you need the index, use [`forEachOf`](#forEachOf). -* `callback(err)` - *Optional* A callback which is called when all `iterator` functions - have finished, or an error occurs. - -__Examples__ - - -```js -// assuming openFiles is an array of file names and saveFile is a function -// to save the modified contents of that file: - -async.each(openFiles, saveFile, function(err){ - // if any of the saves produced an error, err would equal that error -}); -``` - -```js -// assuming openFiles is an array of file names - -async.each(openFiles, function(file, callback) { - - // Perform operation on file here. - console.log('Processing file ' + file); - - if( file.length > 32 ) { - console.log('This file name is too long'); - callback('File name too long'); - } else { - // Do work to process file here - console.log('File processed'); - callback(); - } -}, function(err){ - // if any of the file processing produced an error, err would equal that error - if( err ) { - // One of the iterations produced an error. - // All processing will now stop. - console.log('A file failed to process'); - } else { - console.log('All files have been processed successfully'); - } -}); -``` - -__Related__ - -* eachSeries(arr, iterator, [callback]) -* eachLimit(arr, limit, iterator, [callback]) - ---------------------------------------- - - - - -### forEachOf(obj, iterator, [callback]) - -Like `each`, except that it iterates over objects, and passes the key as the second argument to the iterator. - -__Arguments__ - -* `obj` - An object or array to iterate over. -* `iterator(item, key, callback)` - A function to apply to each item in `obj`. -The `key` is the item's key, or index in the case of an array. The iterator is -passed a `callback(err)` which must be called once it has completed. If no -error has occurred, the callback should be run without arguments or with an -explicit `null` argument. -* `callback(err)` - *Optional* A callback which is called when all `iterator` functions have finished, or an error occurs. - -__Example__ - -```js -var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; -var configs = {}; - -async.forEachOf(obj, function (value, key, callback) { - fs.readFile(__dirname + value, "utf8", function (err, data) { - if (err) return callback(err); - try { - configs[key] = JSON.parse(data); - } catch (e) { - return callback(e); - } - callback(); - }) -}, function (err) { - if (err) console.error(err.message); - // configs is now a map of JSON data - doSomethingWith(configs); -}) -``` - -__Related__ - -* forEachOfSeries(obj, iterator, [callback]) -* forEachOfLimit(obj, limit, iterator, [callback]) - ---------------------------------------- - - -### map(arr, iterator, [callback]) - -Produces a new array of values by mapping each value in `arr` through -the `iterator` function. The `iterator` is called with an item from `arr` and a -callback for when it has finished processing. Each of these callback takes 2 arguments: -an `error`, and the transformed item from `arr`. If `iterator` passes an error to its -callback, the main `callback` (for the `map` function) is immediately called with the error. - -Note, that since this function applies the `iterator` to each item in parallel, -there is no guarantee that the `iterator` functions will complete in order. -However, the results array will be in the same order as the original `arr`. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, transformed)` which must be called once - it has completed with an error (which can be `null`) and a transformed item. -* `callback(err, results)` - *Optional* A callback which is called when all `iterator` - functions have finished, or an error occurs. Results is an array of the - transformed items from the `arr`. - -__Example__ - -```js -async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file -}); -``` - -__Related__ -* mapSeries(arr, iterator, [callback]) -* mapLimit(arr, limit, iterator, [callback]) - ---------------------------------------- - - - -### filter(arr, iterator, [callback]) - -__Alias:__ `select` - -Returns a new array of all the values in `arr` which pass an async truth test. -_The callback for each `iterator` call only accepts a single argument of `true` or -`false`; it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like `fs.exists`. This operation is -performed in parallel, but the results array will be in the same order as the -original. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in `arr`. - The `iterator` is passed a `callback(truthValue)`, which must be called with a - boolean argument once it has completed. -* `callback(results)` - *Optional* A callback which is called after all the `iterator` - functions have finished. - -__Example__ - -```js -async.filter(['file1','file2','file3'], fs.exists, function(results){ - // results now equals an array of the existing files -}); -``` - -__Related__ - -* filterSeries(arr, iterator, [callback]) -* filterLimit(arr, limit, iterator, [callback]) - ---------------------------------------- - - -### reject(arr, iterator, [callback]) - -The opposite of [`filter`](#filter). Removes values that pass an `async` truth test. - -__Related__ - -* rejectSeries(arr, iterator, [callback]) -* rejectLimit(arr, limit, iterator, [callback]) - ---------------------------------------- - - -### reduce(arr, memo, iterator, [callback]) - -__Aliases:__ `inject`, `foldl` - -Reduces `arr` into a single value using an async `iterator` to return -each successive step. `memo` is the initial state of the reduction. -This function only operates in series. - -For performance reasons, it may make sense to split a call to this function into -a parallel map, and then use the normal `Array.prototype.reduce` on the results. -This function is for situations where each step in the reduction needs to be async; -if you can get the data before reducing it, then it's probably a good idea to do so. - -__Arguments__ - -* `arr` - An array to iterate over. -* `memo` - The initial state of the reduction. -* `iterator(memo, item, callback)` - A function applied to each item in the - array to produce the next step in the reduction. The `iterator` is passed a - `callback(err, reduction)` which accepts an optional error as its first - argument, and the state of the reduction as the second. If an error is - passed to the callback, the reduction is stopped and the main `callback` is - immediately called with the error. -* `callback(err, result)` - *Optional* A callback which is called after all the `iterator` - functions have finished. Result is the reduced value. - -__Example__ - -```js -async.reduce([1,2,3], 0, function(memo, item, callback){ - // pointless async: - process.nextTick(function(){ - callback(null, memo + item) - }); -}, function(err, result){ - // result is now equal to the last value of memo, which is 6 -}); -``` - ---------------------------------------- - - -### reduceRight(arr, memo, iterator, [callback]) - -__Alias:__ `foldr` - -Same as [`reduce`](#reduce), only operates on `arr` in reverse order. - - ---------------------------------------- - - -### detect(arr, iterator, [callback]) - -Returns the first value in `arr` that passes an async truth test. The -`iterator` is applied in parallel, meaning the first iterator to return `true` will -fire the detect `callback` with that result. That means the result might not be -the first item in the original `arr` (in terms of order) that passes the test. - -If order within the original `arr` is important, then look at [`detectSeries`](#detectSeries). - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in `arr`. - The iterator is passed a `callback(truthValue)` which must be called with a - boolean argument once it has completed. **Note: this callback does not take an error as its first argument.** -* `callback(result)` - *Optional* A callback which is called as soon as any iterator returns - `true`, or after all the `iterator` functions have finished. Result will be - the first item in the array that passes the truth test (iterator) or the - value `undefined` if none passed. **Note: this callback does not take an error as its first argument.** - -__Example__ - -```js -async.detect(['file1','file2','file3'], fs.exists, function(result){ - // result now equals the first file in the list that exists -}); -``` - -__Related__ - -* detectSeries(arr, iterator, [callback]) -* detectLimit(arr, limit, iterator, [callback]) - ---------------------------------------- - - -### sortBy(arr, iterator, [callback]) - -Sorts a list by the results of running each `arr` value through an async `iterator`. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, sortValue)` which must be called once it - has completed with an error (which can be `null`) and a value to use as the sort - criteria. -* `callback(err, results)` - *Optional* A callback which is called after all the `iterator` - functions have finished, or an error occurs. Results is the items from - the original `arr` sorted by the values returned by the `iterator` calls. - -__Example__ - -```js -async.sortBy(['file1','file2','file3'], function(file, callback){ - fs.stat(file, function(err, stats){ - callback(err, stats.mtime); - }); -}, function(err, results){ - // results is now the original array of files sorted by - // modified date -}); -``` - -__Sort Order__ - -By modifying the callback parameter the sorting order can be influenced: - -```js -//ascending order -async.sortBy([1,9,3,5], function(x, callback){ - callback(null, x); -}, function(err,result){ - //result callback -} ); - -//descending order -async.sortBy([1,9,3,5], function(x, callback){ - callback(null, x*-1); //<- x*-1 instead of x, turns the order around -}, function(err,result){ - //result callback -} ); -``` - ---------------------------------------- - - -### some(arr, iterator, [callback]) - -__Alias:__ `any` - -Returns `true` if at least one element in the `arr` satisfies an async test. -_The callback for each iterator call only accepts a single argument of `true` or -`false`; it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like `fs.exists`. Once any iterator -call returns `true`, the main `callback` is immediately called. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in the array - in parallel. The iterator is passed a `callback(truthValue)`` which must be - called with a boolean argument once it has completed. -* `callback(result)` - *Optional* A callback which is called as soon as any iterator returns - `true`, or after all the iterator functions have finished. Result will be - either `true` or `false` depending on the values of the async tests. - - **Note: the callbacks do not take an error as their first argument.** -__Example__ - -```js -async.some(['file1','file2','file3'], fs.exists, function(result){ - // if result is true then at least one of the files exists -}); -``` - -__Related__ - -* someLimit(arr, limit, iterator, callback) - ---------------------------------------- - - -### every(arr, iterator, [callback]) - -__Alias:__ `all` - -Returns `true` if every element in `arr` satisfies an async test. -_The callback for each `iterator` call only accepts a single argument of `true` or -`false`; it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like `fs.exists`. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in the array - in parallel. The iterator is passed a `callback(truthValue)` which must be - called with a boolean argument once it has completed. -* `callback(result)` - *Optional* A callback which is called as soon as any iterator returns - `false`, or after all the iterator functions have finished. Result will be - either `true` or `false` depending on the values of the async tests. - - **Note: the callbacks do not take an error as their first argument.** - -__Example__ - -```js -async.every(['file1','file2','file3'], fs.exists, function(result){ - // if result is true then every file exists -}); -``` - -__Related__ - -* everyLimit(arr, limit, iterator, callback) - ---------------------------------------- - - -### concat(arr, iterator, [callback]) - -Applies `iterator` to each item in `arr`, concatenating the results. Returns the -concatenated list. The `iterator`s are called in parallel, and the results are -concatenated as they return. There is no guarantee that the results array will -be returned in the original order of `arr` passed to the `iterator` function. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, results)` which must be called once it - has completed with an error (which can be `null`) and an array of results. -* `callback(err, results)` - *Optional* A callback which is called after all the `iterator` - functions have finished, or an error occurs. Results is an array containing - the concatenated results of the `iterator` function. - -__Example__ - -```js -async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){ - // files is now a list of filenames that exist in the 3 directories -}); -``` - -__Related__ - -* concatSeries(arr, iterator, [callback]) - - -## Control Flow - - -### series(tasks, [callback]) - -Run the functions in the `tasks` array in series, each one running once the previous -function has completed. If any functions in the series pass an error to its -callback, no more functions are run, and `callback` is immediately called with the value of the error. -Otherwise, `callback` receives an array of results when `tasks` have completed. - -It is also possible to use an object instead of an array. Each property will be -run as a function, and the results will be passed to the final `callback` as an object -instead of an array. This can be a more readable way of handling results from -[`series`](#series). - -**Note** that while many implementations preserve the order of object properties, the -[ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6) -explicitly states that - -> The mechanics and order of enumerating the properties is not specified. - -So if you rely on the order in which your series of functions are executed, and want -this to work on all platforms, consider using an array. - -__Arguments__ - -* `tasks` - An array or object containing functions to run, each function is passed - a `callback(err, result)` it must call on completion with an error `err` (which can - be `null`) and an optional `result` value. -* `callback(err, results)` - An optional callback to run once all the functions - have completed. This function gets a results array (or object) containing all - the result arguments passed to the `task` callbacks. - -__Example__ - -```js -async.series([ - function(callback){ - // do some stuff ... - callback(null, 'one'); - }, - function(callback){ - // do some more stuff ... - callback(null, 'two'); - } -], -// optional callback -function(err, results){ - // results is now equal to ['one', 'two'] -}); - - -// an example using an object instead of an array -async.series({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - } -}, -function(err, results) { - // results is now equal to: {one: 1, two: 2} -}); -``` - ---------------------------------------- - - -### parallel(tasks, [callback]) - -Run the `tasks` array of functions in parallel, without waiting until the previous -function has completed. If any of the functions pass an error to its -callback, the main `callback` is immediately called with the value of the error. -Once the `tasks` have completed, the results are passed to the final `callback` as an -array. - -**Note:** `parallel` is about kicking-off I/O tasks in parallel, not about parallel execution of code. If your tasks do not use any timers or perform any I/O, they will actually be executed in series. Any synchronous setup sections for each task will happen one after the other. JavaScript remains single-threaded. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final `callback` as an object -instead of an array. This can be a more readable way of handling results from -[`parallel`](#parallel). - - -__Arguments__ - -* `tasks` - An array or object containing functions to run. Each function is passed - a `callback(err, result)` which it must call on completion with an error `err` - (which can be `null`) and an optional `result` value. -* `callback(err, results)` - An optional callback to run once all the functions - have completed successfully. This function gets a results array (or object) containing all - the result arguments passed to the task callbacks. - -__Example__ - -```js -async.parallel([ - function(callback){ - setTimeout(function(){ - callback(null, 'one'); - }, 200); - }, - function(callback){ - setTimeout(function(){ - callback(null, 'two'); - }, 100); - } -], -// optional callback -function(err, results){ - // the results array will equal ['one','two'] even though - // the second function had a shorter timeout. -}); - - -// an example using an object instead of an array -async.parallel({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - } -}, -function(err, results) { - // results is now equals to: {one: 1, two: 2} -}); -``` - -__Related__ - -* parallelLimit(tasks, limit, [callback]) - ---------------------------------------- - - -### whilst(test, fn, callback) - -Repeatedly call `fn`, while `test` returns `true`. Calls `callback` when stopped, -or an error occurs. - -__Arguments__ - -* `test()` - synchronous truth test to perform before each execution of `fn`. -* `fn(callback)` - A function which is called each time `test` passes. The function is - passed a `callback(err)`, which must be called once it has completed with an - optional `err` argument. -* `callback(err, [results])` - A callback which is called after the test - function has failed and repeated execution of `fn` has stopped. `callback` - will be passed an error and any arguments passed to the final `fn`'s callback. - -__Example__ - -```js -var count = 0; - -async.whilst( - function () { return count < 5; }, - function (callback) { - count++; - setTimeout(function () { - callback(null, count); - }, 1000); - }, - function (err, n) { - // 5 seconds have passed, n = 5 - } -); -``` - ---------------------------------------- - - -### doWhilst(fn, test, callback) - -The post-check version of [`whilst`](#whilst). To reflect the difference in -the order of operations, the arguments `test` and `fn` are switched. - -`doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. - ---------------------------------------- - - -### until(test, fn, callback) - -Repeatedly call `fn` until `test` returns `true`. Calls `callback` when stopped, -or an error occurs. `callback` will be passed an error and any arguments passed -to the final `fn`'s callback. - -The inverse of [`whilst`](#whilst). - ---------------------------------------- - - -### doUntil(fn, test, callback) - -Like [`doWhilst`](#doWhilst), except the `test` is inverted. Note the argument ordering differs from `until`. - ---------------------------------------- - - -### during(test, fn, callback) - -Like [`whilst`](#whilst), except the `test` is an asynchronous function that is passed a callback in the form of `function (err, truth)`. If error is passed to `test` or `fn`, the main callback is immediately called with the value of the error. - -__Example__ - -```js -var count = 0; - -async.during( - function (callback) { - return callback(null, count < 5); - }, - function (callback) { - count++; - setTimeout(callback, 1000); - }, - function (err) { - // 5 seconds have passed - } -); -``` - ---------------------------------------- - - -### doDuring(fn, test, callback) - -The post-check version of [`during`](#during). To reflect the difference in -the order of operations, the arguments `test` and `fn` are switched. - -Also a version of [`doWhilst`](#doWhilst) with asynchronous `test` function. - ---------------------------------------- - - -### forever(fn, [errback]) - -Calls the asynchronous function `fn` with a callback parameter that allows it to -call itself again, in series, indefinitely. - -If an error is passed to the callback then `errback` is called with the -error, and execution stops, otherwise it will never be called. - -```js -async.forever( - function(next) { - // next is suitable for passing to things that need a callback(err [, whatever]); - // it will result in this function being called again. - }, - function(err) { - // if next is called with a value in its first parameter, it will appear - // in here as 'err', and execution will stop. - } -); -``` - ---------------------------------------- - - -### waterfall(tasks, [callback]) - -Runs the `tasks` array of functions in series, each passing their results to the next in -the array. However, if any of the `tasks` pass an error to their own callback, the -next function is not executed, and the main `callback` is immediately called with -the error. - -__Arguments__ - -* `tasks` - An array of functions to run, each function is passed a - `callback(err, result1, result2, ...)` it must call on completion. The first - argument is an error (which can be `null`) and any further arguments will be - passed as arguments in order to the next task. -* `callback(err, [results])` - An optional callback to run once all the functions - have completed. This will be passed the results of the last task's callback. - - - -__Example__ - -```js -async.waterfall([ - function(callback) { - callback(null, 'one', 'two'); - }, - function(arg1, arg2, callback) { - // arg1 now equals 'one' and arg2 now equals 'two' - callback(null, 'three'); - }, - function(arg1, callback) { - // arg1 now equals 'three' - callback(null, 'done'); - } -], function (err, result) { - // result now equals 'done' -}); -``` -Or, with named functions: - -```js -async.waterfall([ - myFirstFunction, - mySecondFunction, - myLastFunction, -], function (err, result) { - // result now equals 'done' -}); -function myFirstFunction(callback) { - callback(null, 'one', 'two'); -} -function mySecondFunction(arg1, arg2, callback) { - // arg1 now equals 'one' and arg2 now equals 'two' - callback(null, 'three'); -} -function myLastFunction(arg1, callback) { - // arg1 now equals 'three' - callback(null, 'done'); -} -``` - -Or, if you need to pass any argument to the first function: - -```js -async.waterfall([ - async.apply(myFirstFunction, 'zero'), - mySecondFunction, - myLastFunction, -], function (err, result) { - // result now equals 'done' -}); -function myFirstFunction(arg1, callback) { - // arg1 now equals 'zero' - callback(null, 'one', 'two'); -} -function mySecondFunction(arg1, arg2, callback) { - // arg1 now equals 'one' and arg2 now equals 'two' - callback(null, 'three'); -} -function myLastFunction(arg1, callback) { - // arg1 now equals 'three' - callback(null, 'done'); -} -``` - ---------------------------------------- - -### compose(fn1, fn2...) - -Creates a function which is a composition of the passed asynchronous -functions. Each function consumes the return value of the function that -follows. Composing functions `f()`, `g()`, and `h()` would produce the result of -`f(g(h()))`, only this version uses callbacks to obtain the return values. - -Each function is executed with the `this` binding of the composed function. - -__Arguments__ - -* `functions...` - the asynchronous functions to compose - - -__Example__ - -```js -function add1(n, callback) { - setTimeout(function () { - callback(null, n + 1); - }, 10); -} - -function mul3(n, callback) { - setTimeout(function () { - callback(null, n * 3); - }, 10); -} - -var add1mul3 = async.compose(mul3, add1); - -add1mul3(4, function (err, result) { - // result now equals 15 -}); -``` - ---------------------------------------- - -### seq(fn1, fn2...) - -Version of the compose function that is more natural to read. -Each function consumes the return value of the previous function. -It is the equivalent of [`compose`](#compose) with the arguments reversed. - -Each function is executed with the `this` binding of the composed function. - -__Arguments__ - -* `functions...` - the asynchronous functions to compose - - -__Example__ - -```js -// Requires lodash (or underscore), express3 and dresende's orm2. -// Part of an app, that fetches cats of the logged user. -// This example uses `seq` function to avoid overnesting and error -// handling clutter. -app.get('/cats', function(request, response) { - var User = request.models.User; - async.seq( - _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data)) - function(user, fn) { - user.getCats(fn); // 'getCats' has signature (callback(err, data)) - } - )(req.session.user_id, function (err, cats) { - if (err) { - console.error(err); - response.json({ status: 'error', message: err.message }); - } else { - response.json({ status: 'ok', message: 'Cats found', data: cats }); - } - }); -}); -``` - ---------------------------------------- - -### applyEach(fns, args..., callback) - -Applies the provided arguments to each function in the array, calling -`callback` after all functions have completed. If you only provide the first -argument, then it will return a function which lets you pass in the -arguments as if it were a single function call. - -__Arguments__ - -* `fns` - the asynchronous functions to all call with the same arguments -* `args...` - any number of separate arguments to pass to the function -* `callback` - the final argument should be the callback, called when all - functions have completed processing - - -__Example__ - -```js -async.applyEach([enableSearch, updateSchema], 'bucket', callback); - -// partial application example: -async.each( - buckets, - async.applyEach([enableSearch, updateSchema]), - callback -); -``` - -__Related__ - -* applyEachSeries(tasks, args..., [callback]) - ---------------------------------------- - - -### queue(worker, [concurrency]) - -Creates a `queue` object with the specified `concurrency`. Tasks added to the -`queue` are processed in parallel (up to the `concurrency` limit). If all -`worker`s are in progress, the task is queued until one becomes available. -Once a `worker` completes a `task`, that `task`'s callback is called. - -__Arguments__ - -* `worker(task, callback)` - An asynchronous function for processing a queued - task, which must call its `callback(err)` argument when finished, with an - optional `error` as an argument. If you want to handle errors from an individual task, pass a callback to `q.push()`. -* `concurrency` - An `integer` for determining how many `worker` functions should be - run in parallel. If omitted, the concurrency defaults to `1`. If the concurrency is `0`, an error is thrown. - -__Queue objects__ - -The `queue` object returned by this function has the following properties and -methods: - -* `length()` - a function returning the number of items waiting to be processed. -* `started` - a function returning whether or not any items have been pushed and processed by the queue -* `running()` - a function returning the number of items currently being processed. -* `workersList()` - a function returning the array of items currently being processed. -* `idle()` - a function returning false if there are items waiting or being processed, or true if not. -* `concurrency` - an integer for determining how many `worker` functions should be - run in parallel. This property can be changed after a `queue` is created to - alter the concurrency on-the-fly. -* `push(task, [callback])` - add a new task to the `queue`. Calls `callback` once - the `worker` has finished processing the task. Instead of a single task, a `tasks` array - can be submitted. The respective callback is used for every task in the list. -* `unshift(task, [callback])` - add a new task to the front of the `queue`. -* `saturated` - a callback that is called when the `queue` length hits the `concurrency` limit, - and further tasks will be queued. -* `empty` - a callback that is called when the last item from the `queue` is given to a `worker`. -* `drain` - a callback that is called when the last item from the `queue` has returned from the `worker`. -* `paused` - a boolean for determining whether the queue is in a paused state -* `pause()` - a function that pauses the processing of tasks until `resume()` is called. -* `resume()` - a function that resumes the processing of queued tasks when the queue is paused. -* `kill()` - a function that removes the `drain` callback and empties remaining tasks from the queue forcing it to go idle. - -__Example__ - -```js -// create a queue object with concurrency 2 - -var q = async.queue(function (task, callback) { - console.log('hello ' + task.name); - callback(); -}, 2); - - -// assign a callback -q.drain = function() { - console.log('all items have been processed'); -} - -// add some items to the queue - -q.push({name: 'foo'}, function (err) { - console.log('finished processing foo'); -}); -q.push({name: 'bar'}, function (err) { - console.log('finished processing bar'); -}); - -// add some items to the queue (batch-wise) - -q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) { - console.log('finished processing item'); -}); - -// add some items to the front of the queue - -q.unshift({name: 'bar'}, function (err) { - console.log('finished processing bar'); -}); -``` - - ---------------------------------------- - - -### priorityQueue(worker, concurrency) - -The same as [`queue`](#queue) only tasks are assigned a priority and completed in ascending priority order. There are two differences between `queue` and `priorityQueue` objects: - -* `push(task, priority, [callback])` - `priority` should be a number. If an array of - `tasks` is given, all tasks will be assigned the same priority. -* The `unshift` method was removed. - ---------------------------------------- - - -### cargo(worker, [payload]) - -Creates a `cargo` object with the specified payload. Tasks added to the -cargo will be processed altogether (up to the `payload` limit). If the -`worker` is in progress, the task is queued until it becomes available. Once -the `worker` has completed some tasks, each callback of those tasks is called. -Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966) for how `cargo` and `queue` work. - -While [queue](#queue) passes only one task to one of a group of workers -at a time, cargo passes an array of tasks to a single worker, repeating -when the worker is finished. - -__Arguments__ - -* `worker(tasks, callback)` - An asynchronous function for processing an array of - queued tasks, which must call its `callback(err)` argument when finished, with - an optional `err` argument. -* `payload` - An optional `integer` for determining how many tasks should be - processed per round; if omitted, the default is unlimited. - -__Cargo objects__ - -The `cargo` object returned by this function has the following properties and -methods: - -* `length()` - A function returning the number of items waiting to be processed. -* `payload` - An `integer` for determining how many tasks should be - process per round. This property can be changed after a `cargo` is created to - alter the payload on-the-fly. -* `push(task, [callback])` - Adds `task` to the `queue`. The callback is called - once the `worker` has finished processing the task. Instead of a single task, an array of `tasks` - can be submitted. The respective callback is used for every task in the list. -* `saturated` - A callback that is called when the `queue.length()` hits the concurrency and further tasks will be queued. -* `empty` - A callback that is called when the last item from the `queue` is given to a `worker`. -* `drain` - A callback that is called when the last item from the `queue` has returned from the `worker`. -* `idle()`, `pause()`, `resume()`, `kill()` - cargo inherits all of the same methods and event calbacks as [`queue`](#queue) - -__Example__ - -```js -// create a cargo object with payload 2 - -var cargo = async.cargo(function (tasks, callback) { - for(var i=0; i -### auto(tasks, [concurrency], [callback]) - -Determines the best order for running the functions in `tasks`, based on their requirements. Each function can optionally depend on other functions being completed first, and each function is run as soon as its requirements are satisfied. - -If any of the functions pass an error to their callback, the `auto` sequence will stop. Further tasks will not execute (so any other functions depending on it will not run), and the main `callback` is immediately called with the error. Functions also receive an object containing the results of functions which have completed so far. - -Note, all functions are called with a `results` object as a second argument, -so it is unsafe to pass functions in the `tasks` object which cannot handle the -extra argument. - -For example, this snippet of code: - -```js -async.auto({ - readData: async.apply(fs.readFile, 'data.txt', 'utf-8') -}, callback); -``` - -will have the effect of calling `readFile` with the results object as the last -argument, which will fail: - -```js -fs.readFile('data.txt', 'utf-8', cb, {}); -``` - -Instead, wrap the call to `readFile` in a function which does not forward the -`results` object: - -```js -async.auto({ - readData: function(cb, results){ - fs.readFile('data.txt', 'utf-8', cb); - } -}, callback); -``` - -__Arguments__ - -* `tasks` - An object. Each of its properties is either a function or an array of - requirements, with the function itself the last item in the array. The object's key - of a property serves as the name of the task defined by that property, - i.e. can be used when specifying requirements for other tasks. - The function receives two arguments: (1) a `callback(err, result)` which must be - called when finished, passing an `error` (which can be `null`) and the result of - the function's execution, and (2) a `results` object, containing the results of - the previously executed functions. -* `concurrency` - An optional `integer` for determining the maximum number of tasks that can be run in parallel. By default, as many as possible. -* `callback(err, results)` - An optional callback which is called when all the - tasks have been completed. It receives the `err` argument if any `tasks` - pass an error to their callback. Results are always returned; however, if - an error occurs, no further `tasks` will be performed, and the results - object will only contain partial results. - - -__Example__ - -```js -async.auto({ - get_data: function(callback){ - console.log('in get_data'); - // async code to get some data - callback(null, 'data', 'converted to array'); - }, - make_folder: function(callback){ - console.log('in make_folder'); - // async code to create a directory to store a file in - // this is run at the same time as getting the data - callback(null, 'folder'); - }, - write_file: ['get_data', 'make_folder', function(callback, results){ - console.log('in write_file', JSON.stringify(results)); - // once there is some data and the directory exists, - // write the data to a file in the directory - callback(null, 'filename'); - }], - email_link: ['write_file', function(callback, results){ - console.log('in email_link', JSON.stringify(results)); - // once the file is written let's email a link to it... - // results.write_file contains the filename returned by write_file. - callback(null, {'file':results.write_file, 'email':'user@example.com'}); - }] -}, function(err, results) { - console.log('err = ', err); - console.log('results = ', results); -}); -``` - -This is a fairly trivial example, but to do this using the basic parallel and -series functions would look like this: - -```js -async.parallel([ - function(callback){ - console.log('in get_data'); - // async code to get some data - callback(null, 'data', 'converted to array'); - }, - function(callback){ - console.log('in make_folder'); - // async code to create a directory to store a file in - // this is run at the same time as getting the data - callback(null, 'folder'); - } -], -function(err, results){ - async.series([ - function(callback){ - console.log('in write_file', JSON.stringify(results)); - // once there is some data and the directory exists, - // write the data to a file in the directory - results.push('filename'); - callback(null); - }, - function(callback){ - console.log('in email_link', JSON.stringify(results)); - // once the file is written let's email a link to it... - callback(null, {'file':results.pop(), 'email':'user@example.com'}); - } - ]); -}); -``` - -For a complicated series of `async` tasks, using the [`auto`](#auto) function makes adding -new tasks much easier (and the code more readable). - - ---------------------------------------- - - -### retry([opts = {times: 5, interval: 0}| 5], task, [callback]) - -Attempts to get a successful response from `task` no more than `times` times before -returning an error. If the task is successful, the `callback` will be passed the result -of the successful task. If all attempts fail, the callback will be passed the error and -result (if any) of the final attempt. - -__Arguments__ - -* `opts` - Can be either an object with `times` and `interval` or a number. - * `times` - The number of attempts to make before giving up. The default is `5`. - * `interval` - The time to wait between retries, in milliseconds. The default is `0`. - * If `opts` is a number, the number specifies the number of times to retry, with the default interval of `0`. -* `task(callback, results)` - A function which receives two arguments: (1) a `callback(err, result)` - which must be called when finished, passing `err` (which can be `null`) and the `result` of - the function's execution, and (2) a `results` object, containing the results of - the previously executed functions (if nested inside another control flow). -* `callback(err, results)` - An optional callback which is called when the - task has succeeded, or after the final failed attempt. It receives the `err` and `result` arguments of the last attempt at completing the `task`. - -The [`retry`](#retry) function can be used as a stand-alone control flow by passing a callback, as shown below: - -```js -// try calling apiMethod 3 times -async.retry(3, apiMethod, function(err, result) { - // do something with the result -}); -``` - -```js -// try calling apiMethod 3 times, waiting 200 ms between each retry -async.retry({times: 3, interval: 200}, apiMethod, function(err, result) { - // do something with the result -}); -``` - -```js -// try calling apiMethod the default 5 times no delay between each retry -async.retry(apiMethod, function(err, result) { - // do something with the result -}); -``` - -It can also be embedded within other control flow functions to retry individual methods -that are not as reliable, like this: - -```js -async.auto({ - users: api.getUsers.bind(api), - payments: async.retry(3, api.getPayments.bind(api)) -}, function(err, results) { - // do something with the results -}); -``` - - ---------------------------------------- - - -### iterator(tasks) - -Creates an iterator function which calls the next function in the `tasks` array, -returning a continuation to call the next one after that. It's also possible to -“peek” at the next iterator with `iterator.next()`. - -This function is used internally by the `async` module, but can be useful when -you want to manually control the flow of functions in series. - -__Arguments__ - -* `tasks` - An array of functions to run. - -__Example__ - -```js -var iterator = async.iterator([ - function(){ sys.p('one'); }, - function(){ sys.p('two'); }, - function(){ sys.p('three'); } -]); - -node> var iterator2 = iterator(); -'one' -node> var iterator3 = iterator2(); -'two' -node> iterator3(); -'three' -node> var nextfn = iterator2.next(); -node> nextfn(); -'three' -``` - ---------------------------------------- - - -### apply(function, arguments..) - -Creates a continuation function with some arguments already applied. - -Useful as a shorthand when combined with other control flow functions. Any arguments -passed to the returned function are added to the arguments originally passed -to apply. - -__Arguments__ - -* `function` - The function you want to eventually apply all arguments to. -* `arguments...` - Any number of arguments to automatically apply when the - continuation is called. - -__Example__ - -```js -// using apply - -async.parallel([ - async.apply(fs.writeFile, 'testfile1', 'test1'), - async.apply(fs.writeFile, 'testfile2', 'test2'), -]); - - -// the same process without using apply - -async.parallel([ - function(callback){ - fs.writeFile('testfile1', 'test1', callback); - }, - function(callback){ - fs.writeFile('testfile2', 'test2', callback); - } -]); -``` - -It's possible to pass any number of additional arguments when calling the -continuation: - -```js -node> var fn = async.apply(sys.puts, 'one'); -node> fn('two', 'three'); -one -two -three -``` - ---------------------------------------- - - -### nextTick(callback), setImmediate(callback) - -Calls `callback` on a later loop around the event loop. In Node.js this just -calls `process.nextTick`; in the browser it falls back to `setImmediate(callback)` -if available, otherwise `setTimeout(callback, 0)`, which means other higher priority -events may precede the execution of `callback`. - -This is used internally for browser-compatibility purposes. - -__Arguments__ - -* `callback` - The function to call on a later loop around the event loop. - -__Example__ - -```js -var call_order = []; -async.nextTick(function(){ - call_order.push('two'); - // call_order now equals ['one','two'] -}); -call_order.push('one') -``` - - -### times(n, iterator, [callback]) - -Calls the `iterator` function `n` times, and accumulates results in the same manner -you would use with [`map`](#map). - -__Arguments__ - -* `n` - The number of times to run the function. -* `iterator` - The function to call `n` times. -* `callback` - see [`map`](#map) - -__Example__ - -```js -// Pretend this is some complicated async factory -var createUser = function(id, callback) { - callback(null, { - id: 'user' + id - }) -} -// generate 5 users -async.times(5, function(n, next){ - createUser(n, function(err, user) { - next(err, user) - }) -}, function(err, users) { - // we should now have 5 users -}); -``` - -__Related__ - -* timesSeries(n, iterator, [callback]) -* timesLimit(n, limit, iterator, [callback]) - - -## Utils - - -### memoize(fn, [hasher]) - -Caches the results of an `async` function. When creating a hash to store function -results against, the callback is omitted from the hash and an optional hash -function can be used. - -If no hash function is specified, the first argument is used as a hash key, which may work reasonably if it is a string or a data type that converts to a distinct string. Note that objects and arrays will not behave reasonably. Neither will cases where the other arguments are significant. In such cases, specify your own hash function. - -The cache of results is exposed as the `memo` property of the function returned -by `memoize`. - -__Arguments__ - -* `fn` - The function to proxy and cache results from. -* `hasher` - An optional function for generating a custom hash for storing - results. It has all the arguments applied to it apart from the callback, and - must be synchronous. - -__Example__ - -```js -var slow_fn = function (name, callback) { - // do something - callback(null, result); -}; -var fn = async.memoize(slow_fn); - -// fn can now be used as if it were slow_fn -fn('some name', function () { - // callback -}); -``` - - -### unmemoize(fn) - -Undoes a [`memoize`](#memoize)d function, reverting it to the original, unmemoized -form. Handy for testing. - -__Arguments__ - -* `fn` - the memoized function - ---------------------------------------- - - -### ensureAsync(fn) - -Wrap an async function and ensure it calls its callback on a later tick of the event loop. If the function already calls its callback on a next tick, no extra deferral is added. This is useful for preventing stack overflows (`RangeError: Maximum call stack size exceeded`) and generally keeping [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony) contained. - -__Arguments__ - -* `fn` - an async function, one that expects a node-style callback as its last argument - -Returns a wrapped function with the exact same call signature as the function passed in. - -__Example__ - -```js -function sometimesAsync(arg, callback) { - if (cache[arg]) { - return callback(null, cache[arg]); // this would be synchronous!! - } else { - doSomeIO(arg, callback); // this IO would be asynchronous - } -} - -// this has a risk of stack overflows if many results are cached in a row -async.mapSeries(args, sometimesAsync, done); - -// this will defer sometimesAsync's callback if necessary, -// preventing stack overflows -async.mapSeries(args, async.ensureAsync(sometimesAsync), done); - -``` - ---------------------------------------- - - -### constant(values...) - -Returns a function that when called, calls-back with the values provided. Useful as the first function in a `waterfall`, or for plugging values in to `auto`. - -__Example__ - -```js -async.waterfall([ - async.constant(42), - function (value, next) { - // value === 42 - }, - //... -], callback); - -async.waterfall([ - async.constant(filename, "utf8"), - fs.readFile, - function (fileData, next) { - //... - } - //... -], callback); - -async.auto({ - hostname: async.constant("https://server.net/"), - port: findFreePort, - launchServer: ["hostname", "port", function (cb, options) { - startServer(options, cb); - }], - //... -}, callback); - -``` - ---------------------------------------- - - - -### asyncify(func) - -__Alias:__ `wrapSync` - -Take a sync function and make it async, passing its return value to a callback. This is useful for plugging sync functions into a waterfall, series, or other async functions. Any arguments passed to the generated function will be passed to the wrapped function (except for the final callback argument). Errors thrown will be passed to the callback. - -__Example__ - -```js -async.waterfall([ - async.apply(fs.readFile, filename, "utf8"), - async.asyncify(JSON.parse), - function (data, next) { - // data is the result of parsing the text. - // If there was a parsing error, it would have been caught. - } -], callback) -``` - -If the function passed to `asyncify` returns a Promise, that promises's resolved/rejected state will be used to call the callback, rather than simply the synchronous return value. Example: - -```js -async.waterfall([ - async.apply(fs.readFile, filename, "utf8"), - async.asyncify(function (contents) { - return db.model.create(contents); - }), - function (model, next) { - // `model` is the instantiated model object. - // If there was an error, this function would be skipped. - } -], callback) -``` - -This also means you can asyncify ES2016 `async` functions. - -```js -var q = async.queue(async.asyncify(async function (file) { - var intermediateStep = await processFile(file); - return await somePromise(intermediateStep) -})); - -q.push(files); -``` - ---------------------------------------- - - -### log(function, arguments) - -Logs the result of an `async` function to the `console`. Only works in Node.js or -in browsers that support `console.log` and `console.error` (such as FF and Chrome). -If multiple arguments are returned from the async function, `console.log` is -called on each argument in order. - -__Arguments__ - -* `function` - The function you want to eventually apply all arguments to. -* `arguments...` - Any number of arguments to apply to the function. - -__Example__ - -```js -var hello = function(name, callback){ - setTimeout(function(){ - callback(null, 'hello ' + name); - }, 1000); -}; -``` -```js -node> async.log(hello, 'world'); -'hello world' -``` - ---------------------------------------- - - -### dir(function, arguments) - -Logs the result of an `async` function to the `console` using `console.dir` to -display the properties of the resulting object. Only works in Node.js or -in browsers that support `console.dir` and `console.error` (such as FF and Chrome). -If multiple arguments are returned from the async function, `console.dir` is -called on each argument in order. - -__Arguments__ - -* `function` - The function you want to eventually apply all arguments to. -* `arguments...` - Any number of arguments to apply to the function. - -__Example__ - -```js -var hello = function(name, callback){ - setTimeout(function(){ - callback(null, {hello: name}); - }, 1000); -}; -``` -```js -node> async.dir(hello, 'world'); -{hello: 'world'} -``` - ---------------------------------------- - - -### noConflict() - -Changes the value of `async` back to its original value, returning a reference to the -`async` object. diff --git a/node_modules/fluent-ffmpeg/node_modules/async/dist/async.js b/node_modules/fluent-ffmpeg/node_modules/async/dist/async.js deleted file mode 100644 index 31e7620..0000000 --- a/node_modules/fluent-ffmpeg/node_modules/async/dist/async.js +++ /dev/null @@ -1,1265 +0,0 @@ -/*! - * async - * https://github.com/caolan/async - * - * Copyright 2010-2014 Caolan McMahon - * Released under the MIT license - */ -(function () { - - var async = {}; - function noop() {} - function identity(v) { - return v; - } - function toBool(v) { - return !!v; - } - function notId(v) { - return !v; - } - - // global on the server, window in the browser - var previous_async; - - // Establish the root object, `window` (`self`) in the browser, `global` - // on the server, or `this` in some virtual machines. We use `self` - // instead of `window` for `WebWorker` support. - var root = typeof self === 'object' && self.self === self && self || - typeof global === 'object' && global.global === global && global || - this; - - if (root != null) { - previous_async = root.async; - } - - async.noConflict = function () { - root.async = previous_async; - return async; - }; - - function only_once(fn) { - return function() { - if (fn === null) throw new Error("Callback was already called."); - fn.apply(this, arguments); - fn = null; - }; - } - - function _once(fn) { - return function() { - if (fn === null) return; - fn.apply(this, arguments); - fn = null; - }; - } - - //// cross-browser compatiblity functions //// - - var _toString = Object.prototype.toString; - - var _isArray = Array.isArray || function (obj) { - return _toString.call(obj) === '[object Array]'; - }; - - // Ported from underscore.js isObject - var _isObject = function(obj) { - var type = typeof obj; - return type === 'function' || type === 'object' && !!obj; - }; - - function _isArrayLike(arr) { - return _isArray(arr) || ( - // has a positive integer length property - typeof arr.length === "number" && - arr.length >= 0 && - arr.length % 1 === 0 - ); - } - - function _arrayEach(arr, iterator) { - var index = -1, - length = arr.length; - - while (++index < length) { - iterator(arr[index], index, arr); - } - } - - function _map(arr, iterator) { - var index = -1, - length = arr.length, - result = Array(length); - - while (++index < length) { - result[index] = iterator(arr[index], index, arr); - } - return result; - } - - function _range(count) { - return _map(Array(count), function (v, i) { return i; }); - } - - function _reduce(arr, iterator, memo) { - _arrayEach(arr, function (x, i, a) { - memo = iterator(memo, x, i, a); - }); - return memo; - } - - function _forEachOf(object, iterator) { - _arrayEach(_keys(object), function (key) { - iterator(object[key], key); - }); - } - - function _indexOf(arr, item) { - for (var i = 0; i < arr.length; i++) { - if (arr[i] === item) return i; - } - return -1; - } - - var _keys = Object.keys || function (obj) { - var keys = []; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - keys.push(k); - } - } - return keys; - }; - - function _keyIterator(coll) { - var i = -1; - var len; - var keys; - if (_isArrayLike(coll)) { - len = coll.length; - return function next() { - i++; - return i < len ? i : null; - }; - } else { - keys = _keys(coll); - len = keys.length; - return function next() { - i++; - return i < len ? keys[i] : null; - }; - } - } - - // Similar to ES6's rest param (http://ariya.ofilabs.com/2013/03/es6-and-rest-parameter.html) - // This accumulates the arguments passed into an array, after a given index. - // From underscore.js (https://github.com/jashkenas/underscore/pull/2140). - function _restParam(func, startIndex) { - startIndex = startIndex == null ? func.length - 1 : +startIndex; - return function() { - var length = Math.max(arguments.length - startIndex, 0); - var rest = Array(length); - for (var index = 0; index < length; index++) { - rest[index] = arguments[index + startIndex]; - } - switch (startIndex) { - case 0: return func.call(this, rest); - case 1: return func.call(this, arguments[0], rest); - } - // Currently unused but handle cases outside of the switch statement: - // var args = Array(startIndex + 1); - // for (index = 0; index < startIndex; index++) { - // args[index] = arguments[index]; - // } - // args[startIndex] = rest; - // return func.apply(this, args); - }; - } - - function _withoutIndex(iterator) { - return function (value, index, callback) { - return iterator(value, callback); - }; - } - - //// exported async module functions //// - - //// nextTick implementation with browser-compatible fallback //// - - // capture the global reference to guard against fakeTimer mocks - var _setImmediate = typeof setImmediate === 'function' && setImmediate; - - var _delay = _setImmediate ? function(fn) { - // not a direct alias for IE10 compatibility - _setImmediate(fn); - } : function(fn) { - setTimeout(fn, 0); - }; - - if (typeof process === 'object' && typeof process.nextTick === 'function') { - async.nextTick = process.nextTick; - } else { - async.nextTick = _delay; - } - async.setImmediate = _setImmediate ? _delay : async.nextTick; - - - async.forEach = - async.each = function (arr, iterator, callback) { - return async.eachOf(arr, _withoutIndex(iterator), callback); - }; - - async.forEachSeries = - async.eachSeries = function (arr, iterator, callback) { - return async.eachOfSeries(arr, _withoutIndex(iterator), callback); - }; - - - async.forEachLimit = - async.eachLimit = function (arr, limit, iterator, callback) { - return _eachOfLimit(limit)(arr, _withoutIndex(iterator), callback); - }; - - async.forEachOf = - async.eachOf = function (object, iterator, callback) { - callback = _once(callback || noop); - object = object || []; - - var iter = _keyIterator(object); - var key, completed = 0; - - while ((key = iter()) != null) { - completed += 1; - iterator(object[key], key, only_once(done)); - } - - if (completed === 0) callback(null); - - function done(err) { - completed--; - if (err) { - callback(err); - } - // Check key is null in case iterator isn't exhausted - // and done resolved synchronously. - else if (key === null && completed <= 0) { - callback(null); - } - } - }; - - async.forEachOfSeries = - async.eachOfSeries = function (obj, iterator, callback) { - callback = _once(callback || noop); - obj = obj || []; - var nextKey = _keyIterator(obj); - var key = nextKey(); - function iterate() { - var sync = true; - if (key === null) { - return callback(null); - } - iterator(obj[key], key, only_once(function (err) { - if (err) { - callback(err); - } - else { - key = nextKey(); - if (key === null) { - return callback(null); - } else { - if (sync) { - async.setImmediate(iterate); - } else { - iterate(); - } - } - } - })); - sync = false; - } - iterate(); - }; - - - - async.forEachOfLimit = - async.eachOfLimit = function (obj, limit, iterator, callback) { - _eachOfLimit(limit)(obj, iterator, callback); - }; - - function _eachOfLimit(limit) { - - return function (obj, iterator, callback) { - callback = _once(callback || noop); - obj = obj || []; - var nextKey = _keyIterator(obj); - if (limit <= 0) { - return callback(null); - } - var done = false; - var running = 0; - var errored = false; - - (function replenish () { - if (done && running <= 0) { - return callback(null); - } - - while (running < limit && !errored) { - var key = nextKey(); - if (key === null) { - done = true; - if (running <= 0) { - callback(null); - } - return; - } - running += 1; - iterator(obj[key], key, only_once(function (err) { - running -= 1; - if (err) { - callback(err); - errored = true; - } - else { - replenish(); - } - })); - } - })(); - }; - } - - - function doParallel(fn) { - return function (obj, iterator, callback) { - return fn(async.eachOf, obj, iterator, callback); - }; - } - function doParallelLimit(fn) { - return function (obj, limit, iterator, callback) { - return fn(_eachOfLimit(limit), obj, iterator, callback); - }; - } - function doSeries(fn) { - return function (obj, iterator, callback) { - return fn(async.eachOfSeries, obj, iterator, callback); - }; - } - - function _asyncMap(eachfn, arr, iterator, callback) { - callback = _once(callback || noop); - arr = arr || []; - var results = _isArrayLike(arr) ? [] : {}; - eachfn(arr, function (value, index, callback) { - iterator(value, function (err, v) { - results[index] = v; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - - async.map = doParallel(_asyncMap); - async.mapSeries = doSeries(_asyncMap); - async.mapLimit = doParallelLimit(_asyncMap); - - // reduce only has a series version, as doing reduce in parallel won't - // work in many situations. - async.inject = - async.foldl = - async.reduce = function (arr, memo, iterator, callback) { - async.eachOfSeries(arr, function (x, i, callback) { - iterator(memo, x, function (err, v) { - memo = v; - callback(err); - }); - }, function (err) { - callback(err, memo); - }); - }; - - async.foldr = - async.reduceRight = function (arr, memo, iterator, callback) { - var reversed = _map(arr, identity).reverse(); - async.reduce(reversed, memo, iterator, callback); - }; - - async.transform = function (arr, memo, iterator, callback) { - if (arguments.length === 3) { - callback = iterator; - iterator = memo; - memo = _isArray(arr) ? [] : {}; - } - - async.eachOf(arr, function(v, k, cb) { - iterator(memo, v, k, cb); - }, function(err) { - callback(err, memo); - }); - }; - - function _filter(eachfn, arr, iterator, callback) { - var results = []; - eachfn(arr, function (x, index, callback) { - iterator(x, function (v) { - if (v) { - results.push({index: index, value: x}); - } - callback(); - }); - }, function () { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - } - - async.select = - async.filter = doParallel(_filter); - - async.selectLimit = - async.filterLimit = doParallelLimit(_filter); - - async.selectSeries = - async.filterSeries = doSeries(_filter); - - function _reject(eachfn, arr, iterator, callback) { - _filter(eachfn, arr, function(value, cb) { - iterator(value, function(v) { - cb(!v); - }); - }, callback); - } - async.reject = doParallel(_reject); - async.rejectLimit = doParallelLimit(_reject); - async.rejectSeries = doSeries(_reject); - - function _createTester(eachfn, check, getResult) { - return function(arr, limit, iterator, cb) { - function done() { - if (cb) cb(getResult(false, void 0)); - } - function iteratee(x, _, callback) { - if (!cb) return callback(); - iterator(x, function (v) { - if (cb && check(v)) { - cb(getResult(true, x)); - cb = iterator = false; - } - callback(); - }); - } - if (arguments.length > 3) { - eachfn(arr, limit, iteratee, done); - } else { - cb = iterator; - iterator = limit; - eachfn(arr, iteratee, done); - } - }; - } - - async.any = - async.some = _createTester(async.eachOf, toBool, identity); - - async.someLimit = _createTester(async.eachOfLimit, toBool, identity); - - async.all = - async.every = _createTester(async.eachOf, notId, notId); - - async.everyLimit = _createTester(async.eachOfLimit, notId, notId); - - function _findGetResult(v, x) { - return x; - } - async.detect = _createTester(async.eachOf, identity, _findGetResult); - async.detectSeries = _createTester(async.eachOfSeries, identity, _findGetResult); - async.detectLimit = _createTester(async.eachOfLimit, identity, _findGetResult); - - async.sortBy = function (arr, iterator, callback) { - async.map(arr, function (x, callback) { - iterator(x, function (err, criteria) { - if (err) { - callback(err); - } - else { - callback(null, {value: x, criteria: criteria}); - } - }); - }, function (err, results) { - if (err) { - return callback(err); - } - else { - callback(null, _map(results.sort(comparator), function (x) { - return x.value; - })); - } - - }); - - function comparator(left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - } - }; - - async.auto = function (tasks, concurrency, callback) { - if (typeof arguments[1] === 'function') { - // concurrency is optional, shift the args. - callback = concurrency; - concurrency = null; - } - callback = _once(callback || noop); - var keys = _keys(tasks); - var remainingTasks = keys.length; - if (!remainingTasks) { - return callback(null); - } - if (!concurrency) { - concurrency = remainingTasks; - } - - var results = {}; - var runningTasks = 0; - - var hasError = false; - - var listeners = []; - function addListener(fn) { - listeners.unshift(fn); - } - function removeListener(fn) { - var idx = _indexOf(listeners, fn); - if (idx >= 0) listeners.splice(idx, 1); - } - function taskComplete() { - remainingTasks--; - _arrayEach(listeners.slice(0), function (fn) { - fn(); - }); - } - - addListener(function () { - if (!remainingTasks) { - callback(null, results); - } - }); - - _arrayEach(keys, function (k) { - if (hasError) return; - var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]]; - var taskCallback = _restParam(function(err, args) { - runningTasks--; - if (args.length <= 1) { - args = args[0]; - } - if (err) { - var safeResults = {}; - _forEachOf(results, function(val, rkey) { - safeResults[rkey] = val; - }); - safeResults[k] = args; - hasError = true; - - callback(err, safeResults); - } - else { - results[k] = args; - async.setImmediate(taskComplete); - } - }); - var requires = task.slice(0, task.length - 1); - // prevent dead-locks - var len = requires.length; - var dep; - while (len--) { - if (!(dep = tasks[requires[len]])) { - throw new Error('Has nonexistent dependency in ' + requires.join(', ')); - } - if (_isArray(dep) && _indexOf(dep, k) >= 0) { - throw new Error('Has cyclic dependencies'); - } - } - function ready() { - return runningTasks < concurrency && _reduce(requires, function (a, x) { - return (a && results.hasOwnProperty(x)); - }, true) && !results.hasOwnProperty(k); - } - if (ready()) { - runningTasks++; - task[task.length - 1](taskCallback, results); - } - else { - addListener(listener); - } - function listener() { - if (ready()) { - runningTasks++; - removeListener(listener); - task[task.length - 1](taskCallback, results); - } - } - }); - }; - - - - async.retry = function(times, task, callback) { - var DEFAULT_TIMES = 5; - var DEFAULT_INTERVAL = 0; - - var attempts = []; - - var opts = { - times: DEFAULT_TIMES, - interval: DEFAULT_INTERVAL - }; - - function parseTimes(acc, t){ - if(typeof t === 'number'){ - acc.times = parseInt(t, 10) || DEFAULT_TIMES; - } else if(typeof t === 'object'){ - acc.times = parseInt(t.times, 10) || DEFAULT_TIMES; - acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL; - } else { - throw new Error('Unsupported argument type for \'times\': ' + typeof t); - } - } - - var length = arguments.length; - if (length < 1 || length > 3) { - throw new Error('Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)'); - } else if (length <= 2 && typeof times === 'function') { - callback = task; - task = times; - } - if (typeof times !== 'function') { - parseTimes(opts, times); - } - opts.callback = callback; - opts.task = task; - - function wrappedTask(wrappedCallback, wrappedResults) { - function retryAttempt(task, finalAttempt) { - return function(seriesCallback) { - task(function(err, result){ - seriesCallback(!err || finalAttempt, {err: err, result: result}); - }, wrappedResults); - }; - } - - function retryInterval(interval){ - return function(seriesCallback){ - setTimeout(function(){ - seriesCallback(null); - }, interval); - }; - } - - while (opts.times) { - - var finalAttempt = !(opts.times-=1); - attempts.push(retryAttempt(opts.task, finalAttempt)); - if(!finalAttempt && opts.interval > 0){ - attempts.push(retryInterval(opts.interval)); - } - } - - async.series(attempts, function(done, data){ - data = data[data.length - 1]; - (wrappedCallback || opts.callback)(data.err, data.result); - }); - } - - // If a callback is passed, run this as a controll flow - return opts.callback ? wrappedTask() : wrappedTask; - }; - - async.waterfall = function (tasks, callback) { - callback = _once(callback || noop); - if (!_isArray(tasks)) { - var err = new Error('First argument to waterfall must be an array of functions'); - return callback(err); - } - if (!tasks.length) { - return callback(); - } - function wrapIterator(iterator) { - return _restParam(function (err, args) { - if (err) { - callback.apply(null, [err].concat(args)); - } - else { - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } - else { - args.push(callback); - } - ensureAsync(iterator).apply(null, args); - } - }); - } - wrapIterator(async.iterator(tasks))(); - }; - - function _parallel(eachfn, tasks, callback) { - callback = callback || noop; - var results = _isArrayLike(tasks) ? [] : {}; - - eachfn(tasks, function (task, key, callback) { - task(_restParam(function (err, args) { - if (args.length <= 1) { - args = args[0]; - } - results[key] = args; - callback(err); - })); - }, function (err) { - callback(err, results); - }); - } - - async.parallel = function (tasks, callback) { - _parallel(async.eachOf, tasks, callback); - }; - - async.parallelLimit = function(tasks, limit, callback) { - _parallel(_eachOfLimit(limit), tasks, callback); - }; - - async.series = function(tasks, callback) { - _parallel(async.eachOfSeries, tasks, callback); - }; - - async.iterator = function (tasks) { - function makeCallback(index) { - function fn() { - if (tasks.length) { - tasks[index].apply(null, arguments); - } - return fn.next(); - } - fn.next = function () { - return (index < tasks.length - 1) ? makeCallback(index + 1): null; - }; - return fn; - } - return makeCallback(0); - }; - - async.apply = _restParam(function (fn, args) { - return _restParam(function (callArgs) { - return fn.apply( - null, args.concat(callArgs) - ); - }); - }); - - function _concat(eachfn, arr, fn, callback) { - var result = []; - eachfn(arr, function (x, index, cb) { - fn(x, function (err, y) { - result = result.concat(y || []); - cb(err); - }); - }, function (err) { - callback(err, result); - }); - } - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); - - async.whilst = function (test, iterator, callback) { - callback = callback || noop; - if (test()) { - var next = _restParam(function(err, args) { - if (err) { - callback(err); - } else if (test.apply(this, args)) { - iterator(next); - } else { - callback.apply(null, [null].concat(args)); - } - }); - iterator(next); - } else { - callback(null); - } - }; - - async.doWhilst = function (iterator, test, callback) { - var calls = 0; - return async.whilst(function() { - return ++calls <= 1 || test.apply(this, arguments); - }, iterator, callback); - }; - - async.until = function (test, iterator, callback) { - return async.whilst(function() { - return !test.apply(this, arguments); - }, iterator, callback); - }; - - async.doUntil = function (iterator, test, callback) { - return async.doWhilst(iterator, function() { - return !test.apply(this, arguments); - }, callback); - }; - - async.during = function (test, iterator, callback) { - callback = callback || noop; - - var next = _restParam(function(err, args) { - if (err) { - callback(err); - } else { - args.push(check); - test.apply(this, args); - } - }); - - var check = function(err, truth) { - if (err) { - callback(err); - } else if (truth) { - iterator(next); - } else { - callback(null); - } - }; - - test(check); - }; - - async.doDuring = function (iterator, test, callback) { - var calls = 0; - async.during(function(next) { - if (calls++ < 1) { - next(null, true); - } else { - test.apply(this, arguments); - } - }, iterator, callback); - }; - - function _queue(worker, concurrency, payload) { - if (concurrency == null) { - concurrency = 1; - } - else if(concurrency === 0) { - throw new Error('Concurrency must not be zero'); - } - function _insert(q, data, pos, callback) { - if (callback != null && typeof callback !== "function") { - throw new Error("task callback must be a function"); - } - q.started = true; - if (!_isArray(data)) { - data = [data]; - } - if(data.length === 0 && q.idle()) { - // call drain immediately if there are no tasks - return async.setImmediate(function() { - q.drain(); - }); - } - _arrayEach(data, function(task) { - var item = { - data: task, - callback: callback || noop - }; - - if (pos) { - q.tasks.unshift(item); - } else { - q.tasks.push(item); - } - - if (q.tasks.length === q.concurrency) { - q.saturated(); - } - }); - async.setImmediate(q.process); - } - function _next(q, tasks) { - return function(){ - workers -= 1; - - var removed = false; - var args = arguments; - _arrayEach(tasks, function (task) { - _arrayEach(workersList, function (worker, index) { - if (worker === task && !removed) { - workersList.splice(index, 1); - removed = true; - } - }); - - task.callback.apply(task, args); - }); - if (q.tasks.length + workers === 0) { - q.drain(); - } - q.process(); - }; - } - - var workers = 0; - var workersList = []; - var q = { - tasks: [], - concurrency: concurrency, - payload: payload, - saturated: noop, - empty: noop, - drain: noop, - started: false, - paused: false, - push: function (data, callback) { - _insert(q, data, false, callback); - }, - kill: function () { - q.drain = noop; - q.tasks = []; - }, - unshift: function (data, callback) { - _insert(q, data, true, callback); - }, - process: function () { - while(!q.paused && workers < q.concurrency && q.tasks.length){ - - var tasks = q.payload ? - q.tasks.splice(0, q.payload) : - q.tasks.splice(0, q.tasks.length); - - var data = _map(tasks, function (task) { - return task.data; - }); - - if (q.tasks.length === 0) { - q.empty(); - } - workers += 1; - workersList.push(tasks[0]); - var cb = only_once(_next(q, tasks)); - worker(data, cb); - } - }, - length: function () { - return q.tasks.length; - }, - running: function () { - return workers; - }, - workersList: function () { - return workersList; - }, - idle: function() { - return q.tasks.length + workers === 0; - }, - pause: function () { - q.paused = true; - }, - resume: function () { - if (q.paused === false) { return; } - q.paused = false; - var resumeCount = Math.min(q.concurrency, q.tasks.length); - // Need to call q.process once per concurrent - // worker to preserve full concurrency after pause - for (var w = 1; w <= resumeCount; w++) { - async.setImmediate(q.process); - } - } - }; - return q; - } - - async.queue = function (worker, concurrency) { - var q = _queue(function (items, cb) { - worker(items[0], cb); - }, concurrency, 1); - - return q; - }; - - async.priorityQueue = function (worker, concurrency) { - - function _compareTasks(a, b){ - return a.priority - b.priority; - } - - function _binarySearch(sequence, item, compare) { - var beg = -1, - end = sequence.length - 1; - while (beg < end) { - var mid = beg + ((end - beg + 1) >>> 1); - if (compare(item, sequence[mid]) >= 0) { - beg = mid; - } else { - end = mid - 1; - } - } - return beg; - } - - function _insert(q, data, priority, callback) { - if (callback != null && typeof callback !== "function") { - throw new Error("task callback must be a function"); - } - q.started = true; - if (!_isArray(data)) { - data = [data]; - } - if(data.length === 0) { - // call drain immediately if there are no tasks - return async.setImmediate(function() { - q.drain(); - }); - } - _arrayEach(data, function(task) { - var item = { - data: task, - priority: priority, - callback: typeof callback === 'function' ? callback : noop - }; - - q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item); - - if (q.tasks.length === q.concurrency) { - q.saturated(); - } - async.setImmediate(q.process); - }); - } - - // Start with a normal queue - var q = async.queue(worker, concurrency); - - // Override push to accept second parameter representing priority - q.push = function (data, priority, callback) { - _insert(q, data, priority, callback); - }; - - // Remove unshift function - delete q.unshift; - - return q; - }; - - async.cargo = function (worker, payload) { - return _queue(worker, 1, payload); - }; - - function _console_fn(name) { - return _restParam(function (fn, args) { - fn.apply(null, args.concat([_restParam(function (err, args) { - if (typeof console === 'object') { - if (err) { - if (console.error) { - console.error(err); - } - } - else if (console[name]) { - _arrayEach(args, function (x) { - console[name](x); - }); - } - } - })])); - }); - } - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - - async.memoize = function (fn, hasher) { - var memo = {}; - var queues = {}; - var has = Object.prototype.hasOwnProperty; - hasher = hasher || identity; - var memoized = _restParam(function memoized(args) { - var callback = args.pop(); - var key = hasher.apply(null, args); - if (has.call(memo, key)) { - async.setImmediate(function () { - callback.apply(null, memo[key]); - }); - } - else if (has.call(queues, key)) { - queues[key].push(callback); - } - else { - queues[key] = [callback]; - fn.apply(null, args.concat([_restParam(function (args) { - memo[key] = args; - var q = queues[key]; - delete queues[key]; - for (var i = 0, l = q.length; i < l; i++) { - q[i].apply(null, args); - } - })])); - } - }); - memoized.memo = memo; - memoized.unmemoized = fn; - return memoized; - }; - - async.unmemoize = function (fn) { - return function () { - return (fn.unmemoized || fn).apply(null, arguments); - }; - }; - - function _times(mapper) { - return function (count, iterator, callback) { - mapper(_range(count), iterator, callback); - }; - } - - async.times = _times(async.map); - async.timesSeries = _times(async.mapSeries); - async.timesLimit = function (count, limit, iterator, callback) { - return async.mapLimit(_range(count), limit, iterator, callback); - }; - - async.seq = function (/* functions... */) { - var fns = arguments; - return _restParam(function (args) { - var that = this; - - var callback = args[args.length - 1]; - if (typeof callback == 'function') { - args.pop(); - } else { - callback = noop; - } - - async.reduce(fns, args, function (newargs, fn, cb) { - fn.apply(that, newargs.concat([_restParam(function (err, nextargs) { - cb(err, nextargs); - })])); - }, - function (err, results) { - callback.apply(that, [err].concat(results)); - }); - }); - }; - - async.compose = function (/* functions... */) { - return async.seq.apply(null, Array.prototype.reverse.call(arguments)); - }; - - - function _applyEach(eachfn) { - return _restParam(function(fns, args) { - var go = _restParam(function(args) { - var that = this; - var callback = args.pop(); - return eachfn(fns, function (fn, _, cb) { - fn.apply(that, args.concat([cb])); - }, - callback); - }); - if (args.length) { - return go.apply(this, args); - } - else { - return go; - } - }); - } - - async.applyEach = _applyEach(async.eachOf); - async.applyEachSeries = _applyEach(async.eachOfSeries); - - - async.forever = function (fn, callback) { - var done = only_once(callback || noop); - var task = ensureAsync(fn); - function next(err) { - if (err) { - return done(err); - } - task(next); - } - next(); - }; - - function ensureAsync(fn) { - return _restParam(function (args) { - var callback = args.pop(); - args.push(function () { - var innerArgs = arguments; - if (sync) { - async.setImmediate(function () { - callback.apply(null, innerArgs); - }); - } else { - callback.apply(null, innerArgs); - } - }); - var sync = true; - fn.apply(this, args); - sync = false; - }); - } - - async.ensureAsync = ensureAsync; - - async.constant = _restParam(function(values) { - var args = [null].concat(values); - return function (callback) { - return callback.apply(this, args); - }; - }); - - async.wrapSync = - async.asyncify = function asyncify(func) { - return _restParam(function (args) { - var callback = args.pop(); - var result; - try { - result = func.apply(this, args); - } catch (e) { - return callback(e); - } - // if result is Promise object - if (_isObject(result) && typeof result.then === "function") { - result.then(function(value) { - callback(null, value); - })["catch"](function(err) { - callback(err.message ? err : new Error(err)); - }); - } else { - callback(null, result); - } - }); - }; - - // Node.js - if (typeof module === 'object' && module.exports) { - module.exports = async; - } - // AMD / RequireJS - else if (typeof define === 'function' && define.amd) { - define([], function () { - return async; - }); - } - // included directly via - - - - - - - - -
- -

- - -
- - - -
- -
- - - - - diff --git a/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/mainpage.tmpl b/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/mainpage.tmpl deleted file mode 100644 index 64e9e59..0000000 --- a/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/mainpage.tmpl +++ /dev/null @@ -1,14 +0,0 @@ - - - -

- - - -
-
-
- diff --git a/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/members.tmpl b/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/members.tmpl deleted file mode 100644 index 0f99998..0000000 --- a/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/members.tmpl +++ /dev/null @@ -1,41 +0,0 @@ - -
-

- - -

- -
-
- -
- -
- - - -
Type:
-
    -
  • - -
  • -
- - - - - -
Fires:
-
    -
  • -
- - - -
Example 1? 's':'' ?>
- - -
diff --git a/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/method.tmpl b/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/method.tmpl deleted file mode 100644 index fb3920a..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/params.tmpl b/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/params.tmpl deleted file mode 100644 index 7478752..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/properties.tmpl b/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/properties.tmpl deleted file mode 100644 index 1dba575..0000000 --- a/node_modules/fluent-ffmpeg/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/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/returns.tmpl b/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/returns.tmpl deleted file mode 100644 index d070459..0000000 --- a/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/returns.tmpl +++ /dev/null @@ -1,19 +0,0 @@ - -
- -
- - - -
-
- Type -
-
- -
-
- \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/source.tmpl b/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/source.tmpl deleted file mode 100644 index e559b5d..0000000 --- a/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/source.tmpl +++ /dev/null @@ -1,8 +0,0 @@ - -
-
-
-
-
\ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/tutorial.tmpl b/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/tutorial.tmpl deleted file mode 100644 index 88a0ad5..0000000 --- a/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/tutorial.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -
- -
- 0) { ?> -
    -
  • -
- - -

-
- -
- -
- -
diff --git a/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/type.tmpl b/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/type.tmpl deleted file mode 100644 index ec2c6c0..0000000 --- a/node_modules/fluent-ffmpeg/tools/jsdoc-template/tmpl/type.tmpl +++ /dev/null @@ -1,7 +0,0 @@ - - -| - \ No newline at end of file diff --git a/node_modules/fluent-ffmpeg/tools/test-travis.sh b/node_modules/fluent-ffmpeg/tools/test-travis.sh deleted file mode 100644 index 6890814..0000000 --- a/node_modules/fluent-ffmpeg/tools/test-travis.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# Stop on error -set -e - -# Install dependencies - -echo travis_fold:start:Dependencies -if [ "$(uname)" = "Linux" ]; then - # Linux - sudo add-apt-repository -y ppa:jon-severinsson/ffmpeg - sudo apt-get update - sudo apt-get -y install wget tar bzip2 flvtool2 ffmpeg - wget http://ffmpeg.gusari.org/static/64bit/ffmpeg.static.64bit.latest.tar.gz - tar zxf ffmpeg.static.64bit.latest.tar.gz - sudo cp ffmpeg ffprobe /usr/bin - export ALT_FFMPEG_PATH=$(pwd)/ffmpeg - export ALT_FFPROBE_PATH=$(pwd)/ffprobe -else - # OSX - brew update - brew install ffmpeg - brew install flvmeta - brew unlink node - - # Have brew-installed software available on the PATH - export PATH=/usr/local/bin:$PATH - - # Copy ffmpeg and ffprobe to home directory to have alternative paths - cp $(which ffmpeg) ~/ffmpeg - export ALT_FFMPEG_PATH=$HOME/ffmpeg - cp $(which ffprobe) ~/ffprobe - export ALT_FFPROBE_PATH=$HOME/ffprobe -fi -echo travis_fold:end:Dependencies - -# Install nvm if needed - -echo travis_fold:start:nvm -if [ ! -d ~/.nvm ]; then - wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.6.1/install.sh | sh -fi -source ~/.nvm/nvm.sh -nvm install $NODE_VERSION -echo travis_fold:end:nvm - -# Print versions - -echo travis_fold:start:Versions -echo "node version: $(node --version)" -echo "npm version: $(npm --version)" -echo "ffmpeg version: $(ffmpeg -version)" -echo travis_fold:end:Versions - -# Install dependencies -echo travis_fold:start:npm-install -npm install -echo travis_fold:end:npm-install - -# Run tests -make test diff --git a/util/penis_lengths.json b/util/penis_lengths.json new file mode 100644 index 0000000..e69de29