O'Reilly logo

QuickTime for Java: A Developer's Notebook by Chris Adamson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating One-Source Effects (Filters)

Filtering a video track by applying an effect to it is a critically important tool for doing color correction, adding special effects like lens flare, or offering novelties such as converting the video to black and white or pseudo-antique sepia tone. The technique of creating the effect is effectively the same as with zero-source effects, although in this case you need to create an object that tells the effect where its video source comes from.

How do I do that?

You create a one-source effect just like you do the zero-source version—create a track, create video media, get an EffectsList (this time of one-source effects), and get an AtomContainer describing an effect from a ParameterDialog.

But before adding the AtomContainer as the effects media sample, you need to map it to a video source, which is another video track in the movie. You do this by creating an input map, which is an AtomContainer indicating the sources that are inputs to an effect. Next, create a track modifier reference to redirect the track’s output to the effect. You use the reference in building up the Atoms in the input map. Once built, the input map is set on the effect’s media with setInputMap() .

Example 9-4 exercises this technique by opening a movie, getting its first video track, and applying a user-selected filter to it.

Note

Run this example with ant run-ch09-filtertrackbuilder.ks.

Example 9-4. Creating a one-source effect (filter)

package com.oreilly.qtjnotebook.ch09; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required