Mercurial > jmeCapture
view src/com/aurellem/capture/video/FileVideoRecorder.java @ 71:2c50a0c99715
remove xuggle, since I will never use it.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 10 Mar 2014 18:54:35 -0400 |
parents | 784a3f4e6202 |
children |
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;6 import javax.imageio.ImageIO;8 public class FileVideoRecorder extends AbstractVideoRecorder{9 int current;10 File outDir;11 String formatName = "png";13 public FileVideoRecorder(File output) throws IOException {14 super(output);15 if (output.exists()16 && output.isDirectory()17 && (0 == output.listFiles().length)){18 // good19 }20 else if (!output.exists()){21 output.mkdir();22 }23 else {24 throw new IOException("argument must be either an empty " +25 "directory or a nonexistent one.");26 }27 this.outDir = output;28 }30 public void record(BufferedImage rawFrame) {31 String name = String.format("%07d.%s" , current++, formatName);32 File target = new File(output, name);33 try {ImageIO.write(rawFrame, formatName, target);}34 catch (IOException e) {e.printStackTrace();}35 }37 public void finish() {}38 }