public void finishAVI() throws Exception { logger.log(Level.INFO, "finishAVI"); byte[] indexlistBytes = indexlist.toBytes(); aviOutput.write(indexlistBytes); aviOutput.close(); int fileSize = (int)aviFile.length(); logger.log(Level.INFO, "fileSize: {0}", fileSize); int listSize = (int) (fileSize - 8 - aviMovieOffset - indexlistBytes.length); logger.log(Level.INFO, "listSize: {0}", listSize); logger.log(Level.INFO, "aviFile canWrite: {0}", aviFile.canWrite()); logger.log(Level.INFO, "aviFile AbsolutePath: {0}", aviFile.getAbsolutePath()); logger.log(Level.INFO, "aviFile numFrames: {0}", numFrames); RandomAccessFile raf = new RandomAccessFile(aviFile, "rw"); //add header and length by writing the headers again //with the now available information raf.write(new RIFFHeader(fileSize).toBytes()); raf.write(new AVIMainHeader().toBytes()); raf.write(new AVIStreamList().toBytes()); raf.write(new AVIStreamHeader().toBytes()); raf.write(new AVIStreamFormat().toBytes()); raf.write(new AVIJunk().toBytes()); raf.write(new AVIMovieList(listSize).toBytes()); raf.close(); }
public void finishAVI() throws Exception { byte[] indexlistBytes = indexlist.toBytes(); aviOutput.write(indexlistBytes); aviOutput.close(); int fileSize = (int)aviFile.length(); int listSize = (int) (fileSize - 8 - aviMovieOffset - indexlistBytes.length); RandomAccessFile raf = new RandomAccessFile(aviFile, "rw"); //add header and length by writing the headers again //with the now available information raf.write(new RIFFHeader(fileSize).toBytes()); raf.write(new AVIMainHeader().toBytes()); raf.write(new AVIStreamList().toBytes()); raf.write(new AVIStreamHeader().toBytes()); raf.write(new AVIStreamFormat().toBytes()); raf.write(new AVIJunk().toBytes()); raf.write(new AVIMovieList(listSize).toBytes()); raf.close(); }
public MjpegFileWriter(File aviFile, int width, int height, double framerate, int numFrames) throws Exception { this.aviFile = aviFile; this.width = width; this.height = height; this.framerate = framerate; this.numFrames = numFrames; aviOutput = new FileOutputStream(aviFile); aviChannel = aviOutput.getChannel(); RIFFHeader rh = new RIFFHeader(); aviOutput.write(rh.toBytes()); aviOutput.write(new AVIMainHeader().toBytes()); aviOutput.write(new AVIStreamList().toBytes()); aviOutput.write(new AVIStreamHeader().toBytes()); aviOutput.write(new AVIStreamFormat().toBytes()); aviOutput.write(new AVIJunk().toBytes()); aviMovieOffset = aviChannel.position(); aviOutput.write(new AVIMovieList().toBytes()); indexlist = new AVIIndexList(); }
public MjpegFileWriter(File aviFile, int width, int height, double framerate, int numFrames) throws Exception { this.aviFile = aviFile; this.width = width; this.height = height; this.framerate = framerate; this.numFrames = numFrames; aviOutput = new FileOutputStream(aviFile); aviChannel = aviOutput.getChannel(); RIFFHeader rh = new RIFFHeader(); aviOutput.write(rh.toBytes()); aviOutput.write(new AVIMainHeader().toBytes()); aviOutput.write(new AVIStreamList().toBytes()); aviOutput.write(new AVIStreamHeader().toBytes()); aviOutput.write(new AVIStreamFormat().toBytes()); aviOutput.write(new AVIJunk().toBytes()); aviMovieOffset = aviChannel.position(); aviOutput.write(new AVIMovieList().toBytes()); indexlist = new AVIIndexList(); }
public void finishAVI() throws Exception { byte[] indexlistBytes = indexlist.toBytes(); aviOutput.write(indexlistBytes); aviOutput.close(); int fileSize = (int)aviFile.length(); int listSize = (int) (fileSize - 8 - aviMovieOffset - indexlistBytes.length); RandomAccessFile raf = new RandomAccessFile(aviFile, "rw"); //add header and length by writing the headers again //with the now available information raf.write(new RIFFHeader(fileSize).toBytes()); raf.write(new AVIMainHeader().toBytes()); raf.write(new AVIStreamList().toBytes()); raf.write(new AVIStreamHeader().toBytes()); raf.write(new AVIStreamFormat().toBytes()); raf.write(new AVIJunk().toBytes()); raf.write(new AVIMovieList(listSize).toBytes()); raf.close(); }
public MjpegFileWriter(File aviFile, int width, int height, double framerate, int numFrames) throws Exception { this.aviFile = aviFile; this.width = width; this.height = height; this.framerate = framerate; this.numFrames = numFrames; aviOutput = new FileOutputStream(aviFile); aviChannel = aviOutput.getChannel(); RIFFHeader rh = new RIFFHeader(); aviOutput.write(rh.toBytes()); aviOutput.write(new AVIMainHeader().toBytes()); aviOutput.write(new AVIStreamList().toBytes()); aviOutput.write(new AVIStreamHeader().toBytes()); aviOutput.write(new AVIStreamFormat().toBytes()); aviOutput.write(new AVIJunk().toBytes()); aviMovieOffset = aviChannel.position(); aviOutput.write(new AVIMovieList().toBytes()); indexlist = new AVIIndexList(); }