Mercurial > jmeCapture
view src/com/aurellem/capture/XuggleVideoRecorder.java @ 7:002b955a120a
removed PrintTimer
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 25 Oct 2011 12:09:15 -0700 |
parents | a92de00f0414 |
children |
line wrap: on
line source
1 package com.aurellem.capture;4 /**5 * Handles writing video files using Xuggle.6 *7 *8 * @author Robert McIntyre9 *10 */11 /*12 public class XuggleVideoRecorder extends AbstractVideoRecorder{15 IMediaWriter writer;16 BufferedImage frame;17 int videoChannel = 0;18 long currentTimeStamp = 0;19 boolean videoReady = false;22 public XuggleVideoRecorder(File output) throws IOException {super(output);}24 public void initVideo(){25 this.frame = new BufferedImage(26 width, height,27 BufferedImage.TYPE_3BYTE_BGR);28 this.writer = ToolFactory.makeWriter(this.targetFileName);29 writer.addVideoStream(videoChannel,30 0, IRational.make(fps),31 width, height);32 this.videoReady = true;33 }36 public void record(BufferedImage rawFrame) {37 if (!this.videoReady){initVideo();}38 // convert the Image into the form that Xuggle likes.39 this.frame.getGraphics().drawImage(rawFrame, 0, 0, null);40 writer.encodeVideo(videoChannel,41 frame,42 currentTimeStamp, TimeUnit.NANOSECONDS);44 currentTimeStamp += (long) (1000000000.0 / fps);45 }47 public void finish() {48 writer.close();49 }51 }53 */