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

@brainsights/media-tools

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brainsights/media-tools - npm Package Compare versions

Comparing version 3.4.2 to 3.4.3

26

media-track.js

@@ -6,2 +6,3 @@ const _ = require("lodash");

const Task = require("@brainsights/promise-task");
const debug = require("debug")("media-tools:media-track");
const __ = new WeakMap();

@@ -176,3 +177,3 @@

pass1.on("start", (command) => {
// console.log(`video pass 1: ${command}`);
debug(`video pass 1: ${command}`);
});

@@ -213,3 +214,3 @@ pass1.saveToFile("/dev/null");

pass2.on("start", (command) => {
// console.log(`video pass 2: ${command}`);
debug(`video pass 2: ${command}`);
});

@@ -240,5 +241,5 @@ pass2.saveToFile(outputFile);

let ffmpeg = new Ffmpeg({ source: __.get(this).media.path })
let ffmpeg = new Ffmpeg({ source: __.get(this).media.path })
.addOptions([
`-map 0:${info.index}`,
`-map 0:${info.index ? info.index : "a"}`,
]);

@@ -276,3 +277,3 @@

pass1.on("start", (command) => {
// console.log(`audio pass 1: ${command}`);
debug(`audio pass 1: ${command}`);
});

@@ -310,3 +311,3 @@ pass1.saveToFile("/dev/null");

pass2.on("start", (command) => {
// console.log(`audio pass 2: ${command}`);
debug(`audio pass 2: ${command}`);
});

@@ -335,7 +336,9 @@ pass2.saveToFile(outputFile);

let info = __.get(this).info;
console.log(info);
let tasks = [];
return new Task(async (context) => {
tasks.push(new Task(async (context) => {
let ffmpeg = new Ffmpeg({ source: __.get(this).media.path })
.addOptions([
`-map 0:${info.index}`,
`-map 0:${info.index ? info.index : "v"}`,
])

@@ -347,2 +350,5 @@ .videoCodec(profile.image.codec);

});
ffmpeg.on("start", (command) => {
debug(`image: ${command}`);
});
ffmpeg.on("end", () => {

@@ -353,3 +359,5 @@ context.progress(100);

ffmpeg.saveToFile(outputFile);
});
}));
return Task.series(tasks);
}

@@ -356,0 +364,0 @@ }

@@ -133,3 +133,3 @@ const path = require("path");

} else if(this.isImage()) {
let imageTrack = this.tracks.defaultImage();
let imageTrack = this.tracks.defaultImage();
let imageOutputFile = `${tempy.file({ extension: profile.image.fileExtension })}`;

@@ -136,0 +136,0 @@ tasks.push(imageTrack.transcode(profile, imageOutputFile));

{
"name": "@brainsights/media-tools",
"version": "3.4.2",
"version": "3.4.3",
"description": "Tools for reading metadata and transcoding media files.",

@@ -5,0 +5,0 @@ "main": "index.js",

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

process.env.FFMPEG_BIN_PATH = "/home/ack/Applications/ffmpeg-git-20180725-64bit-static/ffmpeg";
process.env.FFMPEG_BIN_PATH = "/home/ack/software/ffmpeg-git-20180725-64bit-static/ffmpeg";
const _ = require("lodash");

@@ -26,7 +26,9 @@ const ProgressBar = require("progress");

// { dir: "image", in: "720x1280.png", out: "720x1280.png", },
{ dir: "image", in: "SampleJPGImage_50kbmb.jpg", out: "SampleJPGImage_50kbmb.png", },
// { dir: "audio", in: "3s.mp3", out: "3s.weba", },
// { dir: "audio", in: "April_4_-_David_Shipley.mp3", out: "April_4_-_David_Shipley.weba", },
// { dir: "audio", in: "28m59s.wav", out: "28m59s.weba" },
// { dir: "video+audio", in: "560x320-6s.mp4", out: "560x320-6s.webm", },
// { dir: "video+audio", in: "3840x2160-23s.mkv", out: "3840x2160-23s.webm", },
{ dir: "video+audio", in: "1920x800-10s.mkv", out: "1920x800-10s.webm", },
// { dir: "video+audio", in: "1920x800-10s.mkv", out: "1920x800-10s.webm", },
// { dir: "video+audio", in: "1920x1080-2m23s.mkv", out: "1920x1080-2m23s.webm" },

@@ -41,9 +43,9 @@ // { dir: "video+audio", in: "broken.mkv", out: "broken.webm" }

// let bar = new ProgressBar(`[${__dirname}/in/${test.dir}/${test.in}] [:percent] [:elapseds]`, { total: 100 });
let bar = new ProgressBar(`[${__dirname}/in/${test.dir}/${test.in}] [:percent] [:elapseds]`, { total: 100 });
let mediaIn = await Media.load(`${__dirname}/in/${test.dir}/${test.in}`);
let job = mediaIn.transcode(profile, `${__dirname}/out/${test.dir}/${profile.NAME}-${test.out}`);
// job.on("progress", (progress) => {
// bar.update(progress/100);
// });
job.on("progress", (progress) => {
bar.update(progress/100);
});
let mediaOut;

@@ -50,0 +52,0 @@ try {

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