comparison src/com/aurellem/capture/video/XuggleVideoRecorder.java @ 9:5dfc9e768816

moved files
author Robert McIntyre <rlm@mit.edu>
date Wed, 26 Oct 2011 08:54:12 -0700
parents
children 4c5fc53778c1
comparison
equal deleted inserted replaced
8:dde12be02029 9:5dfc9e768816
1 package com.aurellem.capture.video;
2
3
4 /**
5 * Handles writing video files using Xuggle.
6 *
7 *
8 * @author Robert McIntyre
9 *
10 */
11 /*
12 public class XuggleVideoRecorder extends AbstractVideoRecorder{
13
14
15 IMediaWriter writer;
16 BufferedImage frame;
17 int videoChannel = 0;
18 long currentTimeStamp = 0;
19 boolean videoReady = false;
20
21
22 public XuggleVideoRecorder(File output) throws IOException {super(output);}
23
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 }
34
35
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);
43
44 currentTimeStamp += (long) (1000000000.0 / fps);
45 }
46
47 public void finish() {
48 writer.close();
49 }
50
51 }
52
53 */