Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow readMetadata = false as constructor option to fix issue #930 and #1191 #1192

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ The following options are available:
* `niceness` or `priority`: ffmpeg niceness value, between -20 and 20; ignored on Windows platforms (defaults to 0)
* `logger`: logger object with `debug()`, `info()`, `warn()` and `error()` methods (defaults to no logging)
* `stdoutLines`: maximum number of lines from ffmpeg stdout/stderr to keep in memory (defaults to 100, use 0 for unlimited storage)
* `readMetadata`: used to disable ffprobe (defaults to true, use false to disable ffprobe)


### Specifying inputs
Expand Down Expand Up @@ -1490,4 +1491,4 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Ffluent-ffmpeg%2Fnode-fluent-ffmpeg.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Ffluent-ffmpeg%2Fnode-fluent-ffmpeg?ref=badge_large)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Ffluent-ffmpeg%2Fnode-fluent-ffmpeg.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Ffluent-ffmpeg%2Fnode-fluent-ffmpeg?ref=badge_large)
1 change: 1 addition & 0 deletions lib/fluent-ffmpeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var ARGLISTS = ['_global', '_audio', '_audioFilters', '_video', '_videoFilters',
* @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 {Boolean} [options.readMetadata=true] disable ffprob on prepare
* @param {String|ReadableStream} [options.source=<no input>] alias for the `input` parameter
*/
function FfmpegCommand(input, options) {
Expand Down
9 changes: 5 additions & 4 deletions lib/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ module.exports = function(proto) {
* - `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)
* - 'readMetadata': disable ffProbe
*
* 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
Expand Down Expand Up @@ -284,7 +285,7 @@ module.exports = function(proto) {
*
* @method FfmpegCommand#_prepare
* @param {Function} callback callback with signature (err, args)
* @param {Boolean} [readMetadata=false] read metadata before processing
* @param {Boolean} [readMetadata=true] read metadata before processing
* @private
*/
proto._prepare = function(callback, readMetadata) {
Expand All @@ -298,7 +299,7 @@ module.exports = function(proto) {

// Read metadata if required
function(cb) {
if (!readMetadata) {
if (readMetadata === false) {
return cb();
}

Expand Down Expand Up @@ -363,7 +364,7 @@ module.exports = function(proto) {
}
], callback);

if (!readMetadata) {
if (readMetadata !== false) {
// Read metadata as soon as 'progress' listeners are added

if (this.listeners('progress').length > 0) {
Expand Down Expand Up @@ -588,7 +589,7 @@ module.exports = function(proto) {
}
}
);
});
}, self.options.readMetadata);

return this;
};
Expand Down