Capturing Video to Disk
Audio capture is nice, but if you bought this book because the sticky-note on the cover lists “capture” as one of the topics to be covered, you probably figured it meant video capture. Is there an iSight on the top of your monitor that wants some attention? OK, here’s how to turn it on and grab some video.
How do I do that?
As with audio capture, the basics of setting up capture are:
Create and configure (with
setUsage( )and the
settingsDialog( )) the channels you’re interested in—in this case, an
SequenceGrabber.setOutput( )to indicate the file to capture to.
SequenceGrabber.startRecord( )to begin grabbing to disk.
Finish up with
There is, however, a big difference with video.
With no on-screen preview component available in QTJ 6.1, you must
indicate where the
SequenceGrabber can draw to.
The workaround is to create an off-screen
QDGraphics and hand it to the
SequenceGrabber via the
setGWorld( ) call.
VideoCaptureToDisk program, presented in Example 6-2, offers a bare-bones video capture to a file
Run this example with ant run-ch06-videocapturetodisk
Example 6-2. Recording captured video to disk
package com.oreilly.qtjnotebook.ch06; import quicktime.*; import quicktime.io.*; import quicktime.std.*; import quicktime.std.sg.*; import quicktime.std.movies.*; import quicktime.std.image.*; import quicktime.qd.*; import quicktime.sound.*; import java.awt.*; import ...