зеркало из https://github.com/mozilla/eideticker.git
Bug 964814 - Cap framerate of generated video to 60fps even if camera is capturing at higher rate;r=mchang
This commit is contained in:
Родитель
ac67a6ee80
Коммит
5649425434
|
@ -76,6 +76,7 @@ def runtest(device_prefs, testname, options, apk=None, appname=None,
|
|||
|
||||
capture = videocapture.Capture(capture_file)
|
||||
capture_result['captureFPS'] = capture.fps
|
||||
capture_result['generatedVideoFPS'] = capture.generated_video_fps
|
||||
|
||||
if stableframecapture:
|
||||
capture_result['timetostableframe'] = \
|
||||
|
|
|
@ -16,7 +16,9 @@ $(function() {
|
|||
var actionCount = {};
|
||||
|
||||
var fps = getParameterByName('fps');
|
||||
if (!fps) fps = 60;
|
||||
var generatedVideoFPS = getParameterByName('generatedVideoFPS');
|
||||
if (!fps) fps = 60.0;
|
||||
if (!generatedVideoFPS) generatedVideoFPS = 60.0;
|
||||
|
||||
diffsums.forEach(function(diffsum) {
|
||||
// if we have a current action, check to make sure
|
||||
|
@ -101,10 +103,12 @@ $(function() {
|
|||
plot.unhighlight();
|
||||
plot.highlight(series, datum);
|
||||
currentTime = datum[0];
|
||||
var videoTime = currentTime * (fps/generatedVideoFPS);
|
||||
frameNum = parseInt(currentTime * fps);
|
||||
|
||||
var video = $("#frameview").get(0);
|
||||
video.currentTime = currentTime;
|
||||
console.log(videoTime);
|
||||
video.currentTime = videoTime;
|
||||
$("#datapoint").html(ich.graphDatapoint({ 'time': currentTime.toFixed(8),
|
||||
'frameNum': frameNum,
|
||||
'framediff': datum[1],
|
||||
|
@ -112,7 +116,7 @@ $(function() {
|
|||
var modal = $('#videoDetailModal');
|
||||
if (modal.length) {
|
||||
var largeVideo = $("#large-video").get(0);
|
||||
largeVideo.currentTime = currentTime;
|
||||
largeVideo.currentTime = videoTime;
|
||||
$(".modal-title").html("<h4>Frame " + frameNum + "</h4>");
|
||||
}
|
||||
updateButtons();
|
||||
|
|
|
@ -61,7 +61,7 @@ function updateGraph(rawdata, measure) {
|
|||
rawdata[appname].forEach(function(sample) {
|
||||
series.data.push([ barPosition, sample[measure] ]);
|
||||
|
||||
metadataHash[seriesIndex].push({'videoURL': sample.video, 'appDate': sample.appdate, 'revision': sample.revision, 'buildId': sample.buildid, 'frameDiff': sample.frameDiff, 'fps': sample.captureFPS });
|
||||
metadataHash[seriesIndex].push({'videoURL': sample.video, 'appDate': sample.appdate, 'revision': sample.revision, 'buildId': sample.buildid, 'frameDiff': sample.frameDiff, 'fps': sample.captureFPS, 'generatedVideoFPS': sample.generatedVideoFPS });
|
||||
barPosition++;
|
||||
});
|
||||
graphdata.push(series);
|
||||
|
@ -103,7 +103,8 @@ function updateGraph(rawdata, measure) {
|
|||
'buildId': metadata.buildId,
|
||||
'measureValue': Math.round(100.0*item.datapoint[1])/100.0,
|
||||
'frameDiff': metadata.frameDiff,
|
||||
'fps': metadata.fps
|
||||
'fps': metadata.fps,
|
||||
'generatedVideoFPS': metadata.generatedVideoFPS
|
||||
}));
|
||||
$('#video').css('width', $('#video').parent().width());
|
||||
$('#video').css('max-height', $('#graph-container').height());
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
<dd>{{measureValue}}</dd>
|
||||
</dl>
|
||||
{{#frameDiff}}
|
||||
<p><a href="framediff-view.html?title=Frame Difference&video={{videoURL}}&framediff={{frameDiff}}&fps={{fps}}" target="_blank">Frame difference view</a></p>
|
||||
<p><a href="framediff-view.html?title=Frame Difference&video={{videoURL}}&framediff={{frameDiff}}&fps={{fps}}&videoFPS={{videoFPS}}" target="_blank">Frame difference view</a></p>
|
||||
{{/frameDiff}}
|
||||
</div>
|
||||
</script>
|
||||
|
|
|
@ -56,6 +56,10 @@ class Capture(object):
|
|||
def fps(self):
|
||||
return self.metadata.get('fps', 60.0)
|
||||
|
||||
@property
|
||||
def generated_video_fps(self):
|
||||
return self.metadata.get('generatedVideoFPS', self.fps)
|
||||
|
||||
@property
|
||||
def length(self):
|
||||
return self.num_frames / self.fps
|
||||
|
|
|
@ -21,6 +21,7 @@ from zipfile import ZipFile
|
|||
|
||||
DECKLINK_DIR = os.path.join(os.path.dirname(__file__), 'decklink')
|
||||
POINTGREY_DIR = os.path.join(os.path.dirname(__file__), 'pointgrey')
|
||||
MAX_VIDEO_FPS = 60
|
||||
|
||||
valid_capture_devices = ["decklink", "pointgrey"]
|
||||
valid_decklink_modes = ["720p", "1080p"]
|
||||
|
@ -321,27 +322,30 @@ class CaptureController(object):
|
|||
capturefps = self.fps
|
||||
if not capturefps:
|
||||
capturefps = 60
|
||||
generated_video_fps = capturefps
|
||||
if generated_video_fps > MAX_VIDEO_FPS:
|
||||
generated_video_fps = MAX_VIDEO_FPS
|
||||
|
||||
if create_webm:
|
||||
self.log("Creating movie ...")
|
||||
|
||||
moviefile = tempfile.NamedTemporaryFile(dir=self.custom_tempdir,
|
||||
suffix=".webm")
|
||||
subprocess.Popen(('ffmpeg', '-y', '-r', str(capturefps), '-i',
|
||||
subprocess.Popen(('ffmpeg', '-y', '-r', str(generated_video_fps), '-i',
|
||||
os.path.join(rewritten_imagedir, '%d.png'),
|
||||
moviefile.name), close_fds=True).wait()
|
||||
|
||||
self.log("Writing final capture '%s'..." % self.output_filename)
|
||||
zipfile = ZipFile(self.output_filename, 'a')
|
||||
|
||||
zipfile.writestr(
|
||||
'metadata.json',
|
||||
json.dumps(dict({'captureDevice': self.capture_device,
|
||||
'date': self.capture_time.isoformat(),
|
||||
'frameDimensions': frame_dimensions,
|
||||
'fps': capturefps,
|
||||
'version': 1}, **self.capture_metadata)))
|
||||
|
||||
zipfile.writestr('metadata.json',
|
||||
json.dumps(dict({ 'captureDevice': self.capture_device,
|
||||
'date': self.capture_time.isoformat(),
|
||||
'frameDimensions': frame_dimensions,
|
||||
'fps': capturefps,
|
||||
'generatedVideoFPS': generated_video_fps,
|
||||
'version': 1 },
|
||||
**self.capture_metadata)))
|
||||
if create_webm:
|
||||
zipfile.writestr('movie.webm', moviefile.read())
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче