Mercurial > jmeCapture
view src/com/aurellem/capture/video/AVIVideoRecorder.java @ 10:4c5fc53778c1
moved randelshofer stuff to rightfull place, enabled XuggleVideoRecorder
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 26 Oct 2011 09:38:27 -0700 |
parents | 5dfc9e768816 |
children | be5ac56826be |
line wrap: on
line source
1 package com.aurellem.capture.video;3 import java.awt.image.BufferedImage;4 import java.io.File;5 import java.io.IOException;7 import ca.randelshofer.AVIOutputStream;10 public class AVIVideoRecorder extends AbstractVideoRecorder{12 AVIOutputStream out = null;13 boolean videoReady = false;14 BufferedImage frame;16 public AVIVideoRecorder(File output) throws IOException {17 super(output);18 this.out = new AVIOutputStream(output, AVIOutputStream.VideoFormat.PNG, 24);19 this.out.setVideoCompressionQuality(1.0f);20 }23 public void initVideo (){24 frame = new BufferedImage(25 width, height,26 BufferedImage.TYPE_INT_RGB);27 out.setFrameRate((int) Math.round(this.fps));28 out.setTimeScale(1);29 out.setVideoDimension(width, height);30 this.videoReady = true;31 }33 public void record(BufferedImage rawFrame) {34 if (!videoReady){initVideo();}35 this.frame.getGraphics().drawImage(rawFrame, 0, 0, null);36 try {out.writeFrame(frame);}37 catch (IOException e){e.printStackTrace();}38 }40 public void finish() {41 System.out.println("I'm finished! <3");42 try {out.close();}43 catch (IOException e) {e.printStackTrace();}44 }48 }