-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
32 lines (27 loc) · 855 Bytes
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const ffmpegStaticPath = require('ffmpeg-static');
const { spawnSync } = require('child_process');
const { existsSync } = require('fs');
const { tmpdir } = require('os');
const tmp = tmpdir();
const inputFile = `${__dirname}/test/fixtures/input.mp4`;
const outputFile = `${tmp}/output.mp4`;
const durationSec = 10.0;
const ffmpegPath = String(process.env.FFMPEG_PATH || ffmpegStaticPath);
function generateTestFile(filename, durationSec = 10.0) {
spawnSync(ffmpegPath, [
'-y',
'-f',
'lavfi',
'-i',
`testsrc=duration=${durationSec}:size=640x360:rate=30`,
filename
]);
}
if (!existsSync(inputFile)) {
generateTestFile(inputFile, durationSec);
}
exports.generateTestFile = generateTestFile;
exports.inputFile = inputFile;
exports.durationSec = durationSec;
exports.outputFile = outputFile;
exports.ffmpegPath = ffmpegPath;