初始化环境文件
This commit is contained in:
17913
node_modules/fluent-ffmpeg/doc/FfmpegCommand.html
generated
vendored
Normal file
17913
node_modules/fluent-ffmpeg/doc/FfmpegCommand.html
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
228
node_modules/fluent-ffmpeg/doc/audio.js.html
generated
vendored
Normal file
228
node_modules/fluent-ffmpeg/doc/audio.js.html
generated
vendored
Normal file
@@ -0,0 +1,228 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: options/audio.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: options/audio.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*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;
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
715
node_modules/fluent-ffmpeg/doc/capabilities.js.html
generated
vendored
Normal file
715
node_modules/fluent-ffmpeg/doc/capabilities.js.html
generated
vendored
Normal file
@@ -0,0 +1,715 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: capabilities.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: capabilities.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*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 ])\s+([^ ]+)\s+(.*)$/;
|
||||
var lineBreakRegexp = /\r\n|\r|\n/;
|
||||
var filterRegexp = /^(?: [T\.][S\.][C\.] )?([^ ]+) +(AA?|VV?|\|)->(AA?|VV?|\|) +(.*)$/;
|
||||
|
||||
var cache = {};
|
||||
|
||||
module.exports = function(proto) {
|
||||
/**
|
||||
* Manually define the ffmpeg binary full path.
|
||||
*
|
||||
* @method FfmpegCommand#setFfmpegPath
|
||||
*
|
||||
* @param {String} ffmpegPath The full path to the ffmpeg binary.
|
||||
* @return FfmpegCommand
|
||||
*/
|
||||
proto.setFfmpegPath = function(ffmpegPath) {
|
||||
cache.ffmpegPath = ffmpegPath;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Manually define the ffprobe binary full path.
|
||||
*
|
||||
* @method FfmpegCommand#setFfprobePath
|
||||
*
|
||||
* @param {String} ffprobePath The full path to the ffprobe binary.
|
||||
* @return FfmpegCommand
|
||||
*/
|
||||
proto.setFfprobePath = function(ffprobePath) {
|
||||
cache.ffprobePath = ffprobePath;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Manually define the flvtool2/flvmeta binary full path.
|
||||
*
|
||||
* @method FfmpegCommand#setFlvtoolPath
|
||||
*
|
||||
* @param {String} flvtool The full path to the flvtool2 or flvmeta binary.
|
||||
* @return FfmpegCommand
|
||||
*/
|
||||
proto.setFlvtoolPath = function(flvtool) {
|
||||
cache.flvtoolPath = flvtool;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Forget executable paths
|
||||
*
|
||||
* (only used for testing purposes)
|
||||
*
|
||||
* @method FfmpegCommand#_forgetPaths
|
||||
* @private
|
||||
*/
|
||||
proto._forgetPaths = function() {
|
||||
delete cache.ffmpegPath;
|
||||
delete cache.ffprobePath;
|
||||
delete cache.flvtoolPath;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check for ffmpeg availability
|
||||
*
|
||||
* If the FFMPEG_PATH environment variable is set, try to use it.
|
||||
* If it is unset or incorrect, try to find ffmpeg in the PATH instead.
|
||||
*
|
||||
* @method FfmpegCommand#_getFfmpegPath
|
||||
* @param {Function} callback callback with signature (err, path)
|
||||
* @private
|
||||
*/
|
||||
proto._getFfmpegPath = function(callback) {
|
||||
if ('ffmpegPath' in cache) {
|
||||
return callback(null, cache.ffmpegPath);
|
||||
}
|
||||
|
||||
async.waterfall([
|
||||
// Try FFMPEG_PATH
|
||||
function(cb) {
|
||||
if (process.env.FFMPEG_PATH) {
|
||||
fs.exists(process.env.FFMPEG_PATH, function(exists) {
|
||||
if (exists) {
|
||||
cb(null, process.env.FFMPEG_PATH);
|
||||
} else {
|
||||
cb(null, '');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
cb(null, '');
|
||||
}
|
||||
},
|
||||
|
||||
// Search in the PATH
|
||||
function(ffmpeg, cb) {
|
||||
if (ffmpeg.length) {
|
||||
return cb(null, ffmpeg);
|
||||
}
|
||||
|
||||
utils.which('ffmpeg', function(err, ffmpeg) {
|
||||
cb(err, ffmpeg);
|
||||
});
|
||||
}
|
||||
], function(err, ffmpeg) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
callback(null, cache.ffmpegPath = (ffmpeg || ''));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Check for ffprobe availability
|
||||
*
|
||||
* If the FFPROBE_PATH environment variable is set, try to use it.
|
||||
* If it is unset or incorrect, try to find ffprobe in the PATH instead.
|
||||
* If this still fails, try to find ffprobe in the same directory as ffmpeg.
|
||||
*
|
||||
* @method FfmpegCommand#_getFfprobePath
|
||||
* @param {Function} callback callback with signature (err, path)
|
||||
* @private
|
||||
*/
|
||||
proto._getFfprobePath = function(callback) {
|
||||
var self = this;
|
||||
|
||||
if ('ffprobePath' in cache) {
|
||||
return callback(null, cache.ffprobePath);
|
||||
}
|
||||
|
||||
async.waterfall([
|
||||
// Try FFPROBE_PATH
|
||||
function(cb) {
|
||||
if (process.env.FFPROBE_PATH) {
|
||||
fs.exists(process.env.FFPROBE_PATH, function(exists) {
|
||||
cb(null, exists ? process.env.FFPROBE_PATH : '');
|
||||
});
|
||||
} else {
|
||||
cb(null, '');
|
||||
}
|
||||
},
|
||||
|
||||
// Search in the PATH
|
||||
function(ffprobe, cb) {
|
||||
if (ffprobe.length) {
|
||||
return cb(null, ffprobe);
|
||||
}
|
||||
|
||||
utils.which('ffprobe', function(err, ffprobe) {
|
||||
cb(err, ffprobe);
|
||||
});
|
||||
},
|
||||
|
||||
// Search in the same directory as ffmpeg
|
||||
function(ffprobe, cb) {
|
||||
if (ffprobe.length) {
|
||||
return cb(null, ffprobe);
|
||||
}
|
||||
|
||||
self._getFfmpegPath(function(err, ffmpeg) {
|
||||
if (err) {
|
||||
cb(err);
|
||||
} else if (ffmpeg.length) {
|
||||
var name = utils.isWindows ? 'ffprobe.exe' : 'ffprobe';
|
||||
var ffprobe = path.join(path.dirname(ffmpeg), name);
|
||||
fs.exists(ffprobe, function(exists) {
|
||||
cb(null, exists ? ffprobe : '');
|
||||
});
|
||||
} else {
|
||||
cb(null, '');
|
||||
}
|
||||
});
|
||||
}
|
||||
], function(err, ffprobe) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
callback(null, cache.ffprobePath = (ffprobe || ''));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Check for flvtool2/flvmeta availability
|
||||
*
|
||||
* If the FLVTOOL2_PATH or FLVMETA_PATH environment variable are set, try to use them.
|
||||
* If both are either unset or incorrect, try to find flvtool2 or flvmeta in the PATH instead.
|
||||
*
|
||||
* @method FfmpegCommand#_getFlvtoolPath
|
||||
* @param {Function} callback callback with signature (err, path)
|
||||
* @private
|
||||
*/
|
||||
proto._getFlvtoolPath = function(callback) {
|
||||
if ('flvtoolPath' in cache) {
|
||||
return callback(null, cache.flvtoolPath);
|
||||
}
|
||||
|
||||
async.waterfall([
|
||||
// Try FLVMETA_PATH
|
||||
function(cb) {
|
||||
if (process.env.FLVMETA_PATH) {
|
||||
fs.exists(process.env.FLVMETA_PATH, function(exists) {
|
||||
cb(null, exists ? process.env.FLVMETA_PATH : '');
|
||||
});
|
||||
} else {
|
||||
cb(null, '');
|
||||
}
|
||||
},
|
||||
|
||||
// Try FLVTOOL2_PATH
|
||||
function(flvtool, cb) {
|
||||
if (flvtool.length) {
|
||||
return cb(null, flvtool);
|
||||
}
|
||||
|
||||
if (process.env.FLVTOOL2_PATH) {
|
||||
fs.exists(process.env.FLVTOOL2_PATH, function(exists) {
|
||||
cb(null, exists ? process.env.FLVTOOL2_PATH : '');
|
||||
});
|
||||
} else {
|
||||
cb(null, '');
|
||||
}
|
||||
},
|
||||
|
||||
// Search for flvmeta in the PATH
|
||||
function(flvtool, cb) {
|
||||
if (flvtool.length) {
|
||||
return cb(null, flvtool);
|
||||
}
|
||||
|
||||
utils.which('flvmeta', function(err, flvmeta) {
|
||||
cb(err, flvmeta);
|
||||
});
|
||||
},
|
||||
|
||||
// Search for flvtool2 in the PATH
|
||||
function(flvtool, cb) {
|
||||
if (flvtool.length) {
|
||||
return cb(null, flvtool);
|
||||
}
|
||||
|
||||
utils.which('flvtool2', function(err, flvtool2) {
|
||||
cb(err, flvtool2);
|
||||
});
|
||||
},
|
||||
], function(err, flvtool) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
callback(null, cache.flvtoolPath = (flvtool || ''));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A callback passed to {@link FfmpegCommand#availableFilters}.
|
||||
*
|
||||
* @callback FfmpegCommand~filterCallback
|
||||
* @param {Error|null} err error object or null if no error happened
|
||||
* @param {Object} filters filter object with filter names as keys and the following
|
||||
* properties for each filter:
|
||||
* @param {String} filters.description filter description
|
||||
* @param {String} filters.input input type, one of 'audio', 'video' and 'none'
|
||||
* @param {Boolean} filters.multipleInputs whether the filter supports multiple inputs
|
||||
* @param {String} filters.output output type, one of 'audio', 'video' and 'none'
|
||||
* @param {Boolean} filters.multipleOutputs whether the filter supports multiple outputs
|
||||
*/
|
||||
|
||||
/**
|
||||
* Query ffmpeg for available filters
|
||||
*
|
||||
* @method FfmpegCommand#availableFilters
|
||||
* @category Capabilities
|
||||
* @aliases getAvailableFilters
|
||||
*
|
||||
* @param {FfmpegCommand~filterCallback} callback callback function
|
||||
*/
|
||||
proto.availableFilters =
|
||||
proto.getAvailableFilters = function(callback) {
|
||||
if ('filters' in cache) {
|
||||
return callback(null, cache.filters);
|
||||
}
|
||||
|
||||
this._spawnFfmpeg(['-filters'], { captureStdout: true, stdoutLines: 0 }, function (err, stdoutRing) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
var stdout = stdoutRing.get();
|
||||
var lines = stdout.split('\n');
|
||||
var data = {};
|
||||
var types = { A: 'audio', V: 'video', '|': 'none' };
|
||||
|
||||
lines.forEach(function(line) {
|
||||
var match = line.match(filterRegexp);
|
||||
if (match) {
|
||||
data[match[1]] = {
|
||||
description: match[4],
|
||||
input: types[match[2].charAt(0)],
|
||||
multipleInputs: match[2].length > 1,
|
||||
output: types[match[3].charAt(0)],
|
||||
multipleOutputs: match[3].length > 1
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
callback(null, cache.filters = data);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A callback passed to {@link FfmpegCommand#availableCodecs}.
|
||||
*
|
||||
* @callback FfmpegCommand~codecCallback
|
||||
* @param {Error|null} err error object or null if no error happened
|
||||
* @param {Object} codecs codec object with codec names as keys and the following
|
||||
* properties for each codec (more properties may be available depending on the
|
||||
* ffmpeg version used):
|
||||
* @param {String} codecs.description codec description
|
||||
* @param {Boolean} codecs.canDecode whether the codec is able to decode streams
|
||||
* @param {Boolean} codecs.canEncode whether the codec is able to encode streams
|
||||
*/
|
||||
|
||||
/**
|
||||
* Query ffmpeg for available codecs
|
||||
*
|
||||
* @method FfmpegCommand#availableCodecs
|
||||
* @category Capabilities
|
||||
* @aliases getAvailableCodecs
|
||||
*
|
||||
* @param {FfmpegCommand~codecCallback} callback callback function
|
||||
*/
|
||||
proto.availableCodecs =
|
||||
proto.getAvailableCodecs = function(callback) {
|
||||
if ('codecs' in cache) {
|
||||
return callback(null, cache.codecs);
|
||||
}
|
||||
|
||||
this._spawnFfmpeg(['-codecs'], { captureStdout: true, stdoutLines: 0 }, function(err, stdoutRing) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
var stdout = stdoutRing.get();
|
||||
var lines = stdout.split(lineBreakRegexp);
|
||||
var data = {};
|
||||
|
||||
lines.forEach(function(line) {
|
||||
var match = line.match(avCodecRegexp);
|
||||
if (match && match[7] !== '=') {
|
||||
data[match[7]] = {
|
||||
type: { 'V': 'video', 'A': 'audio', 'S': 'subtitle' }[match[3]],
|
||||
description: match[8],
|
||||
canDecode: match[1] === 'D',
|
||||
canEncode: match[2] === 'E',
|
||||
drawHorizBand: match[4] === 'S',
|
||||
directRendering: match[5] === 'D',
|
||||
weirdFrameTruncation: match[6] === 'T'
|
||||
};
|
||||
}
|
||||
|
||||
match = line.match(ffCodecRegexp);
|
||||
if (match && match[7] !== '=') {
|
||||
var codecData = data[match[7]] = {
|
||||
type: { 'V': 'video', 'A': 'audio', 'S': 'subtitle' }[match[3]],
|
||||
description: match[8],
|
||||
canDecode: match[1] === 'D',
|
||||
canEncode: match[2] === 'E',
|
||||
intraFrameOnly: match[4] === 'I',
|
||||
isLossy: match[5] === 'L',
|
||||
isLossless: match[6] === 'S'
|
||||
};
|
||||
|
||||
var encoders = codecData.description.match(ffEncodersRegexp);
|
||||
encoders = encoders ? encoders[1].trim().split(' ') : [];
|
||||
|
||||
var decoders = codecData.description.match(ffDecodersRegexp);
|
||||
decoders = decoders ? decoders[1].trim().split(' ') : [];
|
||||
|
||||
if (encoders.length || decoders.length) {
|
||||
var coderData = {};
|
||||
utils.copy(codecData, coderData);
|
||||
delete coderData.canEncode;
|
||||
delete coderData.canDecode;
|
||||
|
||||
encoders.forEach(function(name) {
|
||||
data[name] = {};
|
||||
utils.copy(coderData, data[name]);
|
||||
data[name].canEncode = true;
|
||||
});
|
||||
|
||||
decoders.forEach(function(name) {
|
||||
if (name in data) {
|
||||
data[name].canDecode = true;
|
||||
} else {
|
||||
data[name] = {};
|
||||
utils.copy(coderData, data[name]);
|
||||
data[name].canDecode = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
callback(null, cache.codecs = data);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A callback passed to {@link FfmpegCommand#availableEncoders}.
|
||||
*
|
||||
* @callback FfmpegCommand~encodersCallback
|
||||
* @param {Error|null} err error object or null if no error happened
|
||||
* @param {Object} encoders encoders object with encoder names as keys and the following
|
||||
* properties for each encoder:
|
||||
* @param {String} encoders.description codec description
|
||||
* @param {Boolean} encoders.type "audio", "video" or "subtitle"
|
||||
* @param {Boolean} encoders.frameMT whether the encoder is able to do frame-level multithreading
|
||||
* @param {Boolean} encoders.sliceMT whether the encoder is able to do slice-level multithreading
|
||||
* @param {Boolean} encoders.experimental whether the encoder is experimental
|
||||
* @param {Boolean} encoders.drawHorizBand whether the encoder supports draw_horiz_band
|
||||
* @param {Boolean} encoders.directRendering whether the encoder supports direct encoding method 1
|
||||
*/
|
||||
|
||||
/**
|
||||
* Query ffmpeg for available encoders
|
||||
*
|
||||
* @method FfmpegCommand#availableEncoders
|
||||
* @category Capabilities
|
||||
* @aliases getAvailableEncoders
|
||||
*
|
||||
* @param {FfmpegCommand~encodersCallback} callback callback function
|
||||
*/
|
||||
proto.availableEncoders =
|
||||
proto.getAvailableEncoders = function(callback) {
|
||||
if ('encoders' in cache) {
|
||||
return callback(null, cache.encoders);
|
||||
}
|
||||
|
||||
this._spawnFfmpeg(['-encoders'], { captureStdout: true, stdoutLines: 0 }, function(err, stdoutRing) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
var stdout = stdoutRing.get();
|
||||
var lines = stdout.split(lineBreakRegexp);
|
||||
var data = {};
|
||||
|
||||
lines.forEach(function(line) {
|
||||
var match = line.match(encodersRegexp);
|
||||
if (match && match[7] !== '=') {
|
||||
data[match[7]] = {
|
||||
type: { 'V': 'video', 'A': 'audio', 'S': 'subtitle' }[match[1]],
|
||||
description: match[8],
|
||||
frameMT: match[2] === 'F',
|
||||
sliceMT: match[3] === 'S',
|
||||
experimental: match[4] === 'X',
|
||||
drawHorizBand: match[5] === 'B',
|
||||
directRendering: match[6] === 'D'
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
callback(null, cache.encoders = data);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A callback passed to {@link FfmpegCommand#availableFormats}.
|
||||
*
|
||||
* @callback FfmpegCommand~formatCallback
|
||||
* @param {Error|null} err error object or null if no error happened
|
||||
* @param {Object} formats format object with format names as keys and the following
|
||||
* properties for each format:
|
||||
* @param {String} formats.description format description
|
||||
* @param {Boolean} formats.canDemux whether the format is able to demux streams from an input file
|
||||
* @param {Boolean} formats.canMux whether the format is able to mux streams into an output file
|
||||
*/
|
||||
|
||||
/**
|
||||
* Query ffmpeg for available formats
|
||||
*
|
||||
* @method FfmpegCommand#availableFormats
|
||||
* @category Capabilities
|
||||
* @aliases getAvailableFormats
|
||||
*
|
||||
* @param {FfmpegCommand~formatCallback} callback callback function
|
||||
*/
|
||||
proto.availableFormats =
|
||||
proto.getAvailableFormats = function(callback) {
|
||||
if ('formats' in cache) {
|
||||
return callback(null, cache.formats);
|
||||
}
|
||||
|
||||
// Run ffmpeg -formats
|
||||
this._spawnFfmpeg(['-formats'], { captureStdout: true, stdoutLines: 0 }, function (err, stdoutRing) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
// Parse output
|
||||
var stdout = stdoutRing.get();
|
||||
var lines = stdout.split(lineBreakRegexp);
|
||||
var data = {};
|
||||
|
||||
lines.forEach(function(line) {
|
||||
var match = line.match(formatRegexp);
|
||||
if (match) {
|
||||
match[3].split(',').forEach(function(format) {
|
||||
if (!(format in data)) {
|
||||
data[format] = {
|
||||
description: match[4],
|
||||
canDemux: false,
|
||||
canMux: false
|
||||
};
|
||||
}
|
||||
|
||||
if (match[1] === 'D') {
|
||||
data[format].canDemux = true;
|
||||
}
|
||||
if (match[2] === 'E') {
|
||||
data[format].canMux = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
callback(null, cache.formats = data);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Check capabilities before executing a command
|
||||
*
|
||||
* Checks whether all used codecs and formats are indeed available
|
||||
*
|
||||
* @method FfmpegCommand#_checkCapabilities
|
||||
* @param {Function} callback callback with signature (err)
|
||||
* @private
|
||||
*/
|
||||
proto._checkCapabilities = function(callback) {
|
||||
var self = this;
|
||||
async.waterfall([
|
||||
// Get available formats
|
||||
function(cb) {
|
||||
self.availableFormats(cb);
|
||||
},
|
||||
|
||||
// Check whether specified formats are available
|
||||
function(formats, cb) {
|
||||
var unavailable;
|
||||
|
||||
// Output format(s)
|
||||
unavailable = self._outputs
|
||||
.reduce(function(fmts, output) {
|
||||
var format = output.options.find('-f', 1);
|
||||
if (format) {
|
||||
if (!(format[0] in formats) || !(formats[format[0]].canMux)) {
|
||||
fmts.push(format);
|
||||
}
|
||||
}
|
||||
|
||||
return fmts;
|
||||
}, []);
|
||||
|
||||
if (unavailable.length === 1) {
|
||||
return cb(new Error('Output format ' + unavailable[0] + ' is not available'));
|
||||
} else if (unavailable.length > 1) {
|
||||
return cb(new Error('Output formats ' + unavailable.join(', ') + ' are not available'));
|
||||
}
|
||||
|
||||
// Input format(s)
|
||||
unavailable = self._inputs
|
||||
.reduce(function(fmts, input) {
|
||||
var format = input.options.find('-f', 1);
|
||||
if (format) {
|
||||
if (!(format[0] in formats) || !(formats[format[0]].canDemux)) {
|
||||
fmts.push(format[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return fmts;
|
||||
}, []);
|
||||
|
||||
if (unavailable.length === 1) {
|
||||
return cb(new Error('Input format ' + unavailable[0] + ' is not available'));
|
||||
} else if (unavailable.length > 1) {
|
||||
return cb(new Error('Input formats ' + unavailable.join(', ') + ' are not available'));
|
||||
}
|
||||
|
||||
cb();
|
||||
},
|
||||
|
||||
// Get available codecs
|
||||
function(cb) {
|
||||
self.availableEncoders(cb);
|
||||
},
|
||||
|
||||
// Check whether specified codecs are available and add strict experimental options if needed
|
||||
function(encoders, cb) {
|
||||
var unavailable;
|
||||
|
||||
// Audio codec(s)
|
||||
unavailable = self._outputs.reduce(function(cdcs, output) {
|
||||
var acodec = output.audio.find('-acodec', 1);
|
||||
if (acodec && acodec[0] !== 'copy') {
|
||||
if (!(acodec[0] in encoders) || encoders[acodec[0]].type !== 'audio') {
|
||||
cdcs.push(acodec[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return cdcs;
|
||||
}, []);
|
||||
|
||||
if (unavailable.length === 1) {
|
||||
return cb(new Error('Audio codec ' + unavailable[0] + ' is not available'));
|
||||
} else if (unavailable.length > 1) {
|
||||
return cb(new Error('Audio codecs ' + unavailable.join(', ') + ' are not available'));
|
||||
}
|
||||
|
||||
// Video codec(s)
|
||||
unavailable = self._outputs.reduce(function(cdcs, output) {
|
||||
var vcodec = output.video.find('-vcodec', 1);
|
||||
if (vcodec && vcodec[0] !== 'copy') {
|
||||
if (!(vcodec[0] in encoders) || encoders[vcodec[0]].type !== 'video') {
|
||||
cdcs.push(vcodec[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return cdcs;
|
||||
}, []);
|
||||
|
||||
if (unavailable.length === 1) {
|
||||
return cb(new Error('Video codec ' + unavailable[0] + ' is not available'));
|
||||
} else if (unavailable.length > 1) {
|
||||
return cb(new Error('Video codecs ' + unavailable.join(', ') + ' are not available'));
|
||||
}
|
||||
|
||||
cb();
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun May 01 2016 12:10:37 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
262
node_modules/fluent-ffmpeg/doc/custom.js.html
generated
vendored
Normal file
262
node_modules/fluent-ffmpeg/doc/custom.js.html
generated
vendored
Normal file
@@ -0,0 +1,262 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: options/custom.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: options/custom.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*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;
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
311
node_modules/fluent-ffmpeg/doc/ffprobe.js.html
generated
vendored
Normal file
311
node_modules/fluent-ffmpeg/doc/ffprobe.js.html
generated
vendored
Normal file
@@ -0,0 +1,311 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: ffprobe.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: ffprobe.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*jshint node:true, laxcomma:true*/
|
||||
'use strict';
|
||||
|
||||
var spawn = require('child_process').spawn;
|
||||
|
||||
|
||||
function legacyTag(key) { return key.match(/^TAG:/); }
|
||||
function legacyDisposition(key) { return key.match(/^DISPOSITION:/); }
|
||||
|
||||
function parseFfprobeOutput(out) {
|
||||
var lines = out.split(/\r\n|\r|\n/);
|
||||
|
||||
lines = lines.filter(function (line) {
|
||||
return line.length > 0;
|
||||
});
|
||||
|
||||
var data = {
|
||||
streams: [],
|
||||
format: {},
|
||||
chapters: []
|
||||
};
|
||||
|
||||
function parseBlock(name) {
|
||||
var data = {};
|
||||
|
||||
var line = lines.shift();
|
||||
while (typeof line !== 'undefined') {
|
||||
if (line.toLowerCase() == '[/'+name+']') {
|
||||
return data;
|
||||
} else if (line.match(/^\[/)) {
|
||||
line = lines.shift();
|
||||
continue;
|
||||
}
|
||||
|
||||
var kv = line.match(/^([^=]+)=(.*)$/);
|
||||
if (kv) {
|
||||
if (!(kv[1].match(/^TAG:/)) && kv[2].match(/^[0-9]+(\.[0-9]+)?$/)) {
|
||||
data[kv[1]] = Number(kv[2]);
|
||||
} else {
|
||||
data[kv[1]] = kv[2];
|
||||
}
|
||||
}
|
||||
|
||||
line = lines.shift();
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var line = lines.shift();
|
||||
while (typeof line !== 'undefined') {
|
||||
if (line.match(/^\[stream/i)) {
|
||||
var stream = parseBlock('stream');
|
||||
data.streams.push(stream);
|
||||
} else if (line.match(/^\[chapter/i)) {
|
||||
var chapter = parseBlock('chapter');
|
||||
data.chapters.push(chapter);
|
||||
} else if (line.toLowerCase() === '[format]') {
|
||||
data.format = parseBlock('format');
|
||||
}
|
||||
|
||||
line = lines.shift();
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
module.exports = function(proto) {
|
||||
/**
|
||||
* A callback passed to the {@link FfmpegCommand#ffprobe} method.
|
||||
*
|
||||
* @callback FfmpegCommand~ffprobeCallback
|
||||
*
|
||||
* @param {Error|null} err error object or null if no error happened
|
||||
* @param {Object} ffprobeData ffprobe output data; this object
|
||||
* has the same format as what the following command returns:
|
||||
*
|
||||
* `ffprobe -print_format json -show_streams -show_format INPUTFILE`
|
||||
* @param {Array} ffprobeData.streams stream information
|
||||
* @param {Object} ffprobeData.format format information
|
||||
*/
|
||||
|
||||
/**
|
||||
* Run ffprobe on last specified input
|
||||
*
|
||||
* @method FfmpegCommand#ffprobe
|
||||
* @category Metadata
|
||||
*
|
||||
* @param {?Number} [index] 0-based index of input to probe (defaults to last input)
|
||||
* @param {?String[]} [options] array of output options to return
|
||||
* @param {FfmpegCommand~ffprobeCallback} callback callback function
|
||||
*
|
||||
*/
|
||||
proto.ffprobe = function() {
|
||||
var input, index = null, options = [], callback;
|
||||
|
||||
// the last argument should be the callback
|
||||
var callback = arguments[arguments.length - 1];
|
||||
|
||||
var ended = false
|
||||
function handleCallback(err, data) {
|
||||
if (!ended) {
|
||||
ended = true;
|
||||
callback(err, data);
|
||||
}
|
||||
};
|
||||
|
||||
// map the arguments to the correct variable names
|
||||
switch (arguments.length) {
|
||||
case 3:
|
||||
index = arguments[0];
|
||||
options = arguments[1];
|
||||
break;
|
||||
case 2:
|
||||
if (typeof arguments[0] === 'number') {
|
||||
index = arguments[0];
|
||||
} else if (Array.isArray(arguments[0])) {
|
||||
options = arguments[0];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (index === null) {
|
||||
if (!this._currentInput) {
|
||||
return handleCallback(new Error('No input specified'));
|
||||
}
|
||||
|
||||
input = this._currentInput;
|
||||
} else {
|
||||
input = this._inputs[index];
|
||||
|
||||
if (!input) {
|
||||
return handleCallback(new Error('Invalid input index'));
|
||||
}
|
||||
}
|
||||
|
||||
// Find ffprobe
|
||||
this._getFfprobePath(function(err, path) {
|
||||
if (err) {
|
||||
return handleCallback(err);
|
||||
} else if (!path) {
|
||||
return handleCallback(new Error('Cannot find ffprobe'));
|
||||
}
|
||||
|
||||
var stdout = '';
|
||||
var stdoutClosed = false;
|
||||
var stderr = '';
|
||||
var stderrClosed = false;
|
||||
|
||||
// Spawn ffprobe
|
||||
var src = input.isStream ? 'pipe:0' : input.source;
|
||||
var ffprobe = spawn(path, ['-show_streams', '-show_format'].concat(options, src));
|
||||
|
||||
if (input.isStream) {
|
||||
// Skip errors on stdin. These get thrown when ffprobe is complete and
|
||||
// there seems to be no way hook in and close stdin before it throws.
|
||||
ffprobe.stdin.on('error', function(err) {
|
||||
if (['ECONNRESET', 'EPIPE'].indexOf(err.code) >= 0) { return; }
|
||||
handleCallback(err);
|
||||
});
|
||||
|
||||
// Once ffprobe's input stream closes, we need no more data from the
|
||||
// input
|
||||
ffprobe.stdin.on('close', function() {
|
||||
input.source.pause();
|
||||
input.source.unpipe(ffprobe.stdin);
|
||||
});
|
||||
|
||||
input.source.pipe(ffprobe.stdin);
|
||||
}
|
||||
|
||||
ffprobe.on('error', callback);
|
||||
|
||||
// Ensure we wait for captured streams to end before calling callback
|
||||
var exitError = null;
|
||||
function handleExit(err) {
|
||||
if (err) {
|
||||
exitError = err;
|
||||
}
|
||||
|
||||
if (processExited && stdoutClosed && stderrClosed) {
|
||||
if (exitError) {
|
||||
if (stderr) {
|
||||
exitError.message += '\n' + stderr;
|
||||
}
|
||||
|
||||
return handleCallback(exitError);
|
||||
}
|
||||
|
||||
// Process output
|
||||
var data = parseFfprobeOutput(stdout);
|
||||
|
||||
// Handle legacy output with "TAG:x" and "DISPOSITION:x" keys
|
||||
[data.format].concat(data.streams).forEach(function(target) {
|
||||
if (target) {
|
||||
var legacyTagKeys = Object.keys(target).filter(legacyTag);
|
||||
|
||||
if (legacyTagKeys.length) {
|
||||
target.tags = target.tags || {};
|
||||
|
||||
legacyTagKeys.forEach(function(tagKey) {
|
||||
target.tags[tagKey.substr(4)] = target[tagKey];
|
||||
delete target[tagKey];
|
||||
});
|
||||
}
|
||||
|
||||
var legacyDispositionKeys = Object.keys(target).filter(legacyDisposition);
|
||||
|
||||
if (legacyDispositionKeys.length) {
|
||||
target.disposition = target.disposition || {};
|
||||
|
||||
legacyDispositionKeys.forEach(function(dispositionKey) {
|
||||
target.disposition[dispositionKey.substr(12)] = target[dispositionKey];
|
||||
delete target[dispositionKey];
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
handleCallback(null, data);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle ffprobe exit
|
||||
var processExited = false;
|
||||
ffprobe.on('exit', function(code, signal) {
|
||||
processExited = true;
|
||||
|
||||
if (code) {
|
||||
handleExit(new Error('ffprobe exited with code ' + code));
|
||||
} else if (signal) {
|
||||
handleExit(new Error('ffprobe was killed with signal ' + signal));
|
||||
} else {
|
||||
handleExit();
|
||||
}
|
||||
});
|
||||
|
||||
// Handle stdout/stderr streams
|
||||
ffprobe.stdout.on('data', function(data) {
|
||||
stdout += data;
|
||||
});
|
||||
|
||||
ffprobe.stdout.on('close', function() {
|
||||
stdoutClosed = true;
|
||||
handleExit();
|
||||
});
|
||||
|
||||
ffprobe.stderr.on('data', function(data) {
|
||||
stderr += data;
|
||||
});
|
||||
|
||||
ffprobe.stderr.on('close', function() {
|
||||
stderrClosed = true;
|
||||
handleExit();
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun May 01 2016 12:10:37 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
271
node_modules/fluent-ffmpeg/doc/fluent-ffmpeg.js.html
generated
vendored
Normal file
271
node_modules/fluent-ffmpeg/doc/fluent-ffmpeg.js.html
generated
vendored
Normal file
@@ -0,0 +1,271 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: fluent-ffmpeg.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: fluent-ffmpeg.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*jshint node:true*/
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var util = require('util');
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
var utils = require('./utils');
|
||||
var ARGLISTS = ['_global', '_audio', '_audioFilters', '_video', '_videoFilters', '_sizeFilters', '_complexFilters'];
|
||||
|
||||
|
||||
/**
|
||||
* Create an ffmpeg command
|
||||
*
|
||||
* Can be called with or without the 'new' operator, and the 'input' parameter
|
||||
* may be specified as 'options.source' instead (or passed later with the
|
||||
* addInput method).
|
||||
*
|
||||
* @constructor
|
||||
* @param {String|ReadableStream} [input] input file path or readable stream
|
||||
* @param {Object} [options] command options
|
||||
* @param {Object} [options.logger=<no logging>] logger object with 'error', 'warning', 'info' and 'debug' methods
|
||||
* @param {Number} [options.niceness=0] ffmpeg process niceness, ignored on Windows
|
||||
* @param {Number} [options.priority=0] alias for `niceness`
|
||||
* @param {String} [options.presets="fluent-ffmpeg/lib/presets"] directory to load presets from
|
||||
* @param {String} [options.preset="fluent-ffmpeg/lib/presets"] alias for `presets`
|
||||
* @param {String} [options.stdoutLines=100] maximum lines of ffmpeg output to keep in memory, use 0 for unlimited
|
||||
* @param {Number} [options.timeout=<no timeout>] ffmpeg processing timeout in seconds
|
||||
* @param {String|ReadableStream} [options.source=<no input>] alias for the `input` parameter
|
||||
*/
|
||||
function FfmpegCommand(input, options) {
|
||||
// Make 'new' optional
|
||||
if (!(this instanceof FfmpegCommand)) {
|
||||
return new FfmpegCommand(input, options);
|
||||
}
|
||||
|
||||
EventEmitter.call(this);
|
||||
|
||||
if (typeof input === 'object' && !('readable' in input)) {
|
||||
// Options object passed directly
|
||||
options = input;
|
||||
} else {
|
||||
// Input passed first
|
||||
options = options || {};
|
||||
options.source = input;
|
||||
}
|
||||
|
||||
// Add input if present
|
||||
this._inputs = [];
|
||||
if (options.source) {
|
||||
this.input(options.source);
|
||||
}
|
||||
|
||||
// Add target-less output for backwards compatibility
|
||||
this._outputs = [];
|
||||
this.output();
|
||||
|
||||
// Create argument lists
|
||||
var self = this;
|
||||
['_global', '_complexFilters'].forEach(function(prop) {
|
||||
self[prop] = utils.args();
|
||||
});
|
||||
|
||||
// Set default option values
|
||||
options.stdoutLines = 'stdoutLines' in options ? options.stdoutLines : 100;
|
||||
options.presets = options.presets || options.preset || path.join(__dirname, 'presets');
|
||||
options.niceness = options.niceness || options.priority || 0;
|
||||
|
||||
// Save options
|
||||
this.options = options;
|
||||
|
||||
// Setup logger
|
||||
this.logger = options.logger || {
|
||||
debug: function() {},
|
||||
info: function() {},
|
||||
warn: function() {},
|
||||
error: function() {}
|
||||
};
|
||||
}
|
||||
util.inherits(FfmpegCommand, EventEmitter);
|
||||
module.exports = FfmpegCommand;
|
||||
|
||||
|
||||
/**
|
||||
* Clone an ffmpeg command
|
||||
*
|
||||
* This method is useful when you want to process the same input multiple times.
|
||||
* It returns a new FfmpegCommand instance with the exact same options.
|
||||
*
|
||||
* All options set _after_ the clone() call will only be applied to the instance
|
||||
* it has been called on.
|
||||
*
|
||||
* @example
|
||||
* var command = ffmpeg('/path/to/source.avi')
|
||||
* .audioCodec('libfaac')
|
||||
* .videoCodec('libx264')
|
||||
* .format('mp4');
|
||||
*
|
||||
* command.clone()
|
||||
* .size('320x200')
|
||||
* .save('/path/to/output-small.mp4');
|
||||
*
|
||||
* command.clone()
|
||||
* .size('640x400')
|
||||
* .save('/path/to/output-medium.mp4');
|
||||
*
|
||||
* command.save('/path/to/output-original-size.mp4');
|
||||
*
|
||||
* @method FfmpegCommand#clone
|
||||
* @return FfmpegCommand
|
||||
*/
|
||||
FfmpegCommand.prototype.clone = function() {
|
||||
var clone = new FfmpegCommand();
|
||||
var self = this;
|
||||
|
||||
// Clone options and logger
|
||||
clone.options = this.options;
|
||||
clone.logger = this.logger;
|
||||
|
||||
// Clone inputs
|
||||
clone._inputs = this._inputs.map(function(input) {
|
||||
return {
|
||||
source: input.source,
|
||||
options: input.options.clone()
|
||||
};
|
||||
});
|
||||
|
||||
// Create first output
|
||||
if ('target' in this._outputs[0]) {
|
||||
// We have outputs set, don't clone them and create first output
|
||||
clone._outputs = [];
|
||||
clone.output();
|
||||
} else {
|
||||
// No outputs set, clone first output options
|
||||
clone._outputs = [
|
||||
clone._currentOutput = {
|
||||
flags: {}
|
||||
}
|
||||
];
|
||||
|
||||
['audio', 'audioFilters', 'video', 'videoFilters', 'sizeFilters', 'options'].forEach(function(key) {
|
||||
clone._currentOutput[key] = self._currentOutput[key].clone();
|
||||
});
|
||||
|
||||
if (this._currentOutput.sizeData) {
|
||||
clone._currentOutput.sizeData = {};
|
||||
utils.copy(this._currentOutput.sizeData, clone._currentOutput.sizeData);
|
||||
}
|
||||
|
||||
utils.copy(this._currentOutput.flags, clone._currentOutput.flags);
|
||||
}
|
||||
|
||||
// Clone argument lists
|
||||
['_global', '_complexFilters'].forEach(function(prop) {
|
||||
clone[prop] = self[prop].clone();
|
||||
});
|
||||
|
||||
return clone;
|
||||
};
|
||||
|
||||
|
||||
/* Add methods from options submodules */
|
||||
|
||||
require('./options/inputs')(FfmpegCommand.prototype);
|
||||
require('./options/audio')(FfmpegCommand.prototype);
|
||||
require('./options/video')(FfmpegCommand.prototype);
|
||||
require('./options/videosize')(FfmpegCommand.prototype);
|
||||
require('./options/output')(FfmpegCommand.prototype);
|
||||
require('./options/custom')(FfmpegCommand.prototype);
|
||||
require('./options/misc')(FfmpegCommand.prototype);
|
||||
|
||||
|
||||
/* Add processor methods */
|
||||
|
||||
require('./processor')(FfmpegCommand.prototype);
|
||||
|
||||
|
||||
/* Add capabilities methods */
|
||||
|
||||
require('./capabilities')(FfmpegCommand.prototype);
|
||||
|
||||
FfmpegCommand.setFfmpegPath = function(path) {
|
||||
(new FfmpegCommand()).setFfmpegPath(path);
|
||||
};
|
||||
|
||||
FfmpegCommand.setFfprobePath = function(path) {
|
||||
(new FfmpegCommand()).setFfprobePath(path);
|
||||
};
|
||||
|
||||
FfmpegCommand.setFlvtoolPath = function(path) {
|
||||
(new FfmpegCommand()).setFlvtoolPath(path);
|
||||
};
|
||||
|
||||
FfmpegCommand.availableFilters =
|
||||
FfmpegCommand.getAvailableFilters = function(callback) {
|
||||
(new FfmpegCommand()).availableFilters(callback);
|
||||
};
|
||||
|
||||
FfmpegCommand.availableCodecs =
|
||||
FfmpegCommand.getAvailableCodecs = function(callback) {
|
||||
(new FfmpegCommand()).availableCodecs(callback);
|
||||
};
|
||||
|
||||
FfmpegCommand.availableFormats =
|
||||
FfmpegCommand.getAvailableFormats = function(callback) {
|
||||
(new FfmpegCommand()).availableFormats(callback);
|
||||
};
|
||||
|
||||
|
||||
/* Add ffprobe methods */
|
||||
|
||||
require('./ffprobe')(FfmpegCommand.prototype);
|
||||
|
||||
FfmpegCommand.ffprobe = function(file) {
|
||||
var instance = new FfmpegCommand(file);
|
||||
instance.ffprobe.apply(instance, Array.prototype.slice.call(arguments, 1));
|
||||
};
|
||||
|
||||
/* Add processing recipes */
|
||||
|
||||
require('./recipes')(FfmpegCommand.prototype);
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun May 01 2016 12:10:37 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
932
node_modules/fluent-ffmpeg/doc/global.html
generated
vendored
Normal file
932
node_modules/fluent-ffmpeg/doc/global.html
generated
vendored
Normal file
@@ -0,0 +1,932 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Global</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Global</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
|
||||
<header>
|
||||
<h2>
|
||||
|
||||
</h2>
|
||||
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<div class="container-overview">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3 class="subsection-title">Methods</h3>
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="createSizeFilters"><span class="type-signature"><private> </span>createSizeFilters<span class="signature">(command, key, value)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
<div class="description">
|
||||
<p>Recompute size filters</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>command</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type"><a href="FfmpegCommand.html">FfmpegCommand</a></span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>key</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">String</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"><p>newly-added parameter name ('size', 'aspect' or 'pad')</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>value</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">String</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"><p>newly-added parameter value</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="videosize.js.html">options/videosize.js</a>, <a href="videosize.js.html#line72">line 72</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Returns:</h5>
|
||||
|
||||
|
||||
<div class="param-desc">
|
||||
<p>filter string array</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="getScalePadFilters"><span class="type-signature"><private> </span>getScalePadFilters<span class="signature">(width, height, aspect, color)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
<div class="description">
|
||||
<p>Return filters to pad video to width*height,</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>width</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">Number</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"><p>output width</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>height</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">Number</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"><p>output height</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>aspect</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">Number</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"><p>video aspect ratio (without padding)</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>color</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">Number</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"><p>padding color</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="videosize.js.html">options/videosize.js</a>, <a href="videosize.js.html#line19">line 19</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Returns:</h5>
|
||||
|
||||
|
||||
<div class="param-desc">
|
||||
<p>scale/pad filters</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="parseProgressLine"><span class="type-signature"><private> </span>parseProgressLine<span class="signature">(line)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
<div class="description">
|
||||
<p>Parse progress line from ffmpeg stderr</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>line</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">String</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"><p>progress line</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line16">line 16</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Returns:</h5>
|
||||
|
||||
|
||||
<div class="param-desc">
|
||||
<p>progress object</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="process"><span class="type-signature"><private> </span>process<span class="signature">(command, target, <span class="optional">pipeOptions</span>)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
<th>Argument</th>
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>command</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type"><a href="FfmpegCommand.html">FfmpegCommand</a></span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>target</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">String</span>
|
||||
|
|
||||
|
||||
<span class="param-type">Writable</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>pipeOptions</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">Object</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
<optional><br>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="processor.js.html">processor.js</a>, <a href="processor.js.html#line47">line 47</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="runFfprobe"><span class="type-signature"><private> </span>runFfprobe<span class="signature">(command)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
<div class="description">
|
||||
<p>Run ffprobe asynchronously and store data in command</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>command</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type"><a href="FfmpegCommand.html">FfmpegCommand</a></span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="processor.js.html">processor.js</a>, <a href="processor.js.html#line194">line 194</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li></ul><h3>Events</h3><ul><li><a href="FfmpegCommand.html#event:codecData">codecData</a></li><li><a href="FfmpegCommand.html#event:end">end</a></li><li><a href="FfmpegCommand.html#event:error">error</a></li><li><a href="FfmpegCommand.html#event:progress">progress</a></li><li><a href="FfmpegCommand.html#event:start">start</a></li></ul><h3>Global</h3><ul><li><a href="global.html#createSizeFilters">createSizeFilters</a></li><li><a href="global.html#getScalePadFilters">getScalePadFilters</a></li><li><a href="global.html#parseProgressLine">parseProgressLine</a></li><li><a href="global.html#process">process</a></li><li><a href="global.html#runFfprobe">runFfprobe</a></li></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Thu May 01 2014 13:29:29 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
973
node_modules/fluent-ffmpeg/doc/index.html
generated
vendored
Normal file
973
node_modules/fluent-ffmpeg/doc/index.html
generated
vendored
Normal file
@@ -0,0 +1,973 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Index</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Index</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3> </h3>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article><h1>Fluent ffmpeg-API for node.js</h1><p>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 <a href="http://www.ffmpeg.org">ffmpeg</a> installed on your system (including all necessary encoding libraries like libmp3lame or libx264).</p>
|
||||
<blockquote>
|
||||
<p>This is the documentation for fluent-ffmpeg 2.x.
|
||||
You can still access the code and documentation for fluent-ffmpeg 1.7 <a href="https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/tree/1.x">here</a>.</p>
|
||||
</blockquote>
|
||||
<a name="installation"></a><h2>Installation</h2><p>Via npm:</p>
|
||||
<pre class="prettyprint source lang-sh"><code>$ npm install fluent-ffmpeg</code></pre><p>Or as a submodule:</p>
|
||||
<pre class="prettyprint source lang-sh"><code>$ git submodule add git://github.com/schaermu/node-fluent-ffmpeg.git vendor/fluent-ffmpeg</code></pre><a name="usage"></a><h2>Usage</h2><p>You will find a lot of usage examples (including a real-time streaming example using <a href="http://www.flowplayer.org">flowplayer</a> and <a href="https://github.com/visionmedia/express">express</a>!) in the <code>examples</code> folder.</p>
|
||||
<a name="prerequisites"></a><h3>Prerequisites</h3><h4>ffmpeg and ffprobe</h4><p>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).</p>
|
||||
<p>If the <code>FFMPEG_PATH</code> environment variable is set, fluent-ffmpeg will use it as the full path to the <code>ffmpeg</code> executable. Otherwise, it will attempt to call <code>ffmpeg</code> directly (so it should be in your <code>PATH</code>). You must also have ffprobe installed (it comes with ffmpeg in most distributions). Similarly, fluent-ffmpeg will use the <code>FFPROBE_PATH</code> environment variable if it is set, otherwise it will attempt to call it in the <code>PATH</code>.</p>
|
||||
<p>Most features should work when using avconv and avprobe instead of ffmpeg and ffprobe, but they are not officially supported at the moment.</p>
|
||||
<p><strong>Windows users</strong>: most probably ffmpeg and ffprobe will <em>not</em> be in your <code>%PATH</code>, so you <em>must</em> set <code>%FFMPEG_PATH</code> and <code>%FFPROBE_PATH</code>.</p>
|
||||
<p><strong>Debian/Ubuntu users</strong>: the official repositories have the ffmpeg/ffprobe executable in the <code>libav-tools</code> 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 <code>ppa:jon-severinsson/ffmpeg</code> PPA provides recent builds).</p>
|
||||
<h4>flvtool2 or flvmeta</h4><p>If you intend to encode FLV videos, you must have either flvtool2 or flvmeta installed and in your <code>PATH</code> or fluent-ffmpeg won't be able to produce streamable output files. If you set either the <code>FLVTOOL2_PATH</code> or <code>FLVMETA_PATH</code>, fluent-ffmpeg will try to use it instead of searching in the <code>PATH</code>.</p>
|
||||
<h4>Setting binary paths manually</h4><p>Alternatively, you may set the ffmpeg, ffprobe and flvtool2/flvmeta binary paths manually by using the following API commands:</p>
|
||||
<ul>
|
||||
<li><strong>Ffmpeg.setFfmpegPath(path)</strong> Argument <code>path</code> is a string with the full path to the ffmpeg binary.</li>
|
||||
<li><strong>Ffmpeg.setFfprobePath(path)</strong> Argument <code>path</code> is a string with the full path to the ffprobe binary.</li>
|
||||
<li><strong>Ffmpeg.setFlvtoolPath(path)</strong> Argument <code>path</code> is a string with the full path to the flvtool2 or flvmeta binary.</li>
|
||||
</ul>
|
||||
<a name="creating-an-ffmpeg-command"></a><h3>Creating an FFmpeg command</h3><p>The fluent-ffmpeg module returns a constructor that you can use to instanciate FFmpeg commands.</p>
|
||||
<pre class="prettyprint source lang-js"><code>var FfmpegCommand = require('fluent-ffmpeg');
|
||||
var command = new FfmpegCommand();</code></pre><p>You can also use the constructor without the <code>new</code> operator.</p>
|
||||
<pre class="prettyprint source lang-js"><code>var ffmpeg = require('fluent-ffmpeg');
|
||||
var command = ffmpeg();</code></pre><p>You may pass an input file name or readable stream, a configuration object, or both to the constructor.</p>
|
||||
<pre class="prettyprint source lang-js"><code>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", ... });</code></pre><p>The following options are available:</p>
|
||||
<ul>
|
||||
<li><code>source</code>: input file name or readable stream (ignored if an input file is passed to the constructor)</li>
|
||||
<li><code>timeout</code>: ffmpeg timeout in seconds (defaults to no timeout)</li>
|
||||
<li><code>preset</code> or <code>presets</code>: directory to load module presets from (defaults to the <code>lib/presets</code> directory in fluent-ffmpeg tree)</li>
|
||||
<li><code>niceness</code> or <code>priority</code>: ffmpeg niceness value, between -20 and 20; ignored on Windows platforms (defaults to 0)</li>
|
||||
<li><code>logger</code>: logger object with <code>debug()</code>, <code>info()</code>, <code>warn()</code> and <code>error()</code> methods (defaults to no logging)</li>
|
||||
<li><code>stdoutLines</code>: maximum number of lines from ffmpeg stdout/stderr to keep in memory (defaults to 100, use 0 for unlimited storage)</li>
|
||||
</ul>
|
||||
<a name="specifying-inputs"></a><h3>Specifying inputs</h3><p>You can add any number of inputs to an Ffmpeg command. An input can be:</p>
|
||||
<ul>
|
||||
<li>a file name (eg. <code>/path/to/file.avi</code>);</li>
|
||||
<li>an image pattern (eg. <code>/path/to/frame%03d.png</code>);</li>
|
||||
<li>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.</li>
|
||||
</ul>
|
||||
<pre class="prettyprint source lang-js"><code>// 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');</code></pre><a name="input-options"></a><h3>Input options</h3><p>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.</p>
|
||||
<h4>inputFormat(format): specify input format</h4><p><strong>Aliases</strong>: <code>fromFormat()</code>, <code>withInputFormat()</code>.</p>
|
||||
<p>This is only useful for raw inputs, as ffmpeg can determine the input format automatically.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg()
|
||||
.input('/dev/video0')
|
||||
.inputFormat('mov')
|
||||
.input('/path/to/file.avi')
|
||||
.inputFormat('avi');</code></pre><p>Fluent-ffmpeg checks for format availability before actually running the command, and throws an error when a specified input format is not available.</p>
|
||||
<h4>inputFPS(fps): specify input framerate</h4><p><strong>Aliases</strong>: <code>withInputFps()</code>, <code>withInputFPS()</code>, <code>withFpsInput()</code>, <code>withFPSInput()</code>, <code>inputFps()</code>, <code>fpsInput()</code>, <code>FPSInput()</code>.</p>
|
||||
<p>This is only valid for raw inputs, as ffmpeg can determine the input framerate automatically.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/dev/video0').inputFPS(29.7);</code></pre><h4>native(): read input at native framerate</h4><p><strong>Aliases</strong>: <code>nativeFramerate()</code>, <code>withNativeFramerate()</code>.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').native();</code></pre><h4>seekInput(time): set input start time</h4><p><strong>Alias</strong>: <code>setStartTime()</code>.</p>
|
||||
<p>Seeks an input and only start decoding at given time offset. The <code>time</code> argument may be a number (in seconds) or a timestamp string (with format <code>[[hh:]mm:]ss[.xxx]</code>).</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').seekInput(134.5);
|
||||
ffmpeg('/path/to/file.avi').seekInput('2:14.500');</code></pre><h4>loop([duration]): loop over input</h4><pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').loop();
|
||||
ffmpeg('/path/to/file.avi').loop(134.5);
|
||||
ffmpeg('/path/to/file.avi').loop('2:14.500');</code></pre><h4>inputOptions(option...): add custom input options</h4><p><strong>Aliases</strong>: <code>inputOption()</code>, <code>addInputOption()</code>, <code>addInputOptions()</code>, <code>withInputOption()</code>, <code>withInputOptions()</code>.</p>
|
||||
<p>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:</p>
|
||||
<pre class="prettyprint source lang-js"><code>/* Single option */
|
||||
ffmpeg('/path/to/file.avi').inputOptions('-someOption');
|
||||
|
||||
/* Single option with parameter */
|
||||
ffmpeg('/dev/video0').inputOptions('-r 24');</code></pre><p>You may also pass multiple options at once by passing an array to the method:</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').inputOptions([
|
||||
'-option1',
|
||||
'-option2 param2',
|
||||
'-option3',
|
||||
'-option4 param4'
|
||||
]);</code></pre><p>Finally, you may also directly pass command line tokens as separate arguments to the method:</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').inputOptions(
|
||||
'-option1',
|
||||
'-option2', 'param2',
|
||||
'-option3',
|
||||
'-option4', 'param4'
|
||||
);</code></pre><a name="audio-options"></a><h3>Audio options</h3><p>The following methods change the audio stream(s) in the produced output.</p>
|
||||
<h4>noAudio(): disable audio altogether</h4><p><strong>Aliases</strong>: <code>withNoAudio()</code>.</p>
|
||||
<p>Disables audio in the output and remove any previously set audio option.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').noAudio();</code></pre><h4>audioCodec(codec): set audio codec</h4><p><strong>Aliases</strong>: <code>withAudioCodec()</code>.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').audioCodec('libmp3lame');</code></pre><p>Fluent-ffmpeg checks for codec availability before actually running the command, and throws an error when a specified audio codec is not available.</p>
|
||||
<h4>audioBitrate(bitrate): set audio bitrate</h4><p><strong>Aliases</strong>: <code>withAudioBitrate()</code>.</p>
|
||||
<p>Sets the audio bitrate in kbps. The <code>bitrate</code> parameter may be a number or a string with an optional <code>k</code> suffix. This method is used to enforce a constant bitrate; use <code>audioQuality()</code> to encode using a variable bitrate.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').audioBitrate(128);
|
||||
ffmpeg('/path/to/file.avi').audioBitrate('128');
|
||||
ffmpeg('/path/to/file.avi').audioBitrate('128k');</code></pre><h4>audioChannels(count): set audio channel count</h4><p><strong>Aliases</strong>: <code>withAudioChannels()</code>.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').audioChannels(2);</code></pre><h4>audioFrequency(freq): set audio frequency</h4><p><strong>Aliases</strong>: <code>withAudioFrequency()</code>.</p>
|
||||
<p>The <code>freq</code> parameter specifies the audio frequency in Hz.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').audioFrequency(22050);</code></pre><h4>audioQuality(quality): set audio quality</h4><p><strong>Aliases</strong>: <code>withAudioQuality()</code>.</p>
|
||||
<p>This method fixes a quality factor for the audio codec (VBR encoding). The quality scale depends on the actual codec used.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
|
||||
.audioCodec('libmp3lame')
|
||||
.audioQuality(0);</code></pre><h4>audioFilters(filter...): add custom audio filters</h4><p><strong>Aliases</strong>: <code>audioFilter()</code>, <code>withAudioFilter()</code>, <code>withAudioFilters()</code>.</p>
|
||||
<p>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.</p>
|
||||
<p>Each filter pased to this method can be either a filter string (eg. <code>volume=0.5</code>) or a filter specification object with the following keys:</p>
|
||||
<ul>
|
||||
<li><code>filter</code>: filter name</li>
|
||||
<li><code>options</code>: optional; either an option string for the filter (eg. <code>n=-50dB:d=5</code>), an options array for unnamed options (eg. <code>['-50dB', 5]</code>) or an object mapping option names to values (eg. <code>{ n: '-50dB', d: 5 }</code>). When <code>options</code> is not specified, the filter will be added without any options.</li>
|
||||
</ul>
|
||||
<pre class="prettyprint source lang-js"><code>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 }
|
||||
}
|
||||
]);</code></pre><a name="video-options"></a><h3>Video options</h3><p>The following methods change the video stream(s) in the produced output.</p>
|
||||
<h4>noVideo(): disable video altogether</h4><p><strong>Aliases</strong>: <code>withNoVideo()</code>.</p>
|
||||
<p>This method disables video output and removes any previously set video option.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').noVideo();</code></pre><h4>videoCodec(codec): set video codec</h4><p><strong>Aliases</strong>: <code>withVideoCodec()</code>.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').videoCodec('libx264');</code></pre><p>Fluent-ffmpeg checks for codec availability before actually running the command, and throws an error when a specified video codec is not available.</p>
|
||||
<h4>videoBitrate(bitrate[, constant=false]): set video bitrate</h4><p><strong>Aliases</strong>: <code>withVideoBitrate()</code>.</p>
|
||||
<p>Sets the target video bitrate in kbps. The <code>bitrate</code> argument may be a number or a string with an optional <code>k</code> suffix. The <code>constant</code> argument specifies whether a constant bitrate should be enforced (defaults to false).</p>
|
||||
<p>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).</p>
|
||||
<pre class="prettyprint source lang-js"><code>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);</code></pre><h4>videoFilters(filter...): add custom video filters</h4><p><strong>Aliases</strong>: <code>videoFilter()</code>, <code>withVideoFilter()</code>, <code>withVideoFilters()</code>.</p>
|
||||
<p>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.</p>
|
||||
<p>Each filter pased to this method can be either a filter string (eg. <code>fade=in:0:30</code>) or a filter specification object with the following keys:</p>
|
||||
<ul>
|
||||
<li><code>filter</code>: filter name</li>
|
||||
<li><code>options</code>: optional; either an option string for the filter (eg. <code>in:0:30</code>), an options array for unnamed options (eg. <code>['in', 0, 30]</code>) or an object mapping option names to values (eg. <code>{ t: 'in', s: 0, n: 30 }</code>). When <code>options</code> is not specified, the filter will be added without any options.</li>
|
||||
</ul>
|
||||
<pre class="prettyprint source lang-js"><code>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' }
|
||||
}
|
||||
);</code></pre><h4>fps(fps): set output framerate</h4><p><strong>Aliases</strong>: <code>withOutputFps()</code>, <code>withOutputFPS()</code>, <code>withFpsOutput()</code>, <code>withFPSOutput()</code>, <code>withFps()</code>, <code>withFPS()</code>, <code>outputFPS()</code>, <code>outputFps()</code>, <code>fpsOutput()</code>, <code>FPSOutput()</code>, <code>FPS()</code>.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').fps(29.7);</code></pre><h4>frames(count): specify frame count</h4><p><strong>Aliases</strong>: <code>takeFrames()</code>, <code>withFrames()</code>.</p>
|
||||
<p>Set ffmpeg to only encode a certain number of frames.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').frames(240);</code></pre><a name="video-frame-size-options"></a><h3>Video frame size options</h3><p>The following methods enable resizing the output video frame size. They all work together to generate the appropriate video filters.</p>
|
||||
<h4>size(size): set output frame size</h4><p><strong>Aliases</strong>: <code>videoSize()</code>, <code>withSize()</code>.</p>
|
||||
<p>This method sets the output frame size. The <code>size</code> argument may have one of the following formats:</p>
|
||||
<ul>
|
||||
<li><code>640x480</code>: set a fixed output frame size. Unless <code>autopad()</code> is called, this may result in the video being stretched or squeezed to fit the requested size.</li>
|
||||
<li><code>640x?</code>: set a fixed width and compute height automatically. If <code>aspect()</code> is also called, it is used to compute video height; otherwise it is computed so that the input aspect ratio is preserved.</li>
|
||||
<li><code>?x480</code>: set a fixed height and compute width automatically. If <code>aspect()</code> is also called, it is used to compute video width; otherwise it is computed so that the input aspect ratio is preserved.</li>
|
||||
<li><code>50%</code>: rescale both width and height to the given percentage. Aspect ratio is always preserved.</li>
|
||||
</ul>
|
||||
<p>Note that for compatibility with some codecs, computed dimensions are always rounded down to multiples of 2.</p>
|
||||
<pre class="prettyprint source lang-js"><code>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%');</code></pre><h4>aspect(aspect): set output frame aspect ratio</h4><p><strong>Aliases</strong>: <code>withAspect()</code>, <code>withAspectRatio()</code>, <code>setAspect()</code>, <code>setAspectRatio()</code>, <code>aspectRatio()</code>.</p>
|
||||
<p>This method enforces a specific output aspect ratio. The <code>aspect</code> argument may either be a number or a <code>X:Y</code> string.</p>
|
||||
<p>Note that calls to <code>aspect()</code> are ignored when <code>size()</code> has been called with a fixed width and height or a percentage, and also when <code>size()</code> has not been called at all.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').size('640x?').aspect('4:3');
|
||||
ffmpeg('/path/to/file.avi').size('640x?').aspect(1.33333);</code></pre><h4>autopad([color='black']): enable auto-padding the output video</h4><p><strong>Aliases</strong>: <code>applyAutopadding()</code>, <code>applyAutoPadding()</code>, <code>applyAutopad()</code>, <code>applyAutoPad()</code>, <code>withAutopadding()</code>, <code>withAutoPadding()</code>, <code>withAutopad()</code>, <code>withAutoPad()</code>, <code>autoPad()</code>.</p>
|
||||
<p>This method enables applying auto-padding to the output video. The <code>color</code> parameter specifies which color to use for padding, and must be a color code or name supported by ffmpeg (defaults to 'black').</p>
|
||||
<p>The behaviour of this method depends on calls made to other video size methods:</p>
|
||||
<ul>
|
||||
<li>when <code>size()</code> has been called with a percentage or has not been called, it is ignored;</li>
|
||||
<li>when <code>size()</code> has been called with <code>WxH</code>, it adds padding so that the input aspect ratio is kept;</li>
|
||||
<li>when <code>size()</code> has been called with either <code>Wx?</code> or <code>?xH</code>, padding is only added if <code>aspect()</code> was called (otherwise the output dimensions are computed from the input aspect ratio and padding is not needed).</li>
|
||||
</ul>
|
||||
<pre class="prettyprint source lang-js"><code>// 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');</code></pre><p>For compatibility with previous fluent-ffmpeg versions, this method also accepts an additional boolean first argument, which specifies whether to apply auto-padding.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').size('640x480').autopad(true);
|
||||
ffmpeg('/path/to/file.avi').size('640x480').autopad(true, 'pink');</code></pre><h4>keepDAR(): force keeping display aspect ratio</h4><p><strong>Aliases</strong>: <code>keepPixelAspect()</code>, <code>keepDisplayAspect()</code>, <code>keepDisplayAspectRatio()</code>.</p>
|
||||
<p>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.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').keepDAR();</code></pre><a name="specifying-multiple-outputs"></a><h3>Specifying multiple outputs</h3><h4>output(target[, options]): add an output to the command</h4><p><strong>Aliases</strong>: <code>addOutput()</code>.</p>
|
||||
<p>Adds an output to the command. The <code>target</code> argument may be an output filename or a writable stream (but at most one output stream may be used with a single command).</p>
|
||||
<p>When <code>target</code> is a stream, an additional <code>options</code> object may be passed. If it is present, it will be passed ffmpeg output stream <code>pipe()</code> method.</p>
|
||||
<p>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 <em>before</em> 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 <code>complexFilter()</code>, which is global.</p>
|
||||
<p>Also note that when calling <code>output()</code>, you should not use the <code>save()</code> or <code>stream()</code> (formerly <code>saveToFile()</code> and <code>writeToStream()</code>) methods, as they already add an output. Use the <code>run()</code> method to start processing.</p>
|
||||
<pre class="prettyprint source lang-js"><code>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();</code></pre><a name="output-options"></a><h3>Output options</h3><h4>duration(time): set output duration</h4><p><strong>Aliases</strong>: <code>withDuration()</code>, <code>setDuration()</code>.</p>
|
||||
<p>Forces ffmpeg to stop transcoding after a specific output duration. The <code>time</code> parameter may be a number (in seconds) or a timestamp string (with format <code>[[hh:]mm:]ss[.xxx]</code>).</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').duration(134.5);
|
||||
ffmpeg('/path/to/file.avi').duration('2:14.500');</code></pre><h4>seek(time): seek output</h4><p><strong>Aliases</strong>: <code>seekOutput()</code>.</p>
|
||||
<p>Seeks streams before encoding them into the output. This is different from calling <code>seekInput()</code> in that the offset will only apply to one output. This is also slower, as skipped frames will still be decoded (but dropped).</p>
|
||||
<p>The <code>time</code> argument may be a number (in seconds) or a timestamp string (with format <code>[[hh:]mm:]ss[.xxx]</code>).</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
|
||||
.seekInput('1:00')
|
||||
|
||||
.output('from-1m30s.avi')
|
||||
.seek(30)
|
||||
|
||||
.output('from-1m40s.avi')
|
||||
.seek('0:40');</code></pre><h4>format(format): set output format</h4><p><strong>Aliases</strong>: <code>withOutputFormat()</code>, <code>toFormat()</code>, <code>outputFormat()</code>.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').format('flv');</code></pre><h4>flvmeta(): update FLV metadata after transcoding</h4><p><strong>Aliases</strong>: <code>updateFlvMetadata()</code>.</p>
|
||||
<p>Calling this method makes fluent-ffmpeg run <code>flvmeta</code> or <code>flvtool2</code> 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.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').flvmeta().format('flv');</code></pre><h4>outputOptions(option...): add custom output options</h4><p><strong>Aliases</strong>: <code>outputOption()</code>, <code>addOutputOption()</code>, <code>addOutputOptions()</code>, <code>withOutputOption()</code>, <code>withOutputOptions()</code>, <code>addOption()</code>, <code>addOptions()</code>.</p>
|
||||
<p>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:</p>
|
||||
<pre class="prettyprint source lang-js"><code>/* Single option */
|
||||
ffmpeg('/path/to/file.avi').outputOptions('-someOption');
|
||||
|
||||
/* Single option with parameter */
|
||||
ffmpeg('/dev/video0').outputOptions('-r 24');</code></pre><p>You may also pass multiple options at once by passing an array to the method:</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').outputOptions([
|
||||
'-option1',
|
||||
'-option2 param2',
|
||||
'-option3',
|
||||
'-option4 param4'
|
||||
]);</code></pre><p>Finally, you may also directly pass command line tokens as separate arguments to the method:</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').outputOptions(
|
||||
'-option1',
|
||||
'-option2', 'param2',
|
||||
'-option3',
|
||||
'-option4', 'param4'
|
||||
);</code></pre><a name="miscellaneous-options"></a><h3>Miscellaneous options</h3><h4>preset(preset): use fluent-ffmpeg preset</h4><p><strong>Aliases</strong>: <code>usingPreset()</code>.</p>
|
||||
<p>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 <code>preset</code> argument. Preset modules are loaded from the directory specified by the <code>presets</code> constructor option (defaults to the <code>lib/presets</code> fluent-ffmpeg subdirectory).</p>
|
||||
<pre class="prettyprint source lang-js"><code>// 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');</code></pre><p>Preset modules must export a <code>load()</code> function that takes an FfmpegCommand as an argument. fluent-ffmpeg comes with the following preset modules preinstalled:</p>
|
||||
<ul>
|
||||
<li><code>divx</code></li>
|
||||
<li><code>flashvideo</code></li>
|
||||
<li><code>podcast</code></li>
|
||||
</ul>
|
||||
<p>Here is the code from the included <code>divx</code> preset as an example:</p>
|
||||
<pre class="prettyprint source lang-js"><code>exports.load = function(ffmpeg) {
|
||||
ffmpeg
|
||||
.format('avi')
|
||||
.videoBitrate('1024k')
|
||||
.videoCodec('mpeg4')
|
||||
.size('720x?')
|
||||
.audioBitrate('128k')
|
||||
.audioChannels(2)
|
||||
.audioCodec('libmp3lame')
|
||||
.outputOptions(['-vtag DIVX']);
|
||||
};</code></pre><p>The second kind of preset is preset functions. To use those, pass a function which takes an FfmpegCommand as a parameter.</p>
|
||||
<pre class="prettyprint source lang-js"><code>function myPreset(command) {
|
||||
command.format('avi').size('720x?');
|
||||
}
|
||||
|
||||
ffmpeg('/path/to/file.avi').preset(myPreset);</code></pre><h4>complexFilter(filters[, map]): set complex filtergraph</h4><p><strong>Aliases</strong>: <code>filterGraph()</code></p>
|
||||
<p>The <code>complexFilter()</code> 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.</p>
|
||||
<p>Filter specifications may be either plain ffmpeg filter strings (eg. <code>split=3[a][b][c]</code>) or objects with the following keys:</p>
|
||||
<ul>
|
||||
<li><code>filter</code>: filter name</li>
|
||||
<li><code>options</code>: optional; either an option string for the filter (eg. <code>in:0:30</code>), an options array for unnamed options (eg. <code>['in', 0, 30]</code>) or an object mapping option names to values (eg. <code>{ t: 'in', s: 0, n: 30 }</code>). When <code>options</code> is not specified, the filter will be added without any options.</li>
|
||||
<li><code>inputs</code>: 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.</li>
|
||||
<li><code>outputs</code>: 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.</li>
|
||||
</ul>
|
||||
<p>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.</p>
|
||||
<p>Note that only one complex filtergraph may be set on a given command. Calling <code>complexFilter()</code> again will override any previously set filtergraph, but you can set as many filters as needed in a single call.</p>
|
||||
<pre class="prettyprint source lang-js"><code>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');</code></pre><a name="setting-event-handlers"></a><h3>Setting event handlers</h3><p>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:</p>
|
||||
<h4>'start': ffmpeg process started</h4><p>The <code>start</code> event is emitted just after ffmpeg has been spawned. It is emitted with the full command line used as an argument.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
|
||||
.on('start', function(commandLine) {
|
||||
console.log('Spawned Ffmpeg with command: ' + commandLine);
|
||||
});</code></pre><h4>'codecData': input codec data available</h4><p>The <code>codecData</code> event is emitted when ffmpeg outputs codec information about its input streams. It is emitted with an object argument with the following keys:</p>
|
||||
<ul>
|
||||
<li><code>format</code>: input format</li>
|
||||
<li><code>duration</code>: input duration</li>
|
||||
<li><code>audio</code>: audio codec</li>
|
||||
<li><code>audio_details</code>: audio encoding details</li>
|
||||
<li><code>video</code>: video codec</li>
|
||||
<li><code>video_details</code>: video encoding details</li>
|
||||
</ul>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
|
||||
.on('codecData', function(data) {
|
||||
console.log('Input is ' + data.audio + ' audio ' +
|
||||
'with ' + data.video + ' video');
|
||||
});</code></pre><h4>'progress': transcoding progress information</h4><p>The <code>progress</code> event is emitted every time ffmpeg reports progress information. It is emitted with an object argument with the following keys:</p>
|
||||
<ul>
|
||||
<li><code>frames</code>: total processed frame count</li>
|
||||
<li><code>currentFps</code>: framerate at which FFmpeg is currently processing</li>
|
||||
<li><code>currentKbps</code>: throughput at which FFmpeg is currently processing</li>
|
||||
<li><code>targetSize</code>: current size of the target file in kilobytes</li>
|
||||
<li><code>timemark</code>: the timestamp of the current frame in seconds</li>
|
||||
<li><code>percent</code>: an estimation of the progress percentage</li>
|
||||
</ul>
|
||||
<p>Note that <code>percent</code> 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:</p>
|
||||
<ul>
|
||||
<li>percentage is not available when using an input stream</li>
|
||||
<li>percentage may be wrong when using multiple inputs with different durations and the first one is not the longest</li>
|
||||
</ul>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
|
||||
.on('progress', function(progress) {
|
||||
console.log('Processing: ' + progress.percent + '% done');
|
||||
});</code></pre><h4>'stderr': FFmpeg output</h4><p>The <code>stderr</code> event is emitted every time FFmpeg outputs a line to <code>stderr</code>. It is emitted with a string containing the line of stderr (minus trailing new line characters).</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
|
||||
.on('stderr', function(stderrLine) {
|
||||
console.log('Stderr output: ' + stderrLine);
|
||||
});</code></pre><h4>'error': transcoding error</h4><p>The <code>error</code> 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.</p>
|
||||
<p><strong>Warning</strong>: you should <em>always</em> set a handler for the <code>error</code> event, as node's default behaviour when an <code>error</code> event without any listeners is emitted is to output the error to the console and <em>terminate the program</em>.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
|
||||
.on('error', function(err, stdout, stderr) {
|
||||
console.log('Cannot process video: ' + err.message);
|
||||
});</code></pre><h4>'end': processing finished</h4><p>The <code>end</code> event is emitted when processing has finished. Listeners receive ffmpeg standard output and standard error as arguments, except when generating thumbnails (see below), in which case they receive an array of the generated filenames.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
|
||||
.on('end', function(stdout, stderr) {
|
||||
console.log('Transcoding succeeded !');
|
||||
});</code></pre><p><code>stdout</code> is empty when the command outputs to a stream. Both <code>stdout</code> and <code>stderr</code> are limited by the <code>stdoutLines</code> option (defaults to 100 lines).</p>
|
||||
<a name="starting-ffmpeg-processing"></a><h3>Starting FFmpeg processing</h3><h4>save(filename): save the output to a file</h4><p><strong>Aliases</strong>: <code>saveToFile()</code></p>
|
||||
<p>Starts ffmpeg processing and saves the output to a file.</p>
|
||||
<pre class="prettyprint source lang-js"><code>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');</code></pre><p>Note: the <code>save()</code> method is actually syntactic sugar for calling both <code>output()</code> and <code>run()</code>.</p>
|
||||
<h4>pipe([stream], [options]): pipe the output to a writable stream</h4><p><strong>Aliases</strong>: <code>stream()</code>, <code>writeToStream()</code>.</p>
|
||||
<p>Starts processing and pipes ffmpeg output to a writable stream. The <code>options</code> argument, if present, is passed to ffmpeg output stream's <code>pipe()</code> method (see nodejs documentation).</p>
|
||||
<pre class="prettyprint source lang-js"><code>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 });</code></pre><p>When no <code>stream</code> argument is present, the <code>pipe()</code> method returns a PassThrough stream, which you can pipe to somewhere else (or just listen to events on).</p>
|
||||
<p><strong>Note</strong>: this is only available with node >= 0.10.</p>
|
||||
<pre class="prettyprint source lang-js"><code>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');
|
||||
});</code></pre><p>Note: the <code>stream()</code> method is actually syntactic sugar for calling both <code>output()</code> and <code>run()</code>.</p>
|
||||
<h4>run(): start processing</h4><p><strong>Aliases</strong>: <code>exec()</code>, <code>execute()</code>.</p>
|
||||
<p>This method is mainly useful when producing multiple outputs (otherwise the <code>save()</code> or <code>stream()</code> methods are more straightforward). It starts processing with the specified outputs.</p>
|
||||
<p><strong>Warning</strong>: do not use <code>run()</code> when calling other processing methods (eg. <code>save()</code>, <code>pipe()</code> or <code>screenshots()</code>).</p>
|
||||
<pre class="prettyprint source lang-js"><code>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();</code></pre><h4>mergeToFile(filename, tmpdir): concatenate multiple inputs</h4><p>Use the <code>input</code> and <code>mergeToFile</code> methods on a command to concatenate multiple inputs to a single output file. The <code>mergeToFile</code> needs a temporary folder as its second argument.</p>
|
||||
<pre class="prettyprint source lang-js"><code>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');</code></pre><h4>screenshots(options[, dirname]): generate thumbnails</h4><p><strong>Aliases</strong>: <code>thumbnail()</code>, <code>thumbnails()</code>, <code>screenshot()</code>, <code>takeScreenshots()</code>.</p>
|
||||
<p>Use the <code>screenshots</code> method to extract one or several thumbnails and save them as PNG files. There are a few caveats with this implementation, though:</p>
|
||||
<ul>
|
||||
<li>It will not work on input streams.</li>
|
||||
<li>Progress information reported by the <code>progress</code> event is not accurate.</li>
|
||||
<li>It doesn't interract well with filters. In particular, don't use the <code>size()</code> method to resize thumbnails, use the <code>size</code> option instead.</li>
|
||||
</ul>
|
||||
<p>The <code>options</code> argument is an object with the following keys:</p>
|
||||
<ul>
|
||||
<li><code>folder</code>: output folder for generated image files. Defaults to the current folder.</li>
|
||||
<li><code>filename</code>: output filename pattern (see below). Defaults to "tn.png".</li>
|
||||
<li><code>count</code>: 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). <code>count</code> is ignored when <code>timemarks</code> or <code>timestamps</code> is specified.</li>
|
||||
<li><code>timemarks</code> or <code>timestamps</code>: 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).</li>
|
||||
<li><code>size</code>: specifies a target size for thumbnails (with the same format as the <code>.size()</code> method). <strong>Note:</strong> you should not use the <code>.size()</code> method when generating thumbnails.</li>
|
||||
</ul>
|
||||
<p>The <code>filename</code> option specifies a filename pattern for generated files. It may contain the following format tokens:</p>
|
||||
<ul>
|
||||
<li>'%s': offset in seconds</li>
|
||||
<li>'%w': screenshot width</li>
|
||||
<li>'%h': screenshot height</li>
|
||||
<li>'%r': screenshot resolution (same as '%wx%h')</li>
|
||||
<li>'%f': input filename</li>
|
||||
<li>'%b': input basename (filename w/o extension)</li>
|
||||
<li>'%i': index of screenshot in timemark array (can be zero-padded by using it like <code>%000i</code>)</li>
|
||||
</ul>
|
||||
<p>If multiple timemarks are passed and no variable format token ('%s' or '%i') is specified in the filename pattern, <code>_%i</code> will be added automatically.</p>
|
||||
<p>When generating thumbnails, an additional <code>filenames</code> event is dispatched with an array of generated filenames as an argument.</p>
|
||||
<pre class="prettyprint source lang-js"><code>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'
|
||||
});</code></pre><a name="controlling-the-ffmpeg-process"></a><h3>Controlling the FFmpeg process</h3><h4>kill([signal='SIGKILL']): kill any running ffmpeg process</h4><p>This method sends <code>signal</code> (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 <code>error</code> event being emitted.</p>
|
||||
<pre class="prettyprint source lang-js"><code>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);</code></pre><h4>renice([niceness=0]): change ffmpeg process priority</h4><p>This method alters the niceness (priority) value of any running ffmpeg process (if any) and any process spawned in the future. The <code>niceness</code> 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).</p>
|
||||
<p><strong>Note</strong>: this method is ineffective on Windows platforms.</p>
|
||||
<pre class="prettyprint source lang-js"><code>// 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);</code></pre><a name="reading-video-metadata"></a><h3>Reading video metadata</h3><p>You can read metadata from any valid ffmpeg input file with the modules <code>ffprobe</code> method.</p>
|
||||
<pre class="prettyprint source lang-js"><code>ffmpeg.ffprobe('/path/to/file.avi', function(err, metadata) {
|
||||
console.dir(metadata);
|
||||
});</code></pre><p>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.</p>
|
||||
<pre class="prettyprint source lang-js"><code>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);
|
||||
});</code></pre><p><strong>Warning:</strong> ffprobe may be called with an input stream, but in this case <em>it will consume data from the stream</em>, and this data will no longer be available for ffmpeg. Using both ffprobe and a transcoding command on the same input stream will most likely fail unless the stream is a live stream. Only do this if you know what you're doing.</p>
|
||||
<p>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 <code>-of</code> with <code>-print_format</code>) :</p>
|
||||
<pre class="prettyprint source lang-sh"><code>$ ffprobe -of json -show_streams -show_format /path/to/file.avi</code></pre><p>It will contain information about the container (as a <code>format</code> key) and an array of streams (as a <code>stream</code> key). The format object and each stream object also contains metadata tags, depending on the format:</p>
|
||||
<pre class="prettyprint source lang-js"><code>{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}</code></pre><a name="querying-ffmpeg-capabilities"></a><h3>Querying ffmpeg capabilities</h3><p>fluent-ffmpeg enables you to query your installed ffmpeg version for supported formats, codecs, encoders and filters.</p>
|
||||
<pre class="prettyprint source lang-js"><code>
|
||||
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(...);</code></pre><p>These methods pass an object to their callback with keys for each available format, codec or filter.</p>
|
||||
<p>The returned object for formats looks like:</p>
|
||||
<pre class="prettyprint source lang-js"><code>{
|
||||
...
|
||||
mp4: {
|
||||
description: 'MP4 (MPEG-4 Part 14)',
|
||||
canDemux: false,
|
||||
canMux: true
|
||||
},
|
||||
...
|
||||
}</code></pre><ul>
|
||||
<li><code>canDemux</code> indicates whether ffmpeg is able to extract streams from (demux) this format</li>
|
||||
<li><code>canMux</code> indicates whether ffmpeg is able to write streams into (mux) this format</li>
|
||||
</ul>
|
||||
<p>The returned object for codecs looks like:</p>
|
||||
<pre class="prettyprint source lang-js"><code>{
|
||||
...
|
||||
mp3: {
|
||||
type: 'audio',
|
||||
description: 'MP3 (MPEG audio layer 3)',
|
||||
canDecode: true,
|
||||
canEncode: true,
|
||||
intraFrameOnly: false,
|
||||
isLossy: true,
|
||||
isLossless: false
|
||||
},
|
||||
...
|
||||
}</code></pre><ul>
|
||||
<li><code>type</code> indicates the codec type, either "audio", "video" or "subtitle"</li>
|
||||
<li><code>canDecode</code> tells whether ffmpeg is able to decode streams using this codec</li>
|
||||
<li><code>canEncode</code> tells whether ffmpeg is able to encode streams using this codec</li>
|
||||
</ul>
|
||||
<p>Depending on your ffmpeg version (or if you use avconv instead) other keys may be present, for example:</p>
|
||||
<ul>
|
||||
<li><code>directRendering</code> tells if codec can render directly in GPU RAM; useless for transcoding purposes</li>
|
||||
<li><code>intraFrameOnly</code> tells if codec can only work with I-frames</li>
|
||||
<li><code>isLossy</code> tells if codec can do lossy encoding/decoding</li>
|
||||
<li><code>isLossless</code> tells if codec can do lossless encoding/decoding</li>
|
||||
</ul>
|
||||
<p>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 <code>getAvailableCodecs</code> will also include them).</p>
|
||||
<p>The returned object for encoders looks like:</p>
|
||||
<pre class="prettyprint source lang-js"><code>{
|
||||
...
|
||||
libmp3lame: {
|
||||
type: 'audio',
|
||||
description: 'MP3 (MPEG audio layer 3) (codec mp3)',
|
||||
frameMT: false,
|
||||
sliceMT: false,
|
||||
experimental: false,
|
||||
drawHorizBand: false,
|
||||
directRendering: false
|
||||
},
|
||||
...
|
||||
}</code></pre><ul>
|
||||
<li><code>type</code> indicates the encoder type, either "audio", "video" or "subtitle"</li>
|
||||
<li><code>experimental</code> indicates whether the encoder is experimental. When using such a codec, fluent-ffmpeg automatically adds the '-strict experimental' flag.</li>
|
||||
</ul>
|
||||
<p>The returned object for filters looks like:</p>
|
||||
<pre class="prettyprint source lang-js"><code>{
|
||||
...
|
||||
scale: {
|
||||
description: 'Scale the input video to width:height size and/or convert the image format.',
|
||||
input: 'video',
|
||||
multipleInputs: false,
|
||||
output: 'video',
|
||||
multipleOutputs: false
|
||||
},
|
||||
...
|
||||
}</code></pre><ul>
|
||||
<li><code>input</code> tells the input type this filter operates on, one of "audio", "video" or "none". When "none", the filter likely generates output from nothing</li>
|
||||
<li><code>multipleInputs</code> tells whether the filter can accept multiple inputs</li>
|
||||
<li><code>output</code> tells the output type this filter generates, one of "audio", "video" or "none". When "none", the filter has no output (sink only)</li>
|
||||
<li><code>multipleInputs</code> tells whether the filter can generate multiple outputs</li>
|
||||
</ul>
|
||||
<a name="cloning-an-ffmpegcommand"></a><h3>Cloning an FfmpegCommand</h3><p>You can create clones of an FfmpegCommand instance by calling the <code>clone()</code> 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.</p>
|
||||
<p>Setting options, adding inputs or event handlers on a clone will not affect the original command.</p>
|
||||
<pre class="prettyprint source lang-js"><code>// 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');</code></pre><a name="contributing"></a><h2>Contributing</h2><p>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!</p>
|
||||
<a name="code-contributions"></a><h3>Code contributions</h3><p>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.</p>
|
||||
<p>When fixing bugs, you can directly submit a pull request.</p>
|
||||
<p>Make sure to add tests for your features and bugfixes and update the documentation (see below) before submitting your code!</p>
|
||||
<a name="documentation-contributions"></a><h3>Documentation contributions</h3><p>You can directly submit pull requests for documentation changes. Make sure to regenerate the documentation before submitting (see below).</p>
|
||||
<a name="updating-the-documentation"></a><h3>Updating the documentation</h3><p>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:</p>
|
||||
<ul>
|
||||
<li><code>@aliases</code>: document method aliases</li>
|
||||
</ul>
|
||||
<pre class="prettyprint source lang-js"><code>/**
|
||||
* ...
|
||||
* @method FfmpegCommand#myMethod
|
||||
* @aliases myMethodAlias,myOtherMethodAlias
|
||||
*/</code></pre><ul>
|
||||
<li><code>@category</code>: set method category</li>
|
||||
</ul>
|
||||
<pre class="prettyprint source lang-js"><code>/**
|
||||
* ...
|
||||
* @category Audio
|
||||
*/</code></pre><p>You can regenerate the JSDoc documentation by running the following command:</p>
|
||||
<pre class="prettyprint source lang-sh"><code>$ make doc</code></pre><p>To avoid polluting the commit history, make sure to only commit the regenerated JSDoc once and in a specific commit.</p>
|
||||
<a name="running-tests"></a><h3>Running tests</h3><p>To run unit tests, first make sure you installed npm dependencies (run <code>npm install</code>).</p>
|
||||
<pre class="prettyprint source lang-sh"><code>$ make test</code></pre><p>If you want to re-generate the test coverage report (filed under test/coverage.html), run</p>
|
||||
<pre class="prettyprint source lang-sh"><code>$ make test-cov</code></pre><p>Make sure your ffmpeg installation is up-to-date to prevent strange assertion errors because of missing codecs/bugfixes.</p>
|
||||
<a name="main-contributors"></a><h2>Main contributors</h2><ul>
|
||||
<li><a href="http://github.com/enobrev">enobrev</a></li>
|
||||
<li><a href="http://github.com/njoyard">njoyard</a></li>
|
||||
<li><a href="http://github.com/sadikzzz">sadikzzz</a></li>
|
||||
<li><a href="http://github.com/smremde">smremde</a></li>
|
||||
<li><a href="http://github.com/spruce">spruce</a></li>
|
||||
<li><a href="http://github.com/tagedieb">tagedieb</a></li>
|
||||
<li><a href="http://github.com/tommadema">tommadema</a></li>
|
||||
<li><a href="http://github.com/Weltschmerz">Weltschmerz</a></li>
|
||||
</ul>
|
||||
<a name="license"></a><h2>License</h2><p>(The MIT License)</p>
|
||||
<p>Copyright (c) 2011 Stefan Schaermeli <schaermu@gmail.com></p>
|
||||
<p>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:</p>
|
||||
<p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>
|
||||
<p>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.</p></article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun May 01 2016 12:10:37 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
225
node_modules/fluent-ffmpeg/doc/inputs.js.html
generated
vendored
Normal file
225
node_modules/fluent-ffmpeg/doc/inputs.js.html
generated
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: options/inputs.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: options/inputs.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*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;
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
91
node_modules/fluent-ffmpeg/doc/misc.js.html
generated
vendored
Normal file
91
node_modules/fluent-ffmpeg/doc/misc.js.html
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: options/misc.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: options/misc.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*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;
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
228
node_modules/fluent-ffmpeg/doc/options_audio.js.html
generated
vendored
Normal file
228
node_modules/fluent-ffmpeg/doc/options_audio.js.html
generated
vendored
Normal file
@@ -0,0 +1,228 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: options/audio.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: options/audio.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*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;
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun May 01 2016 12:10:37 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
262
node_modules/fluent-ffmpeg/doc/options_custom.js.html
generated
vendored
Normal file
262
node_modules/fluent-ffmpeg/doc/options_custom.js.html
generated
vendored
Normal file
@@ -0,0 +1,262 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: options/custom.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: options/custom.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*jshint node:true*/
|
||||
'use strict';
|
||||
|
||||
var utils = require('../utils');
|
||||
|
||||
|
||||
/*
|
||||
*! Custom options methods
|
||||
*/
|
||||
|
||||
module.exports = function(proto) {
|
||||
/**
|
||||
* Add custom input option(s)
|
||||
*
|
||||
* When passing a single string or an array, each string containing two
|
||||
* words is split (eg. inputOptions('-option value') is supported) for
|
||||
* compatibility reasons. This is not the case when passing more than
|
||||
* one argument.
|
||||
*
|
||||
* @example
|
||||
* command.inputOptions('option1');
|
||||
*
|
||||
* @example
|
||||
* command.inputOptions('option1', 'option2');
|
||||
*
|
||||
* @example
|
||||
* command.inputOptions(['option1', 'option2']);
|
||||
*
|
||||
* @method FfmpegCommand#inputOptions
|
||||
* @category Custom options
|
||||
* @aliases addInputOption,addInputOptions,withInputOption,withInputOptions,inputOption
|
||||
*
|
||||
* @param {...String} options option string(s) or string array
|
||||
* @return FfmpegCommand
|
||||
*/
|
||||
proto.addInputOption =
|
||||
proto.addInputOptions =
|
||||
proto.withInputOption =
|
||||
proto.withInputOptions =
|
||||
proto.inputOption =
|
||||
proto.inputOptions = function(options) {
|
||||
if (!this._currentInput) {
|
||||
throw new Error('No input specified');
|
||||
}
|
||||
|
||||
var doSplit = true;
|
||||
|
||||
if (arguments.length > 1) {
|
||||
options = [].slice.call(arguments);
|
||||
doSplit = false;
|
||||
}
|
||||
|
||||
if (!Array.isArray(options)) {
|
||||
options = [options];
|
||||
}
|
||||
|
||||
this._currentInput.options(options.reduce(function(options, option) {
|
||||
var split = String(option).split(' ');
|
||||
|
||||
if (doSplit && split.length === 2) {
|
||||
options.push(split[0], split[1]);
|
||||
} else {
|
||||
options.push(option);
|
||||
}
|
||||
|
||||
return options;
|
||||
}, []));
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Add custom output option(s)
|
||||
*
|
||||
* @example
|
||||
* command.outputOptions('option1');
|
||||
*
|
||||
* @example
|
||||
* command.outputOptions('option1', 'option2');
|
||||
*
|
||||
* @example
|
||||
* command.outputOptions(['option1', 'option2']);
|
||||
*
|
||||
* @method FfmpegCommand#outputOptions
|
||||
* @category Custom options
|
||||
* @aliases addOutputOption,addOutputOptions,addOption,addOptions,withOutputOption,withOutputOptions,withOption,withOptions,outputOption
|
||||
*
|
||||
* @param {...String} options option string(s) or string array
|
||||
* @return FfmpegCommand
|
||||
*/
|
||||
proto.addOutputOption =
|
||||
proto.addOutputOptions =
|
||||
proto.addOption =
|
||||
proto.addOptions =
|
||||
proto.withOutputOption =
|
||||
proto.withOutputOptions =
|
||||
proto.withOption =
|
||||
proto.withOptions =
|
||||
proto.outputOption =
|
||||
proto.outputOptions = function(options) {
|
||||
var doSplit = true;
|
||||
|
||||
if (arguments.length > 1) {
|
||||
options = [].slice.call(arguments);
|
||||
doSplit = false;
|
||||
}
|
||||
|
||||
if (!Array.isArray(options)) {
|
||||
options = [options];
|
||||
}
|
||||
|
||||
this._currentOutput.options(options.reduce(function(options, option) {
|
||||
var split = String(option).split(' ');
|
||||
|
||||
if (doSplit && split.length === 2) {
|
||||
options.push(split[0], split[1]);
|
||||
} else {
|
||||
options.push(option);
|
||||
}
|
||||
|
||||
return options;
|
||||
}, []));
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Specify a complex filtergraph
|
||||
*
|
||||
* Calling this method will override any previously set filtergraph, but you can set
|
||||
* as many filters as needed in one call.
|
||||
*
|
||||
* @example <caption>Overlay an image over a video (using a filtergraph string)</caption>
|
||||
* ffmpeg()
|
||||
* .input('video.avi')
|
||||
* .input('image.png')
|
||||
* .complexFilter('[0:v][1:v]overlay[out]', ['out']);
|
||||
*
|
||||
* @example <caption>Overlay an image over a video (using a filter array)</caption>
|
||||
* ffmpeg()
|
||||
* .input('video.avi')
|
||||
* .input('image.png')
|
||||
* .complexFilter([{
|
||||
* filter: 'overlay',
|
||||
* inputs: ['0:v', '1:v'],
|
||||
* outputs: ['out']
|
||||
* }], ['out']);
|
||||
*
|
||||
* @example <caption>Split video into RGB channels and output a 3x1 video with channels side to side</caption>
|
||||
* ffmpeg()
|
||||
* .input('video.avi')
|
||||
* .complexFilter([
|
||||
* // Duplicate video stream 3 times into streams a, b, and c
|
||||
* { filter: 'split', options: '3', outputs: ['a', 'b', 'c'] },
|
||||
*
|
||||
* // Create stream 'red' by cancelling green and blue channels from stream 'a'
|
||||
* { filter: 'lutrgb', options: { g: 0, b: 0 }, inputs: 'a', outputs: 'red' },
|
||||
*
|
||||
* // Create stream 'green' by cancelling red and blue channels from stream 'b'
|
||||
* { filter: 'lutrgb', options: { r: 0, b: 0 }, inputs: 'b', outputs: 'green' },
|
||||
*
|
||||
* // Create stream 'blue' by cancelling red and green channels from stream 'c'
|
||||
* { filter: 'lutrgb', options: { r: 0, g: 0 }, inputs: 'c', outputs: 'blue' },
|
||||
*
|
||||
* // Pad stream 'red' to 3x width, keeping the video on the left, and name output 'padded'
|
||||
* { filter: 'pad', options: { w: 'iw*3', h: 'ih' }, inputs: 'red', outputs: 'padded' },
|
||||
*
|
||||
* // Overlay 'green' onto 'padded', moving it to the center, and name output 'redgreen'
|
||||
* { filter: 'overlay', options: { x: 'w', y: 0 }, inputs: ['padded', 'green'], outputs: 'redgreen'},
|
||||
*
|
||||
* // Overlay 'blue' onto 'redgreen', moving it to the right
|
||||
* { filter: 'overlay', options: { x: '2*w', y: 0 }, inputs: ['redgreen', 'blue']},
|
||||
* ]);
|
||||
*
|
||||
* @method FfmpegCommand#complexFilter
|
||||
* @category Custom options
|
||||
* @aliases filterGraph
|
||||
*
|
||||
* @param {String|Array} spec filtergraph string or array of filter specification
|
||||
* objects, each having the following properties:
|
||||
* @param {String} spec.filter filter name
|
||||
* @param {String|Array} [spec.inputs] (array of) input stream specifier(s) for the filter,
|
||||
* defaults to ffmpeg automatically choosing the first unused matching streams
|
||||
* @param {String|Array} [spec.outputs] (array of) output stream specifier(s) for the filter,
|
||||
* defaults to ffmpeg automatically assigning the output to the output file
|
||||
* @param {Object|String|Array} [spec.options] filter options, can be omitted to not set any options
|
||||
* @param {Array} [map] (array of) stream specifier(s) from the graph to include in
|
||||
* ffmpeg output, defaults to ffmpeg automatically choosing the first matching streams.
|
||||
* @return FfmpegCommand
|
||||
*/
|
||||
proto.filterGraph =
|
||||
proto.complexFilter = function(spec, map) {
|
||||
this._complexFilters.clear();
|
||||
|
||||
if (!Array.isArray(spec)) {
|
||||
spec = [spec];
|
||||
}
|
||||
|
||||
this._complexFilters('-filter_complex', utils.makeFilterStrings(spec).join(';'));
|
||||
|
||||
if (Array.isArray(map)) {
|
||||
var self = this;
|
||||
map.forEach(function(streamSpec) {
|
||||
self._complexFilters('-map', streamSpec.replace(utils.streamRegexp, '[$1]'));
|
||||
});
|
||||
} else if (typeof map === 'string') {
|
||||
this._complexFilters('-map', map.replace(utils.streamRegexp, '[$1]'));
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun May 01 2016 12:10:37 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
228
node_modules/fluent-ffmpeg/doc/options_inputs.js.html
generated
vendored
Normal file
228
node_modules/fluent-ffmpeg/doc/options_inputs.js.html
generated
vendored
Normal file
@@ -0,0 +1,228 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: options/inputs.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: options/inputs.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*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;
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun May 01 2016 12:10:37 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
91
node_modules/fluent-ffmpeg/doc/options_misc.js.html
generated
vendored
Normal file
91
node_modules/fluent-ffmpeg/doc/options_misc.js.html
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: options/misc.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: options/misc.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*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;
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun May 01 2016 12:10:37 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
212
node_modules/fluent-ffmpeg/doc/options_output.js.html
generated
vendored
Normal file
212
node_modules/fluent-ffmpeg/doc/options_output.js.html
generated
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: options/output.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: options/output.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*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;
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun May 01 2016 12:10:37 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
234
node_modules/fluent-ffmpeg/doc/options_video.js.html
generated
vendored
Normal file
234
node_modules/fluent-ffmpeg/doc/options_video.js.html
generated
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: options/video.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: options/video.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*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;
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun May 01 2016 12:10:37 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
341
node_modules/fluent-ffmpeg/doc/options_videosize.js.html
generated
vendored
Normal file
341
node_modules/fluent-ffmpeg/doc/options_videosize.js.html
generated
vendored
Normal file
@@ -0,0 +1,341 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: options/videosize.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: options/videosize.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*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;
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun May 01 2016 12:10:37 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
212
node_modules/fluent-ffmpeg/doc/output.js.html
generated
vendored
Normal file
212
node_modules/fluent-ffmpeg/doc/output.js.html
generated
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: options/output.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: options/output.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*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;
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
708
node_modules/fluent-ffmpeg/doc/processor.js.html
generated
vendored
Normal file
708
node_modules/fluent-ffmpeg/doc/processor.js.html
generated
vendored
Normal file
@@ -0,0 +1,708 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: processor.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: processor.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*jshint node:true*/
|
||||
'use strict';
|
||||
|
||||
var spawn = require('child_process').spawn;
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var async = require('async');
|
||||
var utils = require('./utils');
|
||||
|
||||
var nlRegexp = /\r\n|\r|\n/g;
|
||||
|
||||
/*
|
||||
*! Processor methods
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Run ffprobe asynchronously and store data in command
|
||||
*
|
||||
* @param {FfmpegCommand} command
|
||||
* @private
|
||||
*/
|
||||
function runFfprobe(command) {
|
||||
command.ffprobe(0, function(err, data) {
|
||||
command._ffprobeData = data;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
module.exports = function(proto) {
|
||||
/**
|
||||
* Emitted just after ffmpeg has been spawned.
|
||||
*
|
||||
* @event FfmpegCommand#start
|
||||
* @param {String} command ffmpeg command line
|
||||
*/
|
||||
|
||||
/**
|
||||
* Emitted when ffmpeg reports progress information
|
||||
*
|
||||
* @event FfmpegCommand#progress
|
||||
* @param {Object} progress progress object
|
||||
* @param {Number} progress.frames number of frames transcoded
|
||||
* @param {Number} progress.currentFps current processing speed in frames per second
|
||||
* @param {Number} progress.currentKbps current output generation speed in kilobytes per second
|
||||
* @param {Number} progress.targetSize current output file size
|
||||
* @param {String} progress.timemark current video timemark
|
||||
* @param {Number} [progress.percent] processing progress (may not be available depending on input)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Emitted when ffmpeg outputs to stderr
|
||||
*
|
||||
* @event FfmpegCommand#stderr
|
||||
* @param {String} line stderr output line
|
||||
*/
|
||||
|
||||
/**
|
||||
* Emitted when ffmpeg reports input codec data
|
||||
*
|
||||
* @event FfmpegCommand#codecData
|
||||
* @param {Object} codecData codec data object
|
||||
* @param {String} codecData.format input format name
|
||||
* @param {String} codecData.audio input audio codec name
|
||||
* @param {String} codecData.audio_details input audio codec parameters
|
||||
* @param {String} codecData.video input video codec name
|
||||
* @param {String} codecData.video_details input video codec parameters
|
||||
*/
|
||||
|
||||
/**
|
||||
* Emitted when an error happens when preparing or running a command
|
||||
*
|
||||
* @event FfmpegCommand#error
|
||||
* @param {Error} error error object
|
||||
* @param {String|null} stdout ffmpeg stdout, unless outputting to a stream
|
||||
* @param {String|null} stderr ffmpeg stderr
|
||||
*/
|
||||
|
||||
/**
|
||||
* Emitted when a command finishes processing
|
||||
*
|
||||
* @event FfmpegCommand#end
|
||||
* @param {Array|String|null} [filenames|stdout] generated filenames when taking screenshots, ffmpeg stdout when not outputting to a stream, null otherwise
|
||||
* @param {String|null} stderr ffmpeg stderr
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Spawn an ffmpeg process
|
||||
*
|
||||
* The 'options' argument may contain the following keys:
|
||||
* - 'niceness': specify process niceness, ignored on Windows (default: 0)
|
||||
* - `cwd`: change working directory
|
||||
* - 'captureStdout': capture stdout and pass it to 'endCB' as its 2nd argument (default: false)
|
||||
* - 'stdoutLines': override command limit (default: use command limit)
|
||||
*
|
||||
* The 'processCB' callback, if present, is called as soon as the process is created and
|
||||
* receives a nodejs ChildProcess object. It may not be called at all if an error happens
|
||||
* before spawning the process.
|
||||
*
|
||||
* The 'endCB' callback is called either when an error occurs or when the ffmpeg process finishes.
|
||||
*
|
||||
* @method FfmpegCommand#_spawnFfmpeg
|
||||
* @param {Array} args ffmpeg command line argument list
|
||||
* @param {Object} [options] spawn options (see above)
|
||||
* @param {Function} [processCB] callback called with process object and stdout/stderr ring buffers when process has been created
|
||||
* @param {Function} endCB callback called with error (if applicable) and stdout/stderr ring buffers when process finished
|
||||
* @private
|
||||
*/
|
||||
proto._spawnFfmpeg = function(args, options, processCB, endCB) {
|
||||
// Enable omitting options
|
||||
if (typeof options === 'function') {
|
||||
endCB = processCB;
|
||||
processCB = options;
|
||||
options = {};
|
||||
}
|
||||
|
||||
// Enable omitting processCB
|
||||
if (typeof endCB === 'undefined') {
|
||||
endCB = processCB;
|
||||
processCB = function() {};
|
||||
}
|
||||
|
||||
var maxLines = 'stdoutLines' in options ? options.stdoutLines : this.options.stdoutLines;
|
||||
|
||||
// Find ffmpeg
|
||||
this._getFfmpegPath(function(err, command) {
|
||||
if (err) {
|
||||
return endCB(err);
|
||||
} else if (!command || command.length === 0) {
|
||||
return endCB(new Error('Cannot find ffmpeg'));
|
||||
}
|
||||
|
||||
// Apply niceness
|
||||
if (options.niceness && options.niceness !== 0 && !utils.isWindows) {
|
||||
args.unshift('-n', options.niceness, command);
|
||||
command = 'nice';
|
||||
}
|
||||
|
||||
var stdoutRing = utils.linesRing(maxLines);
|
||||
var stdoutClosed = false;
|
||||
|
||||
var stderrRing = utils.linesRing(maxLines);
|
||||
var stderrClosed = false;
|
||||
|
||||
// Spawn process
|
||||
var ffmpegProc = spawn(command, args, options);
|
||||
|
||||
if (ffmpegProc.stderr) {
|
||||
ffmpegProc.stderr.setEncoding('utf8');
|
||||
}
|
||||
|
||||
ffmpegProc.on('error', function(err) {
|
||||
endCB(err);
|
||||
});
|
||||
|
||||
// Ensure we wait for captured streams to end before calling endCB
|
||||
var exitError = null;
|
||||
function handleExit(err) {
|
||||
if (err) {
|
||||
exitError = err;
|
||||
}
|
||||
|
||||
if (processExited && (stdoutClosed || !options.captureStdout) && stderrClosed) {
|
||||
endCB(exitError, stdoutRing, stderrRing);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle process exit
|
||||
var processExited = false;
|
||||
ffmpegProc.on('exit', function(code, signal) {
|
||||
processExited = true;
|
||||
|
||||
if (signal) {
|
||||
handleExit(new Error('ffmpeg was killed with signal ' + signal));
|
||||
} else if (code) {
|
||||
handleExit(new Error('ffmpeg exited with code ' + code));
|
||||
} else {
|
||||
handleExit();
|
||||
}
|
||||
});
|
||||
|
||||
// Capture stdout if specified
|
||||
if (options.captureStdout) {
|
||||
ffmpegProc.stdout.on('data', function(data) {
|
||||
stdoutRing.append(data);
|
||||
});
|
||||
|
||||
ffmpegProc.stdout.on('close', function() {
|
||||
stdoutRing.close();
|
||||
stdoutClosed = true;
|
||||
handleExit();
|
||||
});
|
||||
}
|
||||
|
||||
// Capture stderr if specified
|
||||
ffmpegProc.stderr.on('data', function(data) {
|
||||
stderrRing.append(data);
|
||||
});
|
||||
|
||||
ffmpegProc.stderr.on('close', function() {
|
||||
stderrRing.close();
|
||||
stderrClosed = true;
|
||||
handleExit();
|
||||
});
|
||||
|
||||
// Call process callback
|
||||
processCB(ffmpegProc, stdoutRing, stderrRing);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Build the argument list for an ffmpeg command
|
||||
*
|
||||
* @method FfmpegCommand#_getArguments
|
||||
* @return argument list
|
||||
* @private
|
||||
*/
|
||||
proto._getArguments = function() {
|
||||
var complexFilters = this._complexFilters.get();
|
||||
|
||||
var fileOutput = this._outputs.some(function(output) {
|
||||
return output.isFile;
|
||||
});
|
||||
|
||||
return [].concat(
|
||||
// Inputs and input options
|
||||
this._inputs.reduce(function(args, input) {
|
||||
var source = (typeof input.source === 'string') ? input.source : 'pipe:0';
|
||||
|
||||
// For each input, add input options, then '-i <source>'
|
||||
return args.concat(
|
||||
input.options.get(),
|
||||
['-i', source]
|
||||
);
|
||||
}, []),
|
||||
|
||||
// Global options
|
||||
this._global.get(),
|
||||
|
||||
// Overwrite if we have file outputs
|
||||
fileOutput ? ['-y'] : [],
|
||||
|
||||
// Complex filters
|
||||
complexFilters,
|
||||
|
||||
// Outputs, filters and output options
|
||||
this._outputs.reduce(function(args, output) {
|
||||
var sizeFilters = utils.makeFilterStrings(output.sizeFilters.get());
|
||||
var audioFilters = output.audioFilters.get();
|
||||
var videoFilters = output.videoFilters.get().concat(sizeFilters);
|
||||
var outputArg;
|
||||
|
||||
if (!output.target) {
|
||||
outputArg = [];
|
||||
} else if (typeof output.target === 'string') {
|
||||
outputArg = [output.target];
|
||||
} else {
|
||||
outputArg = ['pipe:1'];
|
||||
}
|
||||
|
||||
return args.concat(
|
||||
output.audio.get(),
|
||||
audioFilters.length ? ['-filter:a', audioFilters.join(',')] : [],
|
||||
output.video.get(),
|
||||
videoFilters.length ? ['-filter:v', videoFilters.join(',')] : [],
|
||||
output.options.get(),
|
||||
outputArg
|
||||
);
|
||||
}, [])
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Prepare execution of an ffmpeg command
|
||||
*
|
||||
* Checks prerequisites for the execution of the command (codec/format availability, flvtool...),
|
||||
* then builds the argument list for ffmpeg and pass them to 'callback'.
|
||||
*
|
||||
* @method FfmpegCommand#_prepare
|
||||
* @param {Function} callback callback with signature (err, args)
|
||||
* @param {Boolean} [readMetadata=false] read metadata before processing
|
||||
* @private
|
||||
*/
|
||||
proto._prepare = function(callback, readMetadata) {
|
||||
var self = this;
|
||||
|
||||
async.waterfall([
|
||||
// Check codecs and formats
|
||||
function(cb) {
|
||||
self._checkCapabilities(cb);
|
||||
},
|
||||
|
||||
// Read metadata if required
|
||||
function(cb) {
|
||||
if (!readMetadata) {
|
||||
return cb();
|
||||
}
|
||||
|
||||
self.ffprobe(0, function(err, data) {
|
||||
if (!err) {
|
||||
self._ffprobeData = data;
|
||||
}
|
||||
|
||||
cb();
|
||||
});
|
||||
},
|
||||
|
||||
// Check for flvtool2/flvmeta if necessary
|
||||
function(cb) {
|
||||
var flvmeta = self._outputs.some(function(output) {
|
||||
// Remove flvmeta flag on non-file output
|
||||
if (output.flags.flvmeta && !output.isFile) {
|
||||
self.logger.warn('Updating flv metadata is only supported for files');
|
||||
output.flags.flvmeta = false;
|
||||
}
|
||||
|
||||
return output.flags.flvmeta;
|
||||
});
|
||||
|
||||
if (flvmeta) {
|
||||
self._getFlvtoolPath(function(err) {
|
||||
cb(err);
|
||||
});
|
||||
} else {
|
||||
cb();
|
||||
}
|
||||
},
|
||||
|
||||
// Build argument list
|
||||
function(cb) {
|
||||
var args;
|
||||
try {
|
||||
args = self._getArguments();
|
||||
} catch(e) {
|
||||
return cb(e);
|
||||
}
|
||||
|
||||
cb(null, args);
|
||||
},
|
||||
|
||||
// Add "-strict experimental" option where needed
|
||||
function(args, cb) {
|
||||
self.availableEncoders(function(err, encoders) {
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
if (args[i] === '-acodec' || args[i] === '-vcodec') {
|
||||
i++;
|
||||
|
||||
if ((args[i] in encoders) && encoders[args[i]].experimental) {
|
||||
args.splice(i + 1, 0, '-strict', 'experimental');
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cb(null, args);
|
||||
});
|
||||
}
|
||||
], callback);
|
||||
|
||||
if (!readMetadata) {
|
||||
// Read metadata as soon as 'progress' listeners are added
|
||||
|
||||
if (this.listeners('progress').length > 0) {
|
||||
// Read metadata in parallel
|
||||
runFfprobe(this);
|
||||
} else {
|
||||
// Read metadata as soon as the first 'progress' listener is added
|
||||
this.once('newListener', function(event) {
|
||||
if (event === 'progress') {
|
||||
runFfprobe(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Run ffmpeg command
|
||||
*
|
||||
* @method FfmpegCommand#run
|
||||
* @category Processing
|
||||
* @aliases exec,execute
|
||||
*/
|
||||
proto.exec =
|
||||
proto.execute =
|
||||
proto.run = function() {
|
||||
var self = this;
|
||||
|
||||
// Check if at least one output is present
|
||||
var outputPresent = this._outputs.some(function(output) {
|
||||
return 'target' in output;
|
||||
});
|
||||
|
||||
if (!outputPresent) {
|
||||
throw new Error('No output specified');
|
||||
}
|
||||
|
||||
// Get output stream if any
|
||||
var outputStream = this._outputs.filter(function(output) {
|
||||
return typeof output.target !== 'string';
|
||||
})[0];
|
||||
|
||||
// Get input stream if any
|
||||
var inputStream = this._inputs.filter(function(input) {
|
||||
return typeof input.source !== 'string';
|
||||
})[0];
|
||||
|
||||
// Ensure we send 'end' or 'error' only once
|
||||
var ended = false;
|
||||
function emitEnd(err, stdout, stderr) {
|
||||
if (!ended) {
|
||||
ended = true;
|
||||
|
||||
if (err) {
|
||||
self.emit('error', err, stdout, stderr);
|
||||
} else {
|
||||
self.emit('end', stdout, stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self._prepare(function(err, args) {
|
||||
if (err) {
|
||||
return emitEnd(err);
|
||||
}
|
||||
|
||||
// Run ffmpeg
|
||||
self._spawnFfmpeg(
|
||||
args,
|
||||
{
|
||||
captureStdout: !outputStream,
|
||||
niceness: self.options.niceness,
|
||||
cwd: self.options.cwd
|
||||
},
|
||||
|
||||
function processCB(ffmpegProc, stdoutRing, stderrRing) {
|
||||
self.ffmpegProc = ffmpegProc;
|
||||
self.emit('start', 'ffmpeg ' + args.join(' '));
|
||||
|
||||
// Pipe input stream if any
|
||||
if (inputStream) {
|
||||
inputStream.source.on('error', function(err) {
|
||||
emitEnd(new Error('Input stream error: ' + err.message));
|
||||
ffmpegProc.kill();
|
||||
});
|
||||
|
||||
inputStream.source.resume();
|
||||
inputStream.source.pipe(ffmpegProc.stdin);
|
||||
|
||||
// Set stdin error handler on ffmpeg (prevents nodejs catching the error, but
|
||||
// ffmpeg will fail anyway, so no need to actually handle anything)
|
||||
ffmpegProc.stdin.on('error', function() {});
|
||||
}
|
||||
|
||||
// Setup timeout if requested
|
||||
var processTimer;
|
||||
if (self.options.timeout) {
|
||||
processTimer = setTimeout(function() {
|
||||
var msg = 'process ran into a timeout (' + self.options.timeout + 's)';
|
||||
|
||||
emitEnd(new Error(msg), stdoutRing.get(), stderrRing.get());
|
||||
ffmpegProc.kill();
|
||||
}, self.options.timeout * 1000);
|
||||
}
|
||||
|
||||
|
||||
if (outputStream) {
|
||||
// Pipe ffmpeg stdout to output stream
|
||||
ffmpegProc.stdout.pipe(outputStream.target, outputStream.pipeopts);
|
||||
|
||||
// Handle output stream events
|
||||
outputStream.target.on('close', function() {
|
||||
self.logger.debug('Output stream closed, scheduling kill for ffmpgeg process');
|
||||
|
||||
// Don't kill process yet, to give a chance to ffmpeg to
|
||||
// terminate successfully first This is necessary because
|
||||
// under load, the process 'exit' event sometimes happens
|
||||
// after the output stream 'close' event.
|
||||
setTimeout(function() {
|
||||
emitEnd(new Error('Output stream closed'));
|
||||
ffmpegProc.kill();
|
||||
}, 20);
|
||||
});
|
||||
|
||||
outputStream.target.on('error', function(err) {
|
||||
self.logger.debug('Output stream error, killing ffmpgeg process');
|
||||
emitEnd(new Error('Output stream error: ' + err.message), stdoutRing.get(), stderrRing.get());
|
||||
ffmpegProc.kill();
|
||||
});
|
||||
}
|
||||
|
||||
// Setup stderr handling
|
||||
if (stderrRing) {
|
||||
|
||||
// 'stderr' event
|
||||
if (self.listeners('stderr').length) {
|
||||
stderrRing.callback(function(line) {
|
||||
self.emit('stderr', line);
|
||||
});
|
||||
}
|
||||
|
||||
// 'codecData' event
|
||||
if (self.listeners('codecData').length) {
|
||||
var codecDataSent = false;
|
||||
var codecObject = {};
|
||||
|
||||
stderrRing.callback(function(line) {
|
||||
if (!codecDataSent)
|
||||
codecDataSent = utils.extractCodecData(self, line, codecObject);
|
||||
});
|
||||
}
|
||||
|
||||
// 'progress' event
|
||||
if (self.listeners('progress').length) {
|
||||
var duration = 0;
|
||||
|
||||
if (self._ffprobeData && self._ffprobeData.format && self._ffprobeData.format.duration) {
|
||||
duration = Number(self._ffprobeData.format.duration);
|
||||
}
|
||||
|
||||
stderrRing.callback(function(line) {
|
||||
utils.extractProgress(self, line, duration);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
function endCB(err, stdoutRing, stderrRing) {
|
||||
delete self.ffmpegProc;
|
||||
|
||||
if (err) {
|
||||
if (err.message.match(/ffmpeg exited with code/)) {
|
||||
// Add ffmpeg error message
|
||||
err.message += ': ' + utils.extractError(stderrRing.get());
|
||||
}
|
||||
|
||||
emitEnd(err, stdoutRing.get(), stderrRing.get());
|
||||
} else {
|
||||
// Find out which outputs need flv metadata
|
||||
var flvmeta = self._outputs.filter(function(output) {
|
||||
return output.flags.flvmeta;
|
||||
});
|
||||
|
||||
if (flvmeta.length) {
|
||||
self._getFlvtoolPath(function(err, flvtool) {
|
||||
if (err) {
|
||||
return emitEnd(err);
|
||||
}
|
||||
|
||||
async.each(
|
||||
flvmeta,
|
||||
function(output, cb) {
|
||||
spawn(flvtool, ['-U', output.target])
|
||||
.on('error', function(err) {
|
||||
cb(new Error('Error running ' + flvtool + ' on ' + output.target + ': ' + err.message));
|
||||
})
|
||||
.on('exit', function(code, signal) {
|
||||
if (code !== 0 || signal) {
|
||||
cb(
|
||||
new Error(flvtool + ' ' +
|
||||
(signal ? 'received signal ' + signal
|
||||
: 'exited with code ' + code)) +
|
||||
' when running on ' + output.target
|
||||
);
|
||||
} else {
|
||||
cb();
|
||||
}
|
||||
});
|
||||
},
|
||||
function(err) {
|
||||
if (err) {
|
||||
emitEnd(err);
|
||||
} else {
|
||||
emitEnd(null, stdoutRing.get(), stderrRing.get());
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
} else {
|
||||
emitEnd(null, stdoutRing.get(), stderrRing.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Renice current and/or future ffmpeg processes
|
||||
*
|
||||
* Ignored on Windows platforms.
|
||||
*
|
||||
* @method FfmpegCommand#renice
|
||||
* @category Processing
|
||||
*
|
||||
* @param {Number} [niceness=0] niceness value between -20 (highest priority) and 20 (lowest priority)
|
||||
* @return FfmpegCommand
|
||||
*/
|
||||
proto.renice = function(niceness) {
|
||||
if (!utils.isWindows) {
|
||||
niceness = niceness || 0;
|
||||
|
||||
if (niceness < -20 || niceness > 20) {
|
||||
this.logger.warn('Invalid niceness value: ' + niceness + ', must be between -20 and 20');
|
||||
}
|
||||
|
||||
niceness = Math.min(20, Math.max(-20, niceness));
|
||||
this.options.niceness = niceness;
|
||||
|
||||
if (this.ffmpegProc) {
|
||||
var logger = this.logger;
|
||||
var pid = this.ffmpegProc.pid;
|
||||
var renice = spawn('renice', [niceness, '-p', pid]);
|
||||
|
||||
renice.on('error', function(err) {
|
||||
logger.warn('could not renice process ' + pid + ': ' + err.message);
|
||||
});
|
||||
|
||||
renice.on('exit', function(code, signal) {
|
||||
if (signal) {
|
||||
logger.warn('could not renice process ' + pid + ': renice was killed by signal ' + signal);
|
||||
} else if (code) {
|
||||
logger.warn('could not renice process ' + pid + ': renice exited with ' + code);
|
||||
} else {
|
||||
logger.info('successfully reniced process ' + pid + ' to ' + niceness + ' niceness');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Kill current ffmpeg process, if any
|
||||
*
|
||||
* @method FfmpegCommand#kill
|
||||
* @category Processing
|
||||
*
|
||||
* @param {String} [signal=SIGKILL] signal name
|
||||
* @return FfmpegCommand
|
||||
*/
|
||||
proto.kill = function(signal) {
|
||||
if (!this.ffmpegProc) {
|
||||
this.logger.warn('No running ffmpeg process, cannot send signal');
|
||||
} else {
|
||||
this.ffmpegProc.kill(signal || 'SIGKILL');
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun May 01 2016 12:10:37 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
506
node_modules/fluent-ffmpeg/doc/recipes.js.html
generated
vendored
Normal file
506
node_modules/fluent-ffmpeg/doc/recipes.js.html
generated
vendored
Normal file
@@ -0,0 +1,506 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: recipes.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: recipes.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*jshint node:true*/
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var PassThrough = require('stream').PassThrough;
|
||||
var async = require('async');
|
||||
var utils = require('./utils');
|
||||
|
||||
|
||||
/*
|
||||
* Useful recipes for commands
|
||||
*/
|
||||
|
||||
module.exports = function recipes(proto) {
|
||||
/**
|
||||
* Execute ffmpeg command and save output to a file
|
||||
*
|
||||
* @method FfmpegCommand#save
|
||||
* @category Processing
|
||||
* @aliases saveToFile
|
||||
*
|
||||
* @param {String} output file path
|
||||
* @return FfmpegCommand
|
||||
*/
|
||||
proto.saveToFile =
|
||||
proto.save = function(output) {
|
||||
this.output(output).run();
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Execute ffmpeg command and save output to a stream
|
||||
*
|
||||
* If 'stream' is not specified, a PassThrough stream is created and returned.
|
||||
* 'options' will be used when piping ffmpeg output to the output stream
|
||||
* (@see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options)
|
||||
*
|
||||
* @method FfmpegCommand#pipe
|
||||
* @category Processing
|
||||
* @aliases stream,writeToStream
|
||||
*
|
||||
* @param {stream.Writable} [stream] output stream
|
||||
* @param {Object} [options={}] pipe options
|
||||
* @return Output stream
|
||||
*/
|
||||
proto.writeToStream =
|
||||
proto.pipe =
|
||||
proto.stream = function(stream, options) {
|
||||
if (stream && !('writable' in stream)) {
|
||||
options = stream;
|
||||
stream = undefined;
|
||||
}
|
||||
|
||||
if (!stream) {
|
||||
if (process.version.match(/v0\.8\./)) {
|
||||
throw new Error('PassThrough stream is not supported on node v0.8');
|
||||
}
|
||||
|
||||
stream = new PassThrough();
|
||||
}
|
||||
|
||||
this.output(stream, options).run();
|
||||
return stream;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Generate images from a video
|
||||
*
|
||||
* Note: this method makes the command emit a 'filenames' event with an array of
|
||||
* the generated image filenames.
|
||||
*
|
||||
* @method FfmpegCommand#screenshots
|
||||
* @category Processing
|
||||
* @aliases takeScreenshots,thumbnail,thumbnails,screenshot
|
||||
*
|
||||
* @param {Number|Object} [config=1] screenshot count or configuration object with
|
||||
* the following keys:
|
||||
* @param {Number} [config.count] number of screenshots to take; using this option
|
||||
* takes screenshots at regular intervals (eg. count=4 would take screens at 20%, 40%,
|
||||
* 60% and 80% of the video length).
|
||||
* @param {String} [config.folder='.'] output folder
|
||||
* @param {String} [config.filename='tn.png'] output filename pattern, may contain the following
|
||||
* tokens:
|
||||
* - '%s': offset in seconds
|
||||
* - '%w': screenshot width
|
||||
* - '%h': screenshot height
|
||||
* - '%r': screenshot resolution (same as '%wx%h')
|
||||
* - '%f': input filename
|
||||
* - '%b': input basename (filename w/o extension)
|
||||
* - '%i': index of screenshot in timemark array (can be zero-padded by using it like `%000i`)
|
||||
* @param {Number[]|String[]} [config.timemarks] array of timemarks to take screenshots
|
||||
* at; each timemark may be a number of seconds, a '[[hh:]mm:]ss[.xxx]' string or a
|
||||
* 'XX%' string. Overrides 'count' if present.
|
||||
* @param {Number[]|String[]} [config.timestamps] alias for 'timemarks'
|
||||
* @param {Boolean} [config.fastSeek] use fast seek (less accurate)
|
||||
* @param {String} [config.size] screenshot size, with the same syntax as {@link FfmpegCommand#size}
|
||||
* @param {String} [folder] output folder (legacy alias for 'config.folder')
|
||||
* @return FfmpegCommand
|
||||
*/
|
||||
proto.takeScreenshots =
|
||||
proto.thumbnail =
|
||||
proto.thumbnails =
|
||||
proto.screenshot =
|
||||
proto.screenshots = function(config, folder) {
|
||||
var self = this;
|
||||
var source = this._currentInput.source;
|
||||
config = config || { count: 1 };
|
||||
|
||||
// Accept a number of screenshots instead of a config object
|
||||
if (typeof config === 'number') {
|
||||
config = {
|
||||
count: config
|
||||
};
|
||||
}
|
||||
|
||||
// Accept a second 'folder' parameter instead of config.folder
|
||||
if (!('folder' in config)) {
|
||||
config.folder = folder || '.';
|
||||
}
|
||||
|
||||
// Accept 'timestamps' instead of 'timemarks'
|
||||
if ('timestamps' in config) {
|
||||
config.timemarks = config.timestamps;
|
||||
}
|
||||
|
||||
// Compute timemarks from count if not present
|
||||
if (!('timemarks' in config)) {
|
||||
if (!config.count) {
|
||||
throw new Error('Cannot take screenshots: neither a count nor a timemark list are specified');
|
||||
}
|
||||
|
||||
var interval = 100 / (1 + config.count);
|
||||
config.timemarks = [];
|
||||
for (var i = 0; i < config.count; i++) {
|
||||
config.timemarks.push((interval * (i + 1)) + '%');
|
||||
}
|
||||
}
|
||||
|
||||
// Parse size option
|
||||
if ('size' in config) {
|
||||
var fixedSize = config.size.match(/^(\d+)x(\d+)$/);
|
||||
var fixedWidth = config.size.match(/^(\d+)x\?$/);
|
||||
var fixedHeight = config.size.match(/^\?x(\d+)$/);
|
||||
var percentSize = config.size.match(/^(\d+)%$/);
|
||||
|
||||
if (!fixedSize && !fixedWidth && !fixedHeight && !percentSize) {
|
||||
throw new Error('Invalid size parameter: ' + config.size);
|
||||
}
|
||||
}
|
||||
|
||||
// Metadata helper
|
||||
var metadata;
|
||||
function getMetadata(cb) {
|
||||
if (metadata) {
|
||||
cb(null, metadata);
|
||||
} else {
|
||||
self.ffprobe(function(err, meta) {
|
||||
metadata = meta;
|
||||
cb(err, meta);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async.waterfall([
|
||||
// Compute percent timemarks if any
|
||||
function computeTimemarks(next) {
|
||||
if (config.timemarks.some(function(t) { return ('' + t).match(/^[\d.]+%$/); })) {
|
||||
if (typeof source !== 'string') {
|
||||
return next(new Error('Cannot compute screenshot timemarks with an input stream, please specify fixed timemarks'));
|
||||
}
|
||||
|
||||
getMetadata(function(err, meta) {
|
||||
if (err) {
|
||||
next(err);
|
||||
} else {
|
||||
// Select video stream with the highest resolution
|
||||
var vstream = meta.streams.reduce(function(biggest, stream) {
|
||||
if (stream.codec_type === 'video' && stream.width * stream.height > biggest.width * biggest.height) {
|
||||
return stream;
|
||||
} else {
|
||||
return biggest;
|
||||
}
|
||||
}, { width: 0, height: 0 });
|
||||
|
||||
if (vstream.width === 0) {
|
||||
return next(new Error('No video stream in input, cannot take screenshots'));
|
||||
}
|
||||
|
||||
var duration = Number(vstream.duration);
|
||||
if (isNaN(duration)) {
|
||||
duration = Number(meta.format.duration);
|
||||
}
|
||||
|
||||
if (isNaN(duration)) {
|
||||
return next(new Error('Could not get input duration, please specify fixed timemarks'));
|
||||
}
|
||||
|
||||
config.timemarks = config.timemarks.map(function(mark) {
|
||||
if (('' + mark).match(/^([\d.]+)%$/)) {
|
||||
return duration * parseFloat(mark) / 100;
|
||||
} else {
|
||||
return mark;
|
||||
}
|
||||
});
|
||||
|
||||
next();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
},
|
||||
|
||||
// Turn all timemarks into numbers and sort them
|
||||
function normalizeTimemarks(next) {
|
||||
config.timemarks = config.timemarks.map(function(mark) {
|
||||
return utils.timemarkToSeconds(mark);
|
||||
}).sort(function(a, b) { return a - b; });
|
||||
|
||||
next();
|
||||
},
|
||||
|
||||
// Add '_%i' to pattern when requesting multiple screenshots and no variable token is present
|
||||
function fixPattern(next) {
|
||||
var pattern = config.filename || 'tn.png';
|
||||
|
||||
if (pattern.indexOf('.') === -1) {
|
||||
pattern += '.png';
|
||||
}
|
||||
|
||||
if (config.timemarks.length > 1 && !pattern.match(/%(s|0*i)/)) {
|
||||
var ext = path.extname(pattern);
|
||||
pattern = path.join(path.dirname(pattern), path.basename(pattern, ext) + '_%i' + ext);
|
||||
}
|
||||
|
||||
next(null, pattern);
|
||||
},
|
||||
|
||||
// Replace filename tokens (%f, %b) in pattern
|
||||
function replaceFilenameTokens(pattern, next) {
|
||||
if (pattern.match(/%[bf]/)) {
|
||||
if (typeof source !== 'string') {
|
||||
return next(new Error('Cannot replace %f or %b when using an input stream'));
|
||||
}
|
||||
|
||||
pattern = pattern
|
||||
.replace(/%f/g, path.basename(source))
|
||||
.replace(/%b/g, path.basename(source, path.extname(source)));
|
||||
}
|
||||
|
||||
next(null, pattern);
|
||||
},
|
||||
|
||||
// Compute size if needed
|
||||
function getSize(pattern, next) {
|
||||
if (pattern.match(/%[whr]/)) {
|
||||
if (fixedSize) {
|
||||
return next(null, pattern, fixedSize[1], fixedSize[2]);
|
||||
}
|
||||
|
||||
getMetadata(function(err, meta) {
|
||||
if (err) {
|
||||
return next(new Error('Could not determine video resolution to replace %w, %h or %r'));
|
||||
}
|
||||
|
||||
var vstream = meta.streams.reduce(function(biggest, stream) {
|
||||
if (stream.codec_type === 'video' && stream.width * stream.height > biggest.width * biggest.height) {
|
||||
return stream;
|
||||
} else {
|
||||
return biggest;
|
||||
}
|
||||
}, { width: 0, height: 0 });
|
||||
|
||||
if (vstream.width === 0) {
|
||||
return next(new Error('No video stream in input, cannot replace %w, %h or %r'));
|
||||
}
|
||||
|
||||
var width = vstream.width;
|
||||
var height = vstream.height;
|
||||
|
||||
if (fixedWidth) {
|
||||
height = height * Number(fixedWidth[1]) / width;
|
||||
width = Number(fixedWidth[1]);
|
||||
} else if (fixedHeight) {
|
||||
width = width * Number(fixedHeight[1]) / height;
|
||||
height = Number(fixedHeight[1]);
|
||||
} else if (percentSize) {
|
||||
width = width * Number(percentSize[1]) / 100;
|
||||
height = height * Number(percentSize[1]) / 100;
|
||||
}
|
||||
|
||||
next(null, pattern, Math.round(width / 2) * 2, Math.round(height / 2) * 2);
|
||||
});
|
||||
} else {
|
||||
next(null, pattern, -1, -1);
|
||||
}
|
||||
},
|
||||
|
||||
// Replace size tokens (%w, %h, %r) in pattern
|
||||
function replaceSizeTokens(pattern, width, height, next) {
|
||||
pattern = pattern
|
||||
.replace(/%r/g, '%wx%h')
|
||||
.replace(/%w/g, width)
|
||||
.replace(/%h/g, height);
|
||||
|
||||
next(null, pattern);
|
||||
},
|
||||
|
||||
// Replace variable tokens in pattern (%s, %i) and generate filename list
|
||||
function replaceVariableTokens(pattern, next) {
|
||||
var filenames = config.timemarks.map(function(t, i) {
|
||||
return pattern
|
||||
.replace(/%s/g, utils.timemarkToSeconds(t))
|
||||
.replace(/%(0*)i/g, function(match, padding) {
|
||||
var idx = '' + (i + 1);
|
||||
return padding.substr(0, Math.max(0, padding.length + 1 - idx.length)) + idx;
|
||||
});
|
||||
});
|
||||
|
||||
self.emit('filenames', filenames);
|
||||
next(null, filenames);
|
||||
},
|
||||
|
||||
// Create output directory
|
||||
function createDirectory(filenames, next) {
|
||||
fs.exists(config.folder, function(exists) {
|
||||
if (!exists) {
|
||||
fs.mkdir(config.folder, function(err) {
|
||||
if (err) {
|
||||
next(err);
|
||||
} else {
|
||||
next(null, filenames);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
next(null, filenames);
|
||||
}
|
||||
});
|
||||
}
|
||||
], function runCommand(err, filenames) {
|
||||
if (err) {
|
||||
return self.emit('error', err);
|
||||
}
|
||||
|
||||
var count = config.timemarks.length;
|
||||
var split;
|
||||
var filters = [split = {
|
||||
filter: 'split',
|
||||
options: count,
|
||||
outputs: []
|
||||
}];
|
||||
|
||||
if ('size' in config) {
|
||||
// Set size to generate size filters
|
||||
self.size(config.size);
|
||||
|
||||
// Get size filters and chain them with 'sizeN' stream names
|
||||
var sizeFilters = self._currentOutput.sizeFilters.get().map(function(f, i) {
|
||||
if (i > 0) {
|
||||
f.inputs = 'size' + (i - 1);
|
||||
}
|
||||
|
||||
f.outputs = 'size' + i;
|
||||
|
||||
return f;
|
||||
});
|
||||
|
||||
// Input last size filter output into split filter
|
||||
split.inputs = 'size' + (sizeFilters.length - 1);
|
||||
|
||||
// Add size filters in front of split filter
|
||||
filters = sizeFilters.concat(filters);
|
||||
|
||||
// Remove size filters
|
||||
self._currentOutput.sizeFilters.clear();
|
||||
}
|
||||
|
||||
var first = 0;
|
||||
for (var i = 0; i < count; i++) {
|
||||
var stream = 'screen' + i;
|
||||
split.outputs.push(stream);
|
||||
|
||||
if (i === 0) {
|
||||
first = config.timemarks[i];
|
||||
self.seekInput(first);
|
||||
}
|
||||
|
||||
self.output(path.join(config.folder, filenames[i]))
|
||||
.frames(1)
|
||||
.map(stream);
|
||||
|
||||
if (i > 0) {
|
||||
self.seek(config.timemarks[i] - first);
|
||||
}
|
||||
}
|
||||
|
||||
self.complexFilter(filters);
|
||||
self.run();
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Merge (concatenate) inputs to a single file
|
||||
*
|
||||
* @method FfmpegCommand#concat
|
||||
* @category Processing
|
||||
* @aliases concatenate,mergeToFile
|
||||
*
|
||||
* @param {String|Writable} target output file or writable stream
|
||||
* @param {Object} [options] pipe options (only used when outputting to a writable stream)
|
||||
* @return FfmpegCommand
|
||||
*/
|
||||
proto.mergeToFile =
|
||||
proto.concatenate =
|
||||
proto.concat = function(target, options) {
|
||||
// Find out which streams are present in the first non-stream input
|
||||
var fileInput = this._inputs.filter(function(input) {
|
||||
return !input.isStream;
|
||||
})[0];
|
||||
|
||||
var self = this;
|
||||
this.ffprobe(this._inputs.indexOf(fileInput), function(err, data) {
|
||||
if (err) {
|
||||
return self.emit('error', err);
|
||||
}
|
||||
|
||||
var hasAudioStreams = data.streams.some(function(stream) {
|
||||
return stream.codec_type === 'audio';
|
||||
});
|
||||
|
||||
var hasVideoStreams = data.streams.some(function(stream) {
|
||||
return stream.codec_type === 'video';
|
||||
});
|
||||
|
||||
// Setup concat filter and start processing
|
||||
self.output(target, options)
|
||||
.complexFilter({
|
||||
filter: 'concat',
|
||||
options: {
|
||||
n: self._inputs.length,
|
||||
v: hasVideoStreams ? 1 : 0,
|
||||
a: hasAudioStreams ? 1 : 0
|
||||
}
|
||||
})
|
||||
.run();
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun May 01 2016 12:10:37 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
25
node_modules/fluent-ffmpeg/doc/scripts/linenumber.js
generated
vendored
Normal file
25
node_modules/fluent-ffmpeg/doc/scripts/linenumber.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/*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';
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
||||
202
node_modules/fluent-ffmpeg/doc/scripts/prettify/Apache-License-2.0.txt
generated
vendored
Normal file
202
node_modules/fluent-ffmpeg/doc/scripts/prettify/Apache-License-2.0.txt
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
|
||||
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.
|
||||
2
node_modules/fluent-ffmpeg/doc/scripts/prettify/lang-css.js
generated
vendored
Normal file
2
node_modules/fluent-ffmpeg/doc/scripts/prettify/lang-css.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
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"]);
|
||||
28
node_modules/fluent-ffmpeg/doc/scripts/prettify/prettify.js
generated
vendored
Normal file
28
node_modules/fluent-ffmpeg/doc/scripts/prettify/prettify.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
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;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(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;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c<
|
||||
f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[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<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&&
|
||||
(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=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<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r=
|
||||
{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length,
|
||||
t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===
|
||||
"string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=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<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=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<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value",
|
||||
m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=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*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m=
|
||||
a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue=
|
||||
j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=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",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\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<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf("prettyprint")>=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<h.length?setTimeout(m,
|
||||
250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",
|
||||
PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();
|
||||
348
node_modules/fluent-ffmpeg/doc/styles/jsdoc-default.css
generated
vendored
Normal file
348
node_modules/fluent-ffmpeg/doc/styles/jsdoc-default.css
generated
vendored
Normal file
@@ -0,0 +1,348 @@
|
||||
html
|
||||
{
|
||||
overflow: auto;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
body
|
||||
{
|
||||
font: 14px "DejaVu Sans Condensed", "Liberation Sans", "Nimbus Sans L", Tahoma, Geneva, "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
line-height: 130%;
|
||||
color: #000;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #444;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: #444;
|
||||
}
|
||||
|
||||
a:active {
|
||||
color: #444;
|
||||
}
|
||||
|
||||
header
|
||||
{
|
||||
display: block;
|
||||
padding: 6px 4px;
|
||||
}
|
||||
|
||||
.class-description {
|
||||
font-style: italic;
|
||||
font-family: Palatino, 'Palatino Linotype', serif;
|
||||
font-size: 130%;
|
||||
line-height: 140%;
|
||||
margin-bottom: 1em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
#main {
|
||||
float: left;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
section
|
||||
{
|
||||
display: block;
|
||||
|
||||
background-color: #fff;
|
||||
padding: 12px 24px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
margin-right: 240px;
|
||||
}
|
||||
|
||||
.variation {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.optional:after {
|
||||
content: "opt";
|
||||
font-size: 60%;
|
||||
color: #aaa;
|
||||
font-style: italic;
|
||||
font-weight: lighter;
|
||||
}
|
||||
|
||||
nav
|
||||
{
|
||||
display: block;
|
||||
width: 220px;
|
||||
border-left: 1px solid #ccc;
|
||||
padding-left: 9px;
|
||||
|
||||
position: fixed;
|
||||
top: 28px;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
nav ul {
|
||||
font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif;
|
||||
font-size: 100%;
|
||||
line-height: 17px;
|
||||
padding:0;
|
||||
margin:0;
|
||||
list-style-type:none;
|
||||
}
|
||||
|
||||
nav ul ul {
|
||||
margin-left: 10px;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
nav h2 a, nav h2 a:visited {
|
||||
color: #526492;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
nav h3 {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
nav li {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
nav a {
|
||||
color: #5C5954;
|
||||
}
|
||||
|
||||
nav a:visited {
|
||||
color: #5C5954;
|
||||
}
|
||||
|
||||
nav a:active {
|
||||
color: #5C5954;
|
||||
}
|
||||
|
||||
footer {
|
||||
display: block;
|
||||
padding: 6px;
|
||||
margin-top: 12px;
|
||||
font-style: italic;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
h1
|
||||
{
|
||||
font-size: 200%;
|
||||
font-weight: bold;
|
||||
letter-spacing: -0.01em;
|
||||
margin: 6px 0 9px 0;
|
||||
}
|
||||
|
||||
h2
|
||||
{
|
||||
font-size: 170%;
|
||||
font-weight: bold;
|
||||
letter-spacing: -0.01em;
|
||||
margin: 50px 0 3px 0;
|
||||
}
|
||||
|
||||
nav > 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;
|
||||
}
|
||||
111
node_modules/fluent-ffmpeg/doc/styles/prettify-jsdoc.css
generated
vendored
Normal file
111
node_modules/fluent-ffmpeg/doc/styles/prettify-jsdoc.css
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
/* 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;
|
||||
}
|
||||
132
node_modules/fluent-ffmpeg/doc/styles/prettify-tomorrow.css
generated
vendored
Normal file
132
node_modules/fluent-ffmpeg/doc/styles/prettify-tomorrow.css
generated
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
/* 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 {
|
||||
/* */ }
|
||||
505
node_modules/fluent-ffmpeg/doc/utils.js.html
generated
vendored
Normal file
505
node_modules/fluent-ffmpeg/doc/utils.js.html
generated
vendored
Normal file
@@ -0,0 +1,505 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: utils.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: utils.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*jshint node:true*/
|
||||
'use strict';
|
||||
|
||||
var exec = require('child_process').exec;
|
||||
var isWindows = require('os').platform().match(/win(32|64)/);
|
||||
var which = require('which');
|
||||
|
||||
var nlRegexp = /\r\n|\r|\n/g;
|
||||
var streamRegexp = /^\[?(.*?)\]?$/;
|
||||
var filterEscapeRegexp = /[,]/;
|
||||
var whichCache = {};
|
||||
|
||||
/**
|
||||
* Parse progress line from ffmpeg stderr
|
||||
*
|
||||
* @param {String} line progress line
|
||||
* @return progress object
|
||||
* @private
|
||||
*/
|
||||
function parseProgressLine(line) {
|
||||
var progress = {};
|
||||
|
||||
// Remove all spaces after = and trim
|
||||
line = line.replace(/=\s+/g, '=').trim();
|
||||
var progressParts = line.split(' ');
|
||||
|
||||
// Split every progress part by "=" to get key and value
|
||||
for(var i = 0; i < progressParts.length; i++) {
|
||||
var progressSplit = progressParts[i].split('=', 2);
|
||||
var key = progressSplit[0];
|
||||
var value = progressSplit[1];
|
||||
|
||||
// This is not a progress line
|
||||
if(typeof value === 'undefined')
|
||||
return null;
|
||||
|
||||
progress[key] = value;
|
||||
}
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
||||
|
||||
var utils = module.exports = {
|
||||
isWindows: isWindows,
|
||||
streamRegexp: streamRegexp,
|
||||
|
||||
|
||||
/**
|
||||
* Copy an object keys into another one
|
||||
*
|
||||
* @param {Object} source source object
|
||||
* @param {Object} dest destination object
|
||||
* @private
|
||||
*/
|
||||
copy: function(source, dest) {
|
||||
Object.keys(source).forEach(function(key) {
|
||||
dest[key] = source[key];
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Create an argument list
|
||||
*
|
||||
* Returns a function that adds new arguments to the list.
|
||||
* It also has the following methods:
|
||||
* - clear() empties the argument list
|
||||
* - get() returns the argument list
|
||||
* - find(arg, count) finds 'arg' in the list and return the following 'count' items, or undefined if not found
|
||||
* - remove(arg, count) remove 'arg' in the list as well as the following 'count' items
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
args: function() {
|
||||
var list = [];
|
||||
|
||||
// Append argument(s) to the list
|
||||
var argfunc = function() {
|
||||
if (arguments.length === 1 && Array.isArray(arguments[0])) {
|
||||
list = list.concat(arguments[0]);
|
||||
} else {
|
||||
list = list.concat([].slice.call(arguments));
|
||||
}
|
||||
};
|
||||
|
||||
// Clear argument list
|
||||
argfunc.clear = function() {
|
||||
list = [];
|
||||
};
|
||||
|
||||
// Return argument list
|
||||
argfunc.get = function() {
|
||||
return list;
|
||||
};
|
||||
|
||||
// Find argument 'arg' in list, and if found, return an array of the 'count' items that follow it
|
||||
argfunc.find = function(arg, count) {
|
||||
var index = list.indexOf(arg);
|
||||
if (index !== -1) {
|
||||
return list.slice(index + 1, index + 1 + (count || 0));
|
||||
}
|
||||
};
|
||||
|
||||
// Find argument 'arg' in list, and if found, remove it as well as the 'count' items that follow it
|
||||
argfunc.remove = function(arg, count) {
|
||||
var index = list.indexOf(arg);
|
||||
if (index !== -1) {
|
||||
list.splice(index, (count || 0) + 1);
|
||||
}
|
||||
};
|
||||
|
||||
// Clone argument list
|
||||
argfunc.clone = function() {
|
||||
var cloned = utils.args();
|
||||
cloned(list);
|
||||
return cloned;
|
||||
};
|
||||
|
||||
return argfunc;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Generate filter strings
|
||||
*
|
||||
* @param {String[]|Object[]} filters filter specifications. When using objects,
|
||||
* each must have the following properties:
|
||||
* @param {String} filters.filter filter name
|
||||
* @param {String|Array} [filters.inputs] (array of) input stream specifier(s) for the filter,
|
||||
* defaults to ffmpeg automatically choosing the first unused matching streams
|
||||
* @param {String|Array} [filters.outputs] (array of) output stream specifier(s) for the filter,
|
||||
* defaults to ffmpeg automatically assigning the output to the output file
|
||||
* @param {Object|String|Array} [filters.options] filter options, can be omitted to not set any options
|
||||
* @return String[]
|
||||
* @private
|
||||
*/
|
||||
makeFilterStrings: function(filters) {
|
||||
return filters.map(function(filterSpec) {
|
||||
if (typeof filterSpec === 'string') {
|
||||
return filterSpec;
|
||||
}
|
||||
|
||||
var filterString = '';
|
||||
|
||||
// Filter string format is:
|
||||
// [input1][input2]...filter[output1][output2]...
|
||||
// The 'filter' part can optionaly have arguments:
|
||||
// filter=arg1:arg2:arg3
|
||||
// filter=arg1=v1:arg2=v2:arg3=v3
|
||||
|
||||
// Add inputs
|
||||
if (Array.isArray(filterSpec.inputs)) {
|
||||
filterString += filterSpec.inputs.map(function(streamSpec) {
|
||||
return streamSpec.replace(streamRegexp, '[$1]');
|
||||
}).join('');
|
||||
} else if (typeof filterSpec.inputs === 'string') {
|
||||
filterString += filterSpec.inputs.replace(streamRegexp, '[$1]');
|
||||
}
|
||||
|
||||
// Add filter
|
||||
filterString += filterSpec.filter;
|
||||
|
||||
// Add options
|
||||
if (filterSpec.options) {
|
||||
if (typeof filterSpec.options === 'string' || typeof filterSpec.options === 'number') {
|
||||
// Option string
|
||||
filterString += '=' + filterSpec.options;
|
||||
} else if (Array.isArray(filterSpec.options)) {
|
||||
// Option array (unnamed options)
|
||||
filterString += '=' + filterSpec.options.map(function(option) {
|
||||
if (typeof option === 'string' && option.match(filterEscapeRegexp)) {
|
||||
return '\'' + option + '\'';
|
||||
} else {
|
||||
return option;
|
||||
}
|
||||
}).join(':');
|
||||
} else if (Object.keys(filterSpec.options).length) {
|
||||
// Option object (named options)
|
||||
filterString += '=' + Object.keys(filterSpec.options).map(function(option) {
|
||||
var value = filterSpec.options[option];
|
||||
|
||||
if (typeof value === 'string' && value.match(filterEscapeRegexp)) {
|
||||
value = '\'' + value + '\'';
|
||||
}
|
||||
|
||||
return option + '=' + value;
|
||||
}).join(':');
|
||||
}
|
||||
}
|
||||
|
||||
// Add outputs
|
||||
if (Array.isArray(filterSpec.outputs)) {
|
||||
filterString += filterSpec.outputs.map(function(streamSpec) {
|
||||
return streamSpec.replace(streamRegexp, '[$1]');
|
||||
}).join('');
|
||||
} else if (typeof filterSpec.outputs === 'string') {
|
||||
filterString += filterSpec.outputs.replace(streamRegexp, '[$1]');
|
||||
}
|
||||
|
||||
return filterString;
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Search for an executable
|
||||
*
|
||||
* Uses 'which' or 'where' depending on platform
|
||||
*
|
||||
* @param {String} name executable name
|
||||
* @param {Function} callback callback with signature (err, path)
|
||||
* @private
|
||||
*/
|
||||
which: function(name, callback) {
|
||||
if (name in whichCache) {
|
||||
return callback(null, whichCache[name]);
|
||||
}
|
||||
|
||||
which(name, function(err, result){
|
||||
if (err) {
|
||||
// Treat errors as not found
|
||||
return callback(null, whichCache[name] = '');
|
||||
}
|
||||
callback(null, whichCache[name] = result);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Convert a [[hh:]mm:]ss[.xxx] timemark into seconds
|
||||
*
|
||||
* @param {String} timemark timemark string
|
||||
* @return Number
|
||||
* @private
|
||||
*/
|
||||
timemarkToSeconds: function(timemark) {
|
||||
if (typeof timemark === 'number') {
|
||||
return timemark;
|
||||
}
|
||||
|
||||
if (timemark.indexOf(':') === -1 && timemark.indexOf('.') >= 0) {
|
||||
return Number(timemark);
|
||||
}
|
||||
|
||||
var parts = timemark.split(':');
|
||||
|
||||
// add seconds
|
||||
var secs = Number(parts.pop());
|
||||
|
||||
if (parts.length) {
|
||||
// add minutes
|
||||
secs += Number(parts.pop()) * 60;
|
||||
}
|
||||
|
||||
if (parts.length) {
|
||||
// add hours
|
||||
secs += Number(parts.pop()) * 3600;
|
||||
}
|
||||
|
||||
return secs;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Extract codec data from ffmpeg stderr and emit 'codecData' event if appropriate
|
||||
* Call it with an initially empty codec object once with each line of stderr output until it returns true
|
||||
*
|
||||
* @param {FfmpegCommand} command event emitter
|
||||
* @param {String} stderrLine ffmpeg stderr output line
|
||||
* @param {Object} codecObject object used to accumulate codec data between calls
|
||||
* @return {Boolean} true if codec data is complete (and event was emitted), false otherwise
|
||||
* @private
|
||||
*/
|
||||
extractCodecData: function(command, stderrLine, codecsObject) {
|
||||
var inputPattern = /Input #[0-9]+, ([^ ]+),/;
|
||||
var durPattern = /Duration\: ([^,]+)/;
|
||||
var audioPattern = /Audio\: (.*)/;
|
||||
var videoPattern = /Video\: (.*)/;
|
||||
|
||||
if (!('inputStack' in codecsObject)) {
|
||||
codecsObject.inputStack = [];
|
||||
codecsObject.inputIndex = -1;
|
||||
codecsObject.inInput = false;
|
||||
}
|
||||
|
||||
var inputStack = codecsObject.inputStack;
|
||||
var inputIndex = codecsObject.inputIndex;
|
||||
var inInput = codecsObject.inInput;
|
||||
|
||||
var format, dur, audio, video;
|
||||
|
||||
if (format = stderrLine.match(inputPattern)) {
|
||||
inInput = codecsObject.inInput = true;
|
||||
inputIndex = codecsObject.inputIndex = codecsObject.inputIndex + 1;
|
||||
|
||||
inputStack[inputIndex] = { format: format[1], audio: '', video: '', duration: '' };
|
||||
} else if (inInput && (dur = stderrLine.match(durPattern))) {
|
||||
inputStack[inputIndex].duration = dur[1];
|
||||
} else if (inInput && (audio = stderrLine.match(audioPattern))) {
|
||||
audio = audio[1].split(', ');
|
||||
inputStack[inputIndex].audio = audio[0];
|
||||
inputStack[inputIndex].audio_details = audio;
|
||||
} else if (inInput && (video = stderrLine.match(videoPattern))) {
|
||||
video = video[1].split(', ');
|
||||
inputStack[inputIndex].video = video[0];
|
||||
inputStack[inputIndex].video_details = video;
|
||||
} else if (/Output #\d+/.test(stderrLine)) {
|
||||
inInput = codecsObject.inInput = false;
|
||||
} else if (/Stream mapping:|Press (\[q\]|ctrl-c) to stop/.test(stderrLine)) {
|
||||
command.emit.apply(command, ['codecData'].concat(inputStack));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Extract progress data from ffmpeg stderr and emit 'progress' event if appropriate
|
||||
*
|
||||
* @param {FfmpegCommand} command event emitter
|
||||
* @param {String} stderrLine ffmpeg stderr data
|
||||
* @param {Number} [duration=0] expected output duration in seconds
|
||||
* @private
|
||||
*/
|
||||
extractProgress: function(command, stderrLine, duration) {
|
||||
var progress = parseProgressLine(stderrLine);
|
||||
|
||||
if (progress) {
|
||||
// build progress report object
|
||||
var ret = {
|
||||
frames: parseInt(progress.frame, 10),
|
||||
currentFps: parseInt(progress.fps, 10),
|
||||
currentKbps: progress.bitrate ? parseFloat(progress.bitrate.replace('kbits/s', '')) : 0,
|
||||
targetSize: parseInt(progress.size, 10),
|
||||
timemark: progress.time
|
||||
};
|
||||
|
||||
// calculate percent progress using duration
|
||||
if (duration && duration > 0) {
|
||||
ret.percent = (utils.timemarkToSeconds(ret.timemark) / duration) * 100;
|
||||
}
|
||||
|
||||
command.emit('progress', ret);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Extract error message(s) from ffmpeg stderr
|
||||
*
|
||||
* @param {String} stderr ffmpeg stderr data
|
||||
* @return {String}
|
||||
* @private
|
||||
*/
|
||||
extractError: function(stderr) {
|
||||
// Only return the last stderr lines that don't start with a space or a square bracket
|
||||
return stderr.split(nlRegexp).reduce(function(messages, message) {
|
||||
if (message.charAt(0) === ' ' || message.charAt(0) === '[') {
|
||||
return [];
|
||||
} else {
|
||||
messages.push(message);
|
||||
return messages;
|
||||
}
|
||||
}, []).join('\n');
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Creates a line ring buffer object with the following methods:
|
||||
* - append(str) : appends a string or buffer
|
||||
* - get() : returns the whole string
|
||||
* - close() : prevents further append() calls and does a last call to callbacks
|
||||
* - callback(cb) : calls cb for each line (incl. those already in the ring)
|
||||
*
|
||||
* @param {Numebr} maxLines maximum number of lines to store (<= 0 for unlimited)
|
||||
*/
|
||||
linesRing: function(maxLines) {
|
||||
var cbs = [];
|
||||
var lines = [];
|
||||
var current = null;
|
||||
var closed = false
|
||||
var max = maxLines - 1;
|
||||
|
||||
function emit(line) {
|
||||
cbs.forEach(function(cb) { cb(line); });
|
||||
}
|
||||
|
||||
return {
|
||||
callback: function(cb) {
|
||||
lines.forEach(function(l) { cb(l); });
|
||||
cbs.push(cb);
|
||||
},
|
||||
|
||||
append: function(str) {
|
||||
if (closed) return;
|
||||
if (str instanceof Buffer) str = '' + str;
|
||||
if (!str || str.length === 0) return;
|
||||
|
||||
var newLines = str.split(nlRegexp);
|
||||
|
||||
if (newLines.length === 1) {
|
||||
if (current !== null) {
|
||||
current = current + newLines.shift();
|
||||
} else {
|
||||
current = newLines.shift();
|
||||
}
|
||||
} else {
|
||||
if (current !== null) {
|
||||
current = current + newLines.shift();
|
||||
emit(current);
|
||||
lines.push(current);
|
||||
}
|
||||
|
||||
current = newLines.pop();
|
||||
|
||||
newLines.forEach(function(l) {
|
||||
emit(l);
|
||||
lines.push(l);
|
||||
});
|
||||
|
||||
if (max > -1 && lines.length > max) {
|
||||
lines.splice(0, lines.length - max);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
get: function() {
|
||||
if (current !== null) {
|
||||
return lines.concat([current]).join('\n');
|
||||
} else {
|
||||
return lines.join('\n');
|
||||
}
|
||||
},
|
||||
|
||||
close: function() {
|
||||
if (closed) return;
|
||||
|
||||
if (current !== null) {
|
||||
emit(current);
|
||||
lines.push(current);
|
||||
|
||||
if (max > -1 && lines.length > max) {
|
||||
lines.shift();
|
||||
}
|
||||
|
||||
current = null;
|
||||
}
|
||||
|
||||
closed = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun May 01 2016 12:10:37 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
234
node_modules/fluent-ffmpeg/doc/video.js.html
generated
vendored
Normal file
234
node_modules/fluent-ffmpeg/doc/video.js.html
generated
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: options/video.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: options/video.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*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;
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
341
node_modules/fluent-ffmpeg/doc/videosize.js.html
generated
vendored
Normal file
341
node_modules/fluent-ffmpeg/doc/videosize.js.html
generated
vendored
Normal file
@@ -0,0 +1,341 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: options/videosize.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: options/videosize.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/*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;
|
||||
};
|
||||
};
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Tue Jul 08 2014 21:22:19 GMT+0200 (CEST)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user