|
QuickTime 7 support for Quartz ComposerWhen opening a Quartz Composer composition with QuickTime, the result is a Movie that contains a "Quartz Composer" track of type 'qtz '. A Quartz Composer track contains the original data of the composition, not a rasterized version of it, and has the following characteristics:
WARNING: A few features of Quartz Composer are not supported inside QuickTime:
Important differences with other forms of QuickTime mediaQuartz Composer compositions have special characteristics you should be aware of when using them through QuickTime, in order to preserve quality and performance:
Each of the above points is explained in details in following sections: Quartz Composer contents renders though OpenGLQuartz Composer back-end is implemented using OpenGL and renders directly on the display card for optimal performance. As a consequence, QuickDraw GWorld based QuickTime applications need to move to the new visual context and Core Video APIs to avoid a severe performance hit. IMPORTANT: It's essential that your application switch to the new APIs introduced in QuickTime 7: QTKit for Cocoa applications (see QuickTime Kit Programming Guide) and HIMovieView for Carbon applications (see QuickTime Reference Update). These playback APIs use the new visual contexts instead of QuickDraw GWorlds and will improve QuickTime playback performance in general and especially in the case of Quartz Composer contents. For the same reasons, if your application needs to render and perform operations on the movie frames, you should use visual contexts and Core Video buffers instead of QuickDraw GWorlds. Quartz Composer contents is resolution independentQuartz Composer compositions do not inherently specify dimensions at which they are to be rendered. However, for compatibility with QuickTime, the Quartz Composer track must have specified dimensions. If the composition is exported as a QuickTime movie from the Quartz Composer application, users can specify a custom size in the export settings dialog. In most cases however, composition files will be imported through QuickTime into arbitrary applications and default dimensions of 640x480 are used. When rendering a QuickTime movie that has Quartz Composer track in a visual context (either directly or by using QTKit or HIMovieView), the track is always rendered at the final movie size and the initial track dimensions are ignored. To ensure the best possible quality, it's important to render the QuickTime movie directly at the needed size (using IMPORTANT: If the final rendering size does not have the same aspect ratio as the original track size (for example, if the Quartz Composer track is 640x480 and the movie is displayed at 1024x480), the resulting images will be distorted (non-uniform scaling) and not cropped (uniform scaling). This is expected QuickTime behavior, but is opposite to the way the Quartz Composer playback APIs QCView and QCRenderer behave. If you need to avoid any kind of non-uniform scaling or wish to have the Quartz Composer tracks have specific dimensions, you will have to specify custom values for the default dimensions (instead of 640x480). They can be changed globally or per-application using the "defaults" command line tool (units are pixels): defaults write NSGlobalDomain QuartzComposerDefaultMovieWidth 1024 defaults write NSGlobalDomain QuartzComposerDefaultMovieHeight 768 Note: Replace "NSGlobalDomain" with the bundle identifier of an application, like "com.apple.iMovie" to set defaults only for that application. In the case of your own application, you do not need to use the "defaults" command line tool to set those defaults: just set them using the NSUserDefaults API for Cocoa applications (see Application Kit Reference), or the CFPreferences API for Carbon applications (see Core Foundation Reference). For example, you would add the following method to the application controller class of a Cocoa application to set the default dimensions at initialization time: + (void) initialize { NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; [defaults setInt:[NSNumber numberWithInt:1024] forKey:@"QuartzComposerDefaultMovieWidth"]; [defaults setInt:[NSNumber numberWithInt:768] forKey:@"QuartzComposerDefaultMovieHeight"]; } Quartz Composer contents has no duration or frame rateQuartz Composer compositions do not specify a duration for which they are to be rendered. For compatibility with QuickTime however, the Quartz Composer track must have a duration. If the composition is exported as a QuickTime movie from the Quartz Composer application, users can specify a custom duration in the export settings dialog. In most cases however, composition files will be imported through QuickTime into arbitrary applications and a default duration of 30 seconds is used. You can change the default track duration globally or per-application using the "defaults" command line tool (units are seconds): defaults write NSGlobalDomain QuartzComposerDefaultMovieDuration 300 Quartz Composer compositions do not have a predefined framerate. When playing a QuickTime movie using the QTKit or HIMovieView, rendering of the Quartz Composer track is driven from the Core Video display link (see Core Video Programming Guide), which runs at the screen refresh rate (60Hz or more). Unless limited by the complexity of the composition, the track will render as the rate of the Core Video display link. For compatibility with QuickTime, the Quartz Composer track will return 1/30 increments when An obvious example is to convert the movie to another format like DV using the QuickTime Player export capabilities. If the frame rate of the export format is different than 30, then QuickTime will need to do some pull-down conversion. This will likely affect the quality of the export. IMPORTANT: Explicitly set the "Frame Rate" option of the QuickTime export dialog to the destination format frame rate (24 for cinema, 29.97 for NTSC, 25 for PAL and so on), as the default ("Current") will mean 30 frames per second. If you are rendering QuickTime movies frame by frame in your application and those movies contain enabled Quartz Composer tracks, you should ignore completely Boolean HasEnabledQuartzComposerTracks(Movie movie) { Track track; track = GetMovieIndTrackType(movie, 1, 'qtz ', movieTrackMediaType | movieTrackEnabledOnly); return (track != NULL ? true : false); } WARNING: For compatibility reasons, a Quartz Composer track can render in a GWorld environment at the expense of performance. This is not recommended as the performace hit is severe. The following limitations also apply:
Document Revision History
Posted: 2005-07-05 |
|