Mercurial > jmeCapture
diff src/com/aurellem/capture/XuggleVideoRecorder.java @ 3:a92de00f0414
migrating files
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 25 Oct 2011 11:55:55 -0700 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/com/aurellem/capture/XuggleVideoRecorder.java Tue Oct 25 11:55:55 2011 -0700 1.3 @@ -0,0 +1,53 @@ 1.4 +package com.aurellem.capture; 1.5 + 1.6 + 1.7 +/** 1.8 + * Handles writing video files using Xuggle. 1.9 + * 1.10 + * 1.11 + * @author Robert McIntyre 1.12 + * 1.13 + */ 1.14 +/* 1.15 +public class XuggleVideoRecorder extends AbstractVideoRecorder{ 1.16 + 1.17 + 1.18 + IMediaWriter writer; 1.19 + BufferedImage frame; 1.20 + int videoChannel = 0; 1.21 + long currentTimeStamp = 0; 1.22 + boolean videoReady = false; 1.23 + 1.24 + 1.25 + public XuggleVideoRecorder(File output) throws IOException {super(output);} 1.26 + 1.27 + public void initVideo(){ 1.28 + this.frame = new BufferedImage( 1.29 + width, height, 1.30 + BufferedImage.TYPE_3BYTE_BGR); 1.31 + this.writer = ToolFactory.makeWriter(this.targetFileName); 1.32 + writer.addVideoStream(videoChannel, 1.33 + 0, IRational.make(fps), 1.34 + width, height); 1.35 + this.videoReady = true; 1.36 + } 1.37 + 1.38 + 1.39 + public void record(BufferedImage rawFrame) { 1.40 + if (!this.videoReady){initVideo();} 1.41 + // convert the Image into the form that Xuggle likes. 1.42 + this.frame.getGraphics().drawImage(rawFrame, 0, 0, null); 1.43 + writer.encodeVideo(videoChannel, 1.44 + frame, 1.45 + currentTimeStamp, TimeUnit.NANOSECONDS); 1.46 + 1.47 + currentTimeStamp += (long) (1000000000.0 / fps); 1.48 + } 1.49 + 1.50 + public void finish() { 1.51 + writer.close(); 1.52 + } 1.53 + 1.54 +} 1.55 + 1.56 +*/