video-cropper
Advanced tools
Comparing version 1.0.0 to 1.0.1
64
index.js
@@ -1,6 +0,7 @@ | ||
const fs = require('fs'); | ||
const moment = require('moment'); | ||
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path | ||
const ffmpeg = require('fluent-ffmpeg'); | ||
ffmpeg.setFfmpegPath(ffmpegPath) | ||
#!/usr/bin/env node | ||
const fs = require("fs"); | ||
const moment = require("moment"); | ||
const ffmpegPath = require("@ffmpeg-installer/ffmpeg").path; | ||
const ffmpeg = require("fluent-ffmpeg"); | ||
ffmpeg.setFfmpegPath(ffmpegPath); | ||
@@ -14,33 +15,36 @@ const name = process.argv[2]; | ||
if(!fs.existsSync('cut.json')) { | ||
console.log('No config file found. Please provide a file named "cut.json" next to the video you want to cut') | ||
if (!fs.existsSync("cut.json")) { | ||
console.log( | ||
'No config file found. Please provide a file named "cut.json" next to the video you want to cut' | ||
); | ||
return; | ||
} | ||
fs.readFile('cut.json', (err, file) => { | ||
const cutConfig = JSON.parse(file); | ||
fs.readFile("cut.json", (err, file) => { | ||
const cutConfig = JSON.parse(file); | ||
cutConfig.forEach(element => { | ||
if(!element.start || !element.end || !element.name) { | ||
console.log('Wrong config file format. Please provide start, end & name'); | ||
return; | ||
} | ||
cutConfig.forEach((element) => { | ||
if (!element.start || !element.end || !element.name) { | ||
console.log("Wrong config file format. Please provide start, end & name"); | ||
return; | ||
} | ||
const start = moment(element.start, "HH:mm:ss"); | ||
const end = moment(element.end, "HH:mm:ss"); | ||
const duration = moment.duration(end.diff(start)); | ||
console.log(duration) | ||
const start = moment(element.start, "HH:mm:ss"); | ||
const end = moment(element.end, "HH:mm:ss"); | ||
const duration = moment.duration(end.diff(start)); | ||
ffmpeg(`${name}.mp4`) | ||
.setStartTime(element.start) | ||
.setDuration(duration.asSeconds()) | ||
.output(`${element.name}.mp4`) | ||
.on('end', function(err) { | ||
if(!err) { console.log('conversion Done') } | ||
}) | ||
.on('error', function(err){ | ||
console.log('error: ', err) | ||
}).run() | ||
}); | ||
ffmpeg(`${name}.mp4`) | ||
.setStartTime(element.start) | ||
.setDuration(duration.asSeconds()) | ||
.output(`${element.name}.mp4`) | ||
.on("end", function (err) { | ||
if (!err) { | ||
console.log("conversion Done"); | ||
} | ||
}) | ||
.on("error", function (err) { | ||
console.log("error: ", err); | ||
}) | ||
.run(); | ||
}); | ||
}); |
{ | ||
"name": "video-cropper", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 3 instances in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
53
1
21
0
2132
4