rlm@9: package com.aurellem.capture.video; rlm@9: rlm@9: import java.awt.image.BufferedImage; rlm@9: import java.io.File; rlm@9: import java.io.IOException; rlm@9: rlm@10: import ca.randelshofer.AVIOutputStream; rlm@10: rlm@9: rlm@9: public class AVIVideoRecorder extends AbstractVideoRecorder{ rlm@9: rlm@39: AVIOutputStream out = null; rlm@39: boolean videoReady = false; rlm@39: BufferedImage frame; rlm@9: rlm@39: public AVIVideoRecorder(File output) throws IOException { rlm@39: super(output); rlm@39: this.out = new rlm@39: AVIOutputStream(output, AVIOutputStream.VideoFormat.RAW, 24); rlm@39: this.out.setFrameRate(60); rlm@39: } rlm@9: rlm@39: public void initVideo (){ rlm@39: frame = new BufferedImage( rlm@39: width, height, rlm@39: BufferedImage.TYPE_INT_RGB); rlm@39: out.setFrameRate((int) Math.round(this.fps)); rlm@39: out.setTimeScale(1); rlm@39: out.setVideoDimension(width, height); rlm@39: this.videoReady = true; rlm@39: } rlm@9: rlm@39: public void record(BufferedImage rawFrame) { rlm@39: if (!videoReady){initVideo();} rlm@39: this.frame.getGraphics().drawImage(rawFrame, 0, 0, null); rlm@39: try {out.writeFrame(frame);} rlm@39: catch (IOException e){e.printStackTrace();} rlm@39: } rlm@9: rlm@39: public void finish() { rlm@39: try {out.close();} rlm@39: catch (IOException e) {e.printStackTrace();} rlm@39: } rlm@9: rlm@9: rlm@9: rlm@9: }