fluent-ffmpeg
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -209,3 +209,8 @@ /*jshint node:true*/ | ||
FfmpegCommand.availableEncoders = | ||
FfmpegCommand.getAvailableEncoders = function(callback) { | ||
(new FfmpegCommand()).availableEncoders(callback); | ||
}; | ||
/* Add ffprobe methods */ | ||
@@ -212,0 +217,0 @@ |
@@ -24,3 +24,8 @@ /*jshint node:true*/ | ||
function runFfprobe(command) { | ||
command.ffprobe(0, function(err, data) { | ||
const inputProbeIndex = 0; | ||
if (command._inputs[inputProbeIndex].isStream) { | ||
// Don't probe input streams as this will consume them | ||
return; | ||
} | ||
command.ffprobe(inputProbeIndex, function(err, data) { | ||
command._ffprobeData = data; | ||
@@ -75,3 +80,3 @@ }); | ||
* @event FfmpegCommand#error | ||
* @param {Error} error error object | ||
* @param {Error} error error object, with optional properties 'inputStreamError' / 'outputStreamError' for errors on their respective streams | ||
* @param {String|null} stdout ffmpeg stdout, unless outputting to a stream | ||
@@ -449,3 +454,5 @@ * @param {String|null} stderr ffmpeg stderr | ||
inputStream.source.on('error', function(err) { | ||
emitEnd(new Error('Input stream error: ' + err.message)); | ||
var reportingErr = new Error('Input stream error: ' + err.message); | ||
reportingErr.inputStreamError = err; | ||
emitEnd(reportingErr); | ||
ffmpegProc.kill(); | ||
@@ -480,3 +487,3 @@ }); | ||
outputStream.target.on('close', function() { | ||
self.logger.debug('Output stream closed, scheduling kill for ffmpgeg process'); | ||
self.logger.debug('Output stream closed, scheduling kill for ffmpeg process'); | ||
@@ -494,5 +501,7 @@ // Don't kill process yet, to give a chance to ffmpeg to | ||
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(); | ||
self.logger.debug('Output stream error, killing ffmpeg process'); | ||
var reportingErr = new Error('Output stream error: ' + err.message); | ||
reportingErr.outputStreamError = err; | ||
emitEnd(reportingErr, stdoutRing.get(), stderrRing.get()); | ||
ffmpegProc.kill('SIGKILL'); | ||
}); | ||
@@ -524,10 +533,4 @@ } | ||
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); | ||
utils.extractProgress(self, line); | ||
}); | ||
@@ -534,0 +537,0 @@ } |
@@ -324,6 +324,5 @@ /*jshint node:true*/ | ||
* @param {String} stderrLine ffmpeg stderr data | ||
* @param {Number} [duration=0] expected output duration in seconds | ||
* @private | ||
*/ | ||
extractProgress: function(command, stderrLine, duration) { | ||
extractProgress: function(command, stderrLine) { | ||
var progress = parseProgressLine(stderrLine); | ||
@@ -337,3 +336,3 @@ | ||
currentKbps: progress.bitrate ? parseFloat(progress.bitrate.replace('kbits/s', '')) : 0, | ||
targetSize: parseInt(progress.size, 10), | ||
targetSize: parseInt(progress.size || progress.Lsize, 10), | ||
timemark: progress.time | ||
@@ -343,6 +342,7 @@ }; | ||
// calculate percent progress using duration | ||
if (duration && duration > 0) { | ||
ret.percent = (utils.timemarkToSeconds(ret.timemark) / duration) * 100; | ||
if (command._ffprobeData && command._ffprobeData.format && command._ffprobeData.format.duration) { | ||
var duration = Number(command._ffprobeData.format.duration); | ||
if (!isNaN(duration)) | ||
ret.percent = (utils.timemarkToSeconds(ret.timemark) / duration) * 100; | ||
} | ||
command.emit('progress', ret); | ||
@@ -349,0 +349,0 @@ } |
{ | ||
"name": "fluent-ffmpeg", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "A fluent API to FFMPEG (http://www.ffmpeg.org)", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -5,17 +5,3 @@ # Fluent ffmpeg-API for node.js [![Build Status](https://secure.travis-ci.org/fluent-ffmpeg/node-fluent-ffmpeg.svg?branch=master)](http://travis-ci.org/fluent-ffmpeg/node-fluent-ffmpeg) | ||
> #### This is the documentation for fluent-ffmpeg 2.x | ||
> | ||
> A major 2.0 version has been released. This release features lots of API cleanup and a cleaner syntax for most methods. | ||
> | ||
> It has been designed to be mostly compatible with the previous fluent-ffmpeg version, but there are some incompatibilities, mainly because deprecated APIs in 1.x have been removed. See [the 2.x migration wiki page](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/wiki/Migrating-from-fluent-ffmpeg-1.x) for information on how to migrate. | ||
> | ||
> Please take care to update your package.json files if you want to keep using version 1.x: | ||
> ```js | ||
{ | ||
"dependencies": { | ||
"fluent-ffmpeg": "~1.7" | ||
} | ||
} | ||
``` | ||
> | ||
> This is the documentation for fluent-ffmpeg 2.x. | ||
> You can still access the code and documentation for fluent-ffmpeg 1.7 [here](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/tree/1.x). | ||
@@ -55,3 +41,3 @@ | ||
**Debian/Ubuntu users**: the official repositories have the ffmpeg/ffprobe executable in the `libav-tools` package, and they are actually rebranded avconv/avprobe executables (avconv is a fork of ffmpeg). They should be mostly compatible, but should you encounter any issue, you may want to use the real ffmpeg instead. You can either compile it from source or find a pre-built .deb package at https://ffmpeg.org/download.html (For Ubuntu, the `ppa:jon-severinsson/ffmpeg` PPA provides recent builds). | ||
**Debian/Ubuntu users**: the official repositories have the ffmpeg/ffprobe executable in the `libav-tools` package, and they are actually rebranded avconv/avprobe executables (avconv is a fork of ffmpeg). They should be mostly compatible, but should you encounter any issue, you may want to use the real ffmpeg instead. You can either compile it from source or find a pre-built .deb package at https://ffmpeg.org/download.html (For Ubuntu, the `ppa:mc3man/trusty-media` PPA provides recent builds). | ||
@@ -867,2 +853,4 @@ #### flvtool2 or flvmeta | ||
If streams are used for input or output, any errors emitted from these streams will be passed through to this event, attached to the `error` as `inputStreamError` and `outputStreamError` for input and output streams respectively. | ||
**Warning**: you should _always_ set a handler for the `error` event, as node's default behaviour when an `error` event without any listeners is emitted is to output the error to the console and _terminate the program_. | ||
@@ -869,0 +857,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
788609
81
5183
1487
4