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.18 to 0.0.19

tests/tests/ffmpeg-simple-image.js

2

package.json
{
"name": "js-ffmpeg",
"description": "JS FFMpeg",
"version": "0.0.18",
"version": "0.0.19",
"author": "Ziggeo",

@@ -6,0 +6,0 @@ "repository": "https://github.com/jsonize/js-ffmpeg",

@@ -1,2 +0,2 @@

# js-ffmpeg 0.0.17
# js-ffmpeg 0.0.19

@@ -3,0 +3,0 @@ This is a simple wrapper for FFMPEG and FFPROBE.

@@ -82,3 +82,5 @@ Scoped.require([

audioNormalizationInfo = infos.pop();
var isImage = infos.length === 1 && infos[0].image && !infos[0].video && !infos[0].audio;
var passes = 1;

@@ -137,6 +139,8 @@

var duration = helpers.computeDuration(infos[0].duration, options.time_start, options.time_end, options.time_limit);
if (options.output_type === 'image')
args.push(helpers.paramsImageExtraction(options.image_position, options.image_percentage, duration));
else if (options.time_start || options.time_end || options.time_limit)
args.push(helpers.paramsTimeDuration(options.time_start, options.time_end, options.time_limit));
if (!isImage) {
if (options.output_type === 'image')
args.push(helpers.paramsImageExtraction(options.image_position, options.image_percentage, duration));
else if (options.time_start || options.time_end || options.time_limit)
args.push(helpers.paramsTimeDuration(options.time_start, options.time_end, options.time_limit));
}

@@ -158,13 +162,14 @@

var source = infos[0];
var sourceInfo = source.video || source.image;
if (options.rotate) {
options.auto_rotate = true;
source.video.rotation = (source.video.rotation + options.rotate) % 360;
sourceInfo.rotation = (sourceInfo.rotation + options.rotate) % 360;
if (options.rotate % 180 === 90) {
var temp = source.video.rotated_width;
source.video.rotated_width = source.video.rotated_height;
source.video.rotated_height = temp;
var temp = sourceInfo.rotated_width;
sourceInfo.rotated_width = sourceInfo.rotated_height;
sourceInfo.rotated_height = temp;
}
}
sourceWidth = source.video.rotated_width;
sourceHeight = source.video.rotated_height;
sourceWidth = sourceInfo.rotated_width;
sourceHeight = sourceInfo.rotated_height;
var sourceRatio = sourceWidth / sourceHeight;

@@ -186,7 +191,7 @@ targetWidth = sourceWidth;

if (options.auto_rotate && source.video.rotation) {
if (source.video.rotation % 180 === 90) {
vfilters.push("transpose=" + (source.video.rotation === 90 ? 1 : 2));
if (options.auto_rotate && sourceInfo.rotation) {
if (sourceInfo.rotation % 180 === 90) {
vfilters.push("transpose=" + (sourceInfo.rotation === 90 ? 1 : 2));
}
if (source.video.rotation === 180) {
if (sourceInfo.rotation === 180) {
vfilters.push("hflip,vflip");

@@ -310,4 +315,5 @@ }

if (watermarkInfo) {
var scaleWidth = watermarkInfo.video.width;
var scaleHeight = watermarkInfo.video.height;
var watermarkMeta = watermarkInfo.image || watermarkInfo.video;
var scaleWidth = watermarkMeta.width;
var scaleHeight = watermarkMeta.height;
var maxWidth = targetWidth * options.watermark_size;

@@ -317,4 +323,4 @@ var maxHeight = targetHeight * options.watermark_size;

var watermarkRatio = maxWidth * scaleHeight >= maxHeight * scaleWidth;
scaleWidth = watermarkRatio ? watermarkInfo.video.width * maxHeight / watermarkInfo.video.height : maxWidth;
scaleHeight = !watermarkRatio ? watermarkInfo.video.height * maxWidth / watermarkInfo.video.width : maxHeight;
scaleWidth = watermarkRatio ? watermarkMeta.width * maxHeight / watermarkMeta.height : maxWidth;
scaleHeight = !watermarkRatio ? watermarkMeta.height * maxWidth / watermarkMeta.width : maxHeight;
}

@@ -342,4 +348,4 @@ var posX = options.watermark_x * (targetWidth - scaleWidth);

}
/*

@@ -402,3 +408,3 @@ *

//} catch(e) {console.log(e);}
//console.log(files, args, passes, output);

@@ -405,0 +411,0 @@ return ffmpeg_multi_pass.ffmpeg_multi_pass(files, args, passes, output, function (progress) {

@@ -45,3 +45,3 @@ Scoped.require([

};
if (json.format.format_name === "image" || json.format.format_name === "image2")
if (json.format.format_name === "image" || json.format.format_name === "image2" || stream.codec_name === 'png')
result.image = video;

@@ -48,0 +48,0 @@ else

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