Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function split(file, tmpFolder, ffmpegBinPath, ffprobeBinPath, cb) {
//maximum legth of clips in seconds. 5 minutes each.
var maxLength = 60 * 5;
//number of files
var total = 0;
//list of files
var files = [];
// set ffprobe bin
if(ffprobeBinPath) {
ffmpeg.setFfprobePath(ffprobeBinPath);
} else {
console.warn("ffprobe binary path not defined, so using system one. if available");
}
/**
* @function finishedSplit
* @description helper function used as callback to add info on trimmed clips to list of files.
* @param {string} - name of the audio clip
* @param {number} - clip time offset in seconds, in 5 min intervals
* @returns {callback} callback - return list of files
*/
var finishedSplit = function(filename, start) {
files.push({
name: filename,
offset: start
});
function readVideoMetadataForEDL(config){
var file = config.file;
var callback = config.callback;
var video = {};
if ( config.ffprobePath ) {
//setting ffprobe bin
ffmpeg.setFfprobePath( config.ffprobePath );
} else {
console.warn("ffprobe binary path not defined, so using system one. if available");
}
//running ffprobe
ffmpeg.ffprobe(file, function(err, metadata ) {
// metadata is an object that contains all of the metadata available for the media file. Attributes especially nested onece may or may not be present costently across media files. Hence the following multiple boolean checks before reading attributes.
//eg if format does not exist ad an attribtue then filename attribute will not be found under format.
//reading file name
if(metadata !== undefined && metadata.format !== undefined && metadata.format.filename !== undefined ){
video.filePathName = metadata.format.filename;
var filePathO = path.parse(video.filePathName);
video.fileName = filePathO.base;
} else {
video.filePathName = "NA";
'use strict';
const ora = require('ora');
const ffmpeg = require('fluent-ffmpeg');
const ffmpegBin = require('ffmpeg-static');
const ffprobeBin = require('ffprobe-static');
ffmpeg.setFfmpegPath(ffmpegBin.path);
ffmpeg.setFfprobePath(ffprobeBin.path);
const loadingText = 'Videó letöltése... ';
const loadingFailedText = 'Videó letöltése sikertelen!';
function download(url, file) {
return new Promise((resolve, reject) => {
let spinner = ora({color: 'blue'});
const procSpinner = ora({spinner: 'bouncingBar'});
try {
let videoLength;
ffmpeg(url)
.videoCodec('copy')
.audioCodec('copy')
.format('mp4')
/* .addOption([
//Required Node Modules
var os = require('os'),
path = require('path'),
fs = require('fs'),
glob = require('glob'),
ffmpeg = require('fluent-ffmpeg'),
argv = require('minimist')(process.argv.slice(2));
var batch_details_json = require(path.resolve(argv.details)),
ffmpeg_cmd = ffmpeg(),
concat_output = path.join(argv.outdir, argv.outname);
if (process.platform == 'win32') {
ffmpeg.setFfmpegPath(ffmpeg_win);
ffmpeg.setFfprobePath(ffprobe_win);
} else {
ffmpeg.setFfmpegPath(ffmpeg_osx);
ffmpeg.setFfprobePath(ffprobe_osx);
}
console.log("\n\nGathering scenes and sequencing for movie");
for (var i=0; i < batch_details_json.length; i++) {
var input_file = glob.sync(batch_details_json[i]["output_asset"] + ".*", { })[0];
console.log("\n\tscene " + (i + 1));
console.log("\t" + input_file);
ffmpeg_cmd.input(path.resolve(input_file));
}
'use strict';
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
const ffprobePath = require('@ffprobe-installer/ffprobe').path;
const ffmpeg = require('fluent-ffmpeg');
ffmpeg.setFfmpegPath(ffmpegPath);
ffmpeg.setFfprobePath(ffprobePath);
const http = require('http');
function getParam(url, key) {
var param = new Object();
var item = new Array();
var urlList = url.split("?");
var req;
if (urlList.length == 1) {
req = urlList[0];
} else {
req = urlList[1];
}
var list = req.split('&');
for (var i = 0; i < list.length; i++) {
item = list[i].split('=');
param[item[0]] = item[1];
const video = require('@google-cloud/video-intelligence');
const client = new video.VideoIntelligenceServiceClient({
projectId: config.cloud_project_id,
keyfileName: './keyfile.json'
});
const ffmpeg = require('fluent-ffmpeg');
const path = require('path');
const binPath = path.resolve(__dirname, 'ffmpeg');
const ffmpegPath = path.resolve(binPath, 'ffmpeg');
const ffprobePath = path.resolve(binPath, 'ffprobe');
const rimraf = require('rimraf');
ffmpeg.setFfmpegPath(ffmpegPath);
ffmpeg.setFfprobePath(ffprobePath);
const thumbnailBucket = storage.bucket(config.thumbnail_bucket);
const videoBucket = storage.bucket(config.video_bucket);
function downloadFile(file, fileName) {
const destination = '/tmp/' + fileName;
console.log('downloading ' + file + 'to ' + destination);
return new Promise((resolve, reject) => {
file.download({
destination: destination
}).then((error) => {
if (error.length > 0) {
console.log('error downloading video file',error);
reject(error);
} else {
poster_time = (parseFloat(argv.poster) || 0 ),
poster_format = (argv.poster_format || 'png' ),
poster_quality = (String(argv.poster_quality) || '100' ),
poster_scale = (parseInt(argv.poster_scale) || null ),
gif_start = (argv.gif_start || 0 ),
gif_duration = (argv.gif_duration || 3 ),
gif_fps = (argv.gif_fps || 30 ),
gif_scale = (argv.gif_scale || 480 );
if (process.platform == 'win32') {
ffmpeg.setFfmpegPath(ffmpeg_win);
ffmpeg.setFfprobePath(ffprobe_win);
} else {
ffmpeg.setFfmpegPath(ffmpeg_osx);
ffmpeg.setFfprobePath(ffprobe_osx);
}
const { createLogger, format, transports } = require('winston');
const log = winston.createLogger({
format : format.combine(
format.splat(),
format.simple(),
format.printf(info => `${info.message}`)
),
transports : [
new winston.transports.Console(),
new winston.transports.File({ filename : `${__dirname}/transcode_out.log`, level : 'info' }),
new winston.transports.File({ filename : `${__dirname}/transcode_err.log`, level : 'error' })
]
public static get() {
const ffmpeg = require('fluent-ffmpeg');
try {
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
ffmpeg.setFfmpegPath(ffmpegPath);
const ffprobePath = require('@ffprobe-installer/ffprobe').path;
ffmpeg.setFfprobePath(ffprobePath);
} catch (e) {
}
return ffmpeg;
}
}
dimensions = (argv.dimensions || undefined ),
skip_preview = ((argv.skip_preview ? JSON.parse(argv.skip_preview) : null) || false ),
poster_time = (parseFloat(argv.poster) || 0 ),
poster_format = (argv.poster_format || 'png' ),
poster_quality = (String(argv.poster_quality) || '100' ),
poster_scale = (parseInt(argv.poster_scale) || null ),
gif_start = (argv.gif_start || 0 ),
gif_duration = (argv.gif_duration || 3 ),
gif_fps = (argv.gif_fps || 30 ),
gif_scale = (argv.gif_scale || 480 );
if (process.platform == 'win32') {
ffmpeg.setFfmpegPath(ffmpeg_win);
ffmpeg.setFfprobePath(ffprobe_win);
} else {
ffmpeg.setFfmpegPath(ffmpeg_osx);
ffmpeg.setFfprobePath(ffprobe_osx);
}
const { createLogger, format, transports } = require('winston');
const log = winston.createLogger({
format : format.combine(
format.splat(),
format.simple(),
format.printf(info => `${info.message}`)
),
transports : [
new winston.transports.Console(),