Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
console.time('=====> test10.js');
const { Writable } = require('stream');
const assert = require('assert');
const Mp4Frag = require('../index');
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
const { spawn } = require('child_process');
const count = 1; //expected count of segments
const frames = 1;
const fps = 24; //number of frames per second(same as input video) might not be necessary
const scale = 640; //used as width of video, height will automatically scale
let counter = 0;
const params = [
/* log info to console */
'-loglevel',
'use strict';
console.time('=====> test6.js');
const assert = require('assert');
const Mp4Frag = require('../index');
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
const { spawn } = require('child_process');
const frameLimit = 2001;
const scale = 320;
const fps = 200;
const count = Math.ceil(frameLimit / fps);
let counter = 0;
const params = [
/* log info to console */
'-loglevel',
'createSample'(filePath) {
console.log(filePath)
var inputFile = filePath
var outputFile = filePath.split(".")
outputFile[outputFile.length - 2] = outputFile[outputFile.length - 2] + " - TdarrSample"
outputFile = outputFile.join(".")
outputFile = outputFile.split("/")
outputFile = homePath + "/Tdarr/Samples/" + outputFile[outputFile.length - 1]
var inputFileUnix = inputFile.replace(/'/g, '\'\"\'\"\'');
var outputFileUnix = outputFile.replace(/'/g, '\'\"\'\"\'');
var ffmpegPathUnix = ffmpegPath.replace(/'/g, '\'\"\'\"\'');
var preset1 = "-ss 00:00:1"
var preset2 = "-t 00:00:30 -map 0:v? -map 0:a? -map 0:s? -map 0:d? -c copy"
// var preset1 = "-ss 00:00:1"
// var preset2 = "-t 00:00:30 -c copy -map 0"
if (fs.existsSync(outputFile)) {
fs.unlinkSync(outputFile)
}
if (process.platform == 'win32') {
const electronUtil = require('electron-util')
const execa = require('execa')
const ffmpeg = require('@ffmpeg-installer/ffmpeg')
const fs = require('fs-extra')
const path = require('path')
const moment = require('moment')
const tmp = require('tmp')
const boardModel = require('../models/board')
const exporterCommon = require('../exporters/common')
const ffmpegPath = electronUtil.fixPathForAsarUnpack(ffmpeg.path)
// const durationRegex = /Duration: (\d\d:\d\d:\d\d.\d\d)/gm
// const frameRegex = /frame=\s+(\d+)/gm
// via https://github.com/sindresorhus/slash/blob/master/index.js
const slash = input => {
const isExtendedLengthPath = /^\\\\\?\\/.test(input)
const hasNonAscii = /[^\u0000-\u0080]+/.test(input)
if (isExtendedLengthPath || hasNonAscii) {
return input
}
return input.replace(/\\/g, '/')
}
const _ = require('lodash')
const utils = require('fluent-ffmpeg/lib/utils')
const debug = require('debug')('cypress:server:video')
const ffmpeg = require('fluent-ffmpeg')
const stream = require('stream')
const Promise = require('bluebird')
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path
const BlackHoleStream = require('black-hole-stream')
const fs = require('./util/fs')
// extra verbose logs for logging individual frames
const debugFrames = require('debug')('cypress-verbose:server:video:frames')
debug('using ffmpeg from %s', ffmpegPath)
ffmpeg.setFfmpegPath(ffmpegPath)
const deferredPromise = function () {
let reject
let resolve = (reject = null)
const promise = new Promise((_resolve, _reject) => {
resolve = _resolve
reject = _reject
'use strict';
console.time('=====> test4.js');
const assert = require('assert');
const Mp4Frag = require('../index');
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
const { spawn } = require('child_process');
const frameLimit = 200;
const gop = 10;
const count = Math.ceil(frameLimit / gop); //expected number of segments to be cut from ffmpeg
const scale = 320;
const fps = 10;
let counter = 0;
const params = [
'use strict';
console.time('=====> test2.js');
const assert = require('assert');
const Mp4Frag = require('../index');
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
const { spawn } = require('child_process');
const frameLimit = 200;
const gop = 5;
const count = Math.ceil(frameLimit / gop); //expected number of segments to be cut from ffmpeg
const scale = 640;
const fps = 10;
let counter = 0;
const params = [
'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];
}
'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);
var videoSupport = function (videoPath) {
let p = new Promise(function (resolve, reject) {
let command = ffmpeg()
.input(videoPath)
.ffprobe(function (err, data) {
if (err) {
reject(err);
return;
}
var streams = data.streams;
var checkResult = {
try {
browser.saveScreenshot(filePath);
helpers.debugLog('- Screenshot!!\n');
} catch (e) {
fs.writeFile(filePath, notAvailableImage, 'base64');
helpers.debugLog('- Screenshot not available...\n');
}
const videoPath = path.resolve(config.outputDir, this.testname + '.mp4');
this.videos.push(videoPath);
if (config.usingAllure) {
allureReporter.addAttachment('Execution video', videoPath, 'video/mp4');
}
const command = `"${ffmpeg.path}" -y -r 10 -i "${this.recordingPath}/%04d.png" -vcodec libx264` +
` -crf 32 -pix_fmt yuv420p -vf "scale=1200:trunc(ow/a/2)*2","setpts=${config.videoSlowdownMultiplier}.0*PTS"` +
` "${path.resolve(config.outputDir, this.testname)}.mp4"`;
helpers.debugLog(`ffmpeg command: ${command}\n`);
this.ffmpegCommands.push(command);
}
}