capture-report library for creating a telecine method

The purpose of this module will be to generate a report of the
projector actions that can be translated into rendering instructions
for a telecine.

First tests will be done on a Blackmagic Pocket Cinema camera which
will record a 4000 frame sequence (100ft of 16mm). The report will
allow me to record the entire sequence of the projector advancing 4000
frames and will make a list of acceptable frames to pull out for
stitching together into a sequence. It is amazingly inefficient in
terms of disk space, but will make this setup much cheaper than one
that requires purchasing hardware to capture images to disk during
operation.

Rubber ducking: The report will watch for projector start and end times
in milliseconds, with a “start” value to be factored in later. On every
projector start and end event, when capture is active, an event with
the millisecond of the occurrence is logged to the report. At the end
of the sequence, the report will be parsed to determine the acceptable
frames to export into a new sequence. This will be determined by
finding a period between proj_end and proj_start events and dividing
that into frames and picking the central most frame.

Acceptable frames, marked by frame numbers, get put into an render list
that gets pegged to a first frame and adjusted via offset. The export
list will be fed into a command that will go through either a video
file or an image sequence and output the determined frames into an
image sequence that will be stitched together with ffmpeg/libav.
This commit is contained in:
Matt 2016-06-18 20:49:39 -04:00
parent 79d61c4878
commit c10252a9ee
1 changed files with 108 additions and 0 deletions

108
app/lib/capture-report.js Normal file
View File

@ -0,0 +1,108 @@
var capture = {},
fs = require('fs'),
exec = require('child_process').exec;
capture.active = false;
capture.store = {};
capture.start = function () {
'use strict';
capture.store.events = [];
capture.store.start = +new Date();
};
capture.proj_start = function () {
'use strict';
var e = {
'start' : +new Date()
};
capture.store.events.push(e);
};
capture.proj_end = function () {
'use strict';
var e = {
'end' : +new Date()
};
capture.store.events.push(e);
};
capture.report = {};
capture.report.parse = function (first, report, fps, type) {
'use strict';
var output = [],
frame,
last = null,
buffer;
if (typeof fps === 'undefined') {
fps = 24;
}
frame = 1000 / fps;
if (typeof report === 'undefined') {
report = capture.store;
} else {
report = JSON.parse(fs.readFileSync(report, 'utf8'));
}
if (typeof type === 'undefined') {
type = 'still';
}
if (typeof first === 'undefined') {
first = 0;
}
if (type === 'still') {
//first clean frame
for (i = 0; i < report.events.length; i++) {
if (typeof report.events[i].start !=== 'undefined') {
buffer = report.events[i].start;
if (last !== null) {
output.push();
}
} else {
buffer = report.events[i].end - buffer;
last = report.events[i].end;
}
}
} else if (type === 'video') {
}
return output;
};
capture.report.render = function () {
'use strict';
};
capture.test = function () {
'use strict';
var i = -1,
len = 10,
intval,
next = function () {
i++
if (i === len) {
clearInterval(intval);
intval = null;
console.dir(capture.store);
parse();
} else {
if (i % 2 === 0) {
capture.proj_start();
} else {
capture.proj_end();
}
}
},
parse = function () {
capture.report.parse();
};
capture.start();
intval = setInterval(next, 800);
};
capture.test();
//module.exports = capture;