Search processing.org:

## Video

The video library allows Processing to display QuickTime video files, grab video data from a camera, and make QuickTime videos directly from a running program. Video can be captured from USB Cameras, IEEE 1394 (Firewire) Cameras, or Video Cards with composite or S-video input devices connected to the computer. Video can be loaded from QuickTime files located on your computer or anywhere on the Internet.

For this library to work, it is necessary to have QuickTime installed on your computer. Download and install QuickTime (or iTunes, which includes QuickTime).

Other solutions such as QuickTime Alternative or QT Lite will not work and should be avoided.

Because Apple only supports QuickTime on Mac OS and Windows, other platforms (such as Linux) are not able to use the video library.

You also need video driver software for translating from the proprietary format of your video source into commonly used video functions. You can get this software from the makers of the video hardware.

If you are using a Windows operating system, you will also need a video driver that translates from your hardware to the video functions used by QuickTime. This software may be included in the software provided by the maker of your hardware, or you can download the software. Search for "vdig" using an online search engine to find the software. There's more information about this below...

##### Capture Class

The Capture class makes it possible to grab frames of video from an attached capture device such as a camera. Adjustments to the size and speed are made through calling the functions defined below.
Capture
list()
format()
source()
settings()
read()
available()
frameRate()
crop()
noCrop()
stop()

##### Movie Class

The Movie class makes it possible to load QuickTime movies and to play them back in many ways including looping, pausing, and changing speed.
Movie
read()
available()
play()
pause()
stop()
loop()
noLoop()
jump()
duration()
time()
speed()
frameRate()

##### MovieMaker Class

The MovieMaker class makes QuickTime movies from a running program.
MovieMaker
addFrame()
finish()

##### Video Events

captureEvent()
movieEvent()

Problems with Video (Quicktime for Java)
Getting video to work can be kind of a cluster, particularly on Windows. We use QuickTime for Java, which can be flakey. Someday in the future perhaps we can circumvent this mess.
All Platforms

- The video library is only supported on Windows and Mac OS, because it relies on QuickTime for Java. There has been discussion of using other libraries (such as JMF) to bring support to Linux, search discourse for more information.
- An error that reads `quicktime.std.stdQTException(QTjava:6.1.3gl),-9405=couldntgetrequiredcomponent,qtversion:7108000 at quicktime.std.stdQTExceptionchekcerror` when trying to capture video probably means that 1) no camera is plugged in 2) the camera is not turned on or 3) on Windows, the VDIG for the camera (see below) is not installed.
- Video performance is not particularly great. The library is simply not built (and Java is not currently capable) of moving around 640x480 video on most machines, much less doing analysis on the video. The library was intended as a way to get pixels and manipulate them (either small pixel buffers interactively, or large ones for non real-time use). There are better tools for real-time, large screen analysis. It is my estimate that a 2x performance increase can probably be obtained by making better use of the QuickTime for Java library, but this still may not be enough to do analysis of 640x480 pixels at 30 frames per second, so it remains a lower priority. As always contributions are welcome, in case you're a video hacker who wants to help improve the library. (Bug 40)
- It's important to keep in mind that video capture and screen updates happen on separate threads. It's possible for captureEvent() to be called in the middle of draw(), which can cause trouble if manipulations are happening to the video image while it's also being drawn. This is particularly problematic on multiprocessor machines or older machines (or right before deadlines and graduate crits). There are two ways to handle it. First, you can read about how Java handles threads, and set up proper synchronization between the videoEvent and draw methods. The second solution is to use this rule of thumb: handle your heavy video computation inside captureEvent(), and then copy the pixels when they're ready into the image that you'll be drawing inside draw(). In other situations, when you're just drawing the video picture, use the available() method (instead of captureEvent).
- Projects that use video cannot (currently?) be exported to the web. (Bug 44) As of release 0116, video playback runs just fine from the web, but video capture requires a signed applet (for security reasons). See the applet applet troubleshooting section for information about signed applets.
- QuickTime movies are treated as nothing but pixel data in Processing. This means that none of the interaction features (fancy "click here to start movie" buttons or embedded Flash data) are supported, and that other features such as QTVR won't work either.
- You can find more discussion about video and problems that people have had over in the Video & Movies section of the discourse board. And if you find a bug, please use the bugs database.

Windows

- In order for camera input to work, you'll need to install a QuickTime-compatible video digitizer (VDIG). Unfortunately, most cameras on Windows don't support QuickTime right off the bat, but we've had some luck with WinVDIG. Unfortunately, WinVDIG 1.0.5 seems to be quite broken (either doesn't work at all, or video can't be resized), so you should stick with WinVDIG 1.0.1.
- Use the capture application included with the WinVDIG install to make sure that things are working properly (this helps us isolate WinVDIG vs. QuickTime for Java vs. Processing bugs).
- If you've already installed WinVDIG 1.0.5, do an uninstall, and be sure to say "Yes To All" (or the equivalent for your language) when it asks whether you want to de-install the DLLs.
- If you're completely stuck on the WinVDIG problems, an adaptation of the official instructions for uninstalling WinVDIG follows. First, try to uninstall WinVDIG from the Control Panel → Add/Remove Software. If this does not work, or you wish to manually uninstall WinVDIG, try the following steps:
  1. Remove VsVDIG.qtx (located in System32\QuickTime).
  2. Remove VsDump.ax (located in System32).
  3. Delete WinVDIG from the Program Files folder.
  4. Restart you system.
  It always makes us scared to go deleting things in System32, much less Program Files. But depending on your level of frustration, the possibility of hurting your Windows install may even sound enticing. Be sure to follow that line of instructions carefully. I spent half an hour trying to reinstall WinVDIG on a student's machine because I missed some of it.
- If you want to avoid QuickTime 7, use the QuickTime 6.5.2 installer that's buried on Apple's site. Uninstall QuickTime 7 before installing 6.5 (see below). You will also have to use a version of iTunes that's compatible with QuickTime 6 (anything earlier than iTunes 6). QuickTime 6 is no longer recommended, use QuickTime 7 instead.
- If you're installing QuickTime 6.5, you must make sure that "QuickTime for Java" is included. During the installation, use the "Custom" install, scroll down, and make sure the checkbox next to "QuickTime for Java" is marked. You will also need to follow this process if you have already installed QuickTime 6, and did not use the "Custom" or "Full" install. To remedy this, use the QuickTime Updater from the QuickTime folder that's added to the Start menu.
- In QuickTime 7 (or the iTunes + QuickTime installer) there is no "Custom" install, and QuickTime for Java is installed by default.
- If you're still having trouble, sometimes a full uninstall/reinstall of Quicktime will do the trick. This may take a good bit of work. First try using Add/Remove Programs to uninstall. At some point you might get an "Error 1714" saying that "The older version of QuickTime cannot be removed." The solution from Apple is to delete C:\WINDOWS\TEMP, and then clean remnants of QuickTime from the registry as outlined in this Microsoft Support document. More discussion of installer-related issues can be seen at Bug 171.
- Video sometimes likes to crash the application completely on Windows. This seems to be due to problems with QuickTime for Java (since we shouldn't be able to write code that crashes using Java.. heh right), so these situations are probably outside of our control.
- pause() and frameRate() aren't working with the video library. (Bug 370)

Mac OS X

- If you're having problems since the QuickTime 7 update, one option is to reinstall QuickTime 6. Apple has provided a QuickTime 6.5.2 reinstallers for QuickTime 7.0.1 and QuickTime 7.0 that you can use to return to your previous configuration. If you're using QuickTime 7.0.3 or 7.0.4, you'll have to first downgrade to 7.0.1, using the QuickTime 7.0.1 reinstaller for QuickTime 7.0.3 or QuickTime 7.0.4. QuickTime 6 is no longer supported, please use QuickTime 7 instead.
- On Mac OS X 10.2 (Jaguar, or Jagwyre if you like black turtlenecks), QuickTime for Java was missing from the initial release of QuickTime 6.4. An upgrade to QuickTime 6.4 that includes QuickTime for Java is available from software update. We don't recommend using 10.2 (we don't have time to support it), so if you can move to Panther or later, it's highly recommended. Mac OS X 10.2 is not supported, please use 10.3.9 or later.
- If you get the following error: `Exception in thread "main" java.lang.NoClassDefFoundError: com/apple/mrj/macos/carbon/CarbonLock` then it means you need to update and/or reinstall QuickTime. There was some monkey business about QuickTime for Java updates being out of sync with the Apple's Java updates, and this is one of the leftovers of that scenario. Blame Apple. Blame Canada.