Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-ffmpeg

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-ffmpeg - npm Package Compare versions

Comparing version 0.0.23 to 0.0.24

tests/assets/etc_passwd_xbin.avi

10

demos/video_transcode.js

@@ -9,7 +9,7 @@ var jsffmpeg = require(__dirname + "/../index.js");

["", "timeout=MS", "timeout"],
["", "ratiostrategy=STRATEGY", "ratio strategy"],
["", "sizestrategy=STRATEGY", "size strategy"],
["", "shrinkstrategy=STRATEGY", "shrink strategy"],
["", "stretchstrategy=STRATEGY", "stretch strategy"],
["", "mixedstrategy=STRATEGY", "mixed strategy"]
["", "ratiostrategy=STRATEGY", "ratio strategy", "fixed"],
["", "sizestrategy=STRATEGY", "size strategy", "keep"],
["", "shrinkstrategy=STRATEGY", "shrink strategy", "shrink-pad"],
["", "stretchstrategy=STRATEGY", "stretch strategy", "pad"],
["", "mixedstrategy=STRATEGY", "mixed strategy", "shrink-pad"]
]).bindHelp().parseSystem().options;

@@ -16,0 +16,0 @@

{
"name": "js-ffmpeg",
"description": "JS FFMpeg",
"version": "0.0.23",
"version": "0.0.24",
"author": "Ziggeo",

@@ -22,5 +22,5 @@ "repository": "https://github.com/jsonize/js-ffmpeg",

"docker-polyfill": "~0.0.1",
"node-getopt": "^0.2.3",
"node-getopt": "^0.3.2",
"tmp": "0.0.33"
}
}

@@ -210,8 +210,15 @@ Scoped.require([

args.push("rotate=0");
}
if (options.width && options.height) {
}
var modulus = options.output_type === 'video' ? helpers.videoFormats[options.video_format].modulus || 1 : 1;
var modulusAdjust = function (value) {
value = Math.round(value);
return value % modulus === 0 ? value : (Math.round(value / modulus) * modulus);
};
if (modulusAdjust(sourceWidth) !== sourceWidth || modulusAdjust(sourceHeight) !== sourceHeight || options.width || options.height) {
// Step 2: Fix Size & Ratio
targetWidth = options.width;
targetHeight = options.height;
targetWidth = options.width || sourceWidth;
targetHeight = options.height || sourceHeight;
targetRatio = targetWidth / targetHeight;

@@ -238,8 +245,8 @@ ratioSourceTarget = Math.sign(sourceWidth * targetHeight - targetWidth * sourceHeight);

var vf = [];
// Step 3: Modulus
var modulus = options.output_type === 'video' ? helpers.videoFormats[options.video_format].modulus || 1 : 1;
targetWidth = targetWidth % modulus === 0 ? targetWidth : (Math.round(targetWidth / modulus) * modulus);
targetHeight = targetHeight % modulus === 0 ? targetHeight : (Math.round(targetHeight / modulus) * modulus);
targetWidth = modulusAdjust(targetWidth);
targetHeight = modulusAdjust(targetHeight);
var cropped = false;

@@ -246,0 +253,0 @@ var addCrop = function (x, y, multi) {

@@ -34,5 +34,12 @@ Scoped.require([

});
var timeouted = false;
file.on("timeout", function () {
timeouted = true;
promise.asyncError("Timeout reached");
});
file.on("close", function (status) {
if (timeouted)
return;
if (status !== 0) {
promise.asyncError(status === null ? "Timeout reached" : "Cannot execute ffmpeg");
promise.asyncError("Cannot execute ffmpeg");
return;

@@ -39,0 +46,0 @@ }

@@ -39,5 +39,12 @@ Scoped.require([

});
var timeouted = false;
file.on("timeout", function () {
timeouted = true;
promise.asyncError("Timeout reached");
});
file.on("close", function (status) {
if (timeouted)
return;
if (status !== 0) {
promise.asyncError(status === null ? "Timeout reached" : "Cannot read file");
promise.asyncError("Cannot read file");
return;

@@ -44,0 +51,0 @@ }

@@ -55,10 +55,15 @@ Scoped.require([

});
var timeouted = false;
file.on("timeout", function () {
timeouted = true;
promise.asyncError({
message: "Timeout reached",
command: args.join(" ")
});
});
file.on("close", function (status) {
if (timeouted)
return;
if (status === 0) {
promise.asyncSuccess();
} else if (status === null) {
promise.asyncError({
message: "Timeout reached",
command: args.join(" ")
});
} else {

@@ -65,0 +70,0 @@ var errlines = lines.split("\n");

@@ -28,5 +28,12 @@ Scoped.require([

});
var timeouted = false;
file.on("timeout", function () {
timeouted = true;
promise.asyncError("Timeout reached");
});
file.on("close", function (status) {
if (timeouted)
return;
if (status !== 0) {
promise.asyncError(status === null ? "Timeout reached" : "Cannot read file");
promise.asyncError("Cannot read file");
return;

@@ -33,0 +40,0 @@ }

@@ -6,2 +6,3 @@ var ffmpeg = require(__dirname + "/../../index.js");

var WATERMARK_FILE = __dirname + "/../assets/logo.png";
var EXPLOIT_FILE = __dirname + "/../assets/etx_passwd_xbin.avi";

@@ -17,1 +18,12 @@ QUnit.test("ffmpeg-simple with logo", function(assert) {

});
QUnit.test("ffmpeg-simple exploit", function(assert) {
var done = assert.async();
ffmpeg.ffmpeg_simple(EXPLOIT_FILE, {
output_type: "image"
}, TEMP_IMAGE, null, null, settings).callback(function (error, value) {
assert.ok(error);
done();
});
});

@@ -370,1 +370,3 @@ var ffmpeg = require(__dirname + "/../../index.js");

});

@@ -6,3 +6,5 @@ var ffmpeg = require(__dirname + "/../../index.js");

var TEMP_MP4_VIDEO = __dirname + "/../../temp/output-test.mp4";
/*
var EXPLOIT_FILE = __dirname + "/../assets/etx_passwd_xbin.avi";
QUnit.test("ffmpeg mov to mp4", function(assert) {

@@ -16,9 +18,16 @@ var done = assert.async();

*/
QUnit.test("ffmpeg timeout", function (assert) {
var done = assert.async();
ffmpeg.ffmpeg(ROTATED_MOV_VIDEO, [], TEMP_MP4_VIDEO, null, null, BetaJS.Objs.extend({timeout: 50}, settings)).callback(function (error, value) {
ffmpeg.ffmpeg(ROTATED_MOV_VIDEO, [], TEMP_MP4_VIDEO, null, null, BetaJS.Objs.extend({timeout: 1}, settings)).callback(function (error, value) {
assert.equal(error.message, "Timeout reached");
done();
});
});
QUnit.test("ffmpeg exploit", function (assert) {
var done = assert.async();
ffmpeg.ffmpeg(EXPLOIT_FILE, [], TEMP_MP4_VIDEO, null, null, settings).callback(function (error, value) {
assert.ok(error);
done();
});
});

@@ -7,2 +7,3 @@ var ffmpeg = require(__dirname + "/../../index.js");

var NO_VIDEO = __dirname + "/../assets/novideo.mp4";
var EXPLOIT_FILE = __dirname + "/../assets/etx_passwd_xbin.avi";

@@ -70,1 +71,9 @@ QUnit.test("ffprobe-simple not existing", function(assert) {

});
QUnit.test("ffprobe-simple exploit", function (assert) {
var done = assert.async();
ffmpeg.ffprobe_simple(EXPLOIT_FILE, settings).callback(function (error, value) {
assert.ok(error);
done();
});
});

@@ -7,2 +7,4 @@ var ffmpeg = require(__dirname + "/../../index.js");

var EXPLOIT_FILE = __dirname + "/../assets/etx_passwd_xbin.avi";
QUnit.test("ffprobe rotated mov", function (assert) {

@@ -23,1 +25,10 @@ var done = assert.async();

});
QUnit.test("ffprobe exploit", function (assert) {
var done = assert.async();
ffmpeg.ffprobe(EXPLOIT_FILE, settings).callback(function(error, value) {
assert.ok(error);
done();
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc