-
Notifications
You must be signed in to change notification settings - Fork 1
/
makeMp4.js
44 lines (40 loc) · 1.27 KB
/
makeMp4.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
33
34
35
36
37
38
39
40
41
42
43
44
'use strict';
const fs = require("fs");
const checker = require("./timestampChecker").checkFolders;
const spawn = require('child_process').spawn;
const filename = new Date().getTime().toString() + ".mp4"
const exec = require('child_process').exec;
function run() {
const cmd = spawn('bash', [ __dirname + '/ffmpegWrapper.sh', filename ]);
cmd.stdout.on('data', (data) => {
console.log(data.toString());
});
cmd.stderr.on('data', (data) => {
console.log(data.toString());
});
cmd.on('exit', (code) => {
console.log("Finished running command.");
console.log('Child process exited with code ' + code);
fs.stat(filename, (err, stat) => {
if(err == null) {
console.log('Success! ' + filename + ' Confirmed to exist');
// exec("rm -rf timestamped_video/*.jpg", (err, stdout, stderr) => {
// console.log("Removed jpgs in timestamped_video")
// });
checkResults();
} else {
console.log(filename + ' Does Not seem to exist!');
}
});
});
}
run();
let checkResults = () => {
console.log("The following number: ");
checker(__dirname+"/video");
console.log("Should equal");
checker(__dirname+"/timestamped_video");
// we need to executre these two commands
// node timestampChecker.js video
// node timestampChecker.js timestamped_video
}