|
Q: I have a source movie in DV format and I need to convert it to a MPEG-4 file and set some of the attributes like compression quality, image size, frame rate, and so on. However, I'd like to do this programatically without displaying the settings dialog. Is this possible?A: Yes. The recommended technique for performing a conversion without displaying the dialog involves a two-stage process in which you create a set of settings "presets" which are retrieved later to configure the exporter. Here's an overview: Creating Settings Presets to Configure the Exporter1) Create a Tool to Configure/Save Exporter SettingsFirst, create a simple tool (separate from your real application) to manufacture any number of exporter settings presets which can be retrieved later to configure the exporter. Here's how: Write a simple application which brings up the exporter dialog. Now use the dialog to configure the desired settings for your file export and save these settings to a file so they can be easily retrieved later. You can create any number of different exporter settings presets in this manner to suit your particular needs. Here's the detailed steps:
This technique is demonstrated in Technical Q&A QTMTB62, 'Batch Exporting movie sound tracks with ConvertMovieToFile' and in the QTDataExchange and BackgroundExporter sample code projects. 2) Configure the Exporter with your Saved Settings and Perform the ExportFinally, in your real application, retrieve the desired settings preset, configure the export component with these saved settings and perform the conversion with the fully configured export component. Here's the detailed steps:
This technique is also demonstrated in Technical Q&A QTMTB62, 'Batch Exporting movie sound tracks with ConvertMovieToFile' and in the QTDataExchange and BackgroundExporter sample code projects. IMPORTANT: Using the QuickTime settings dialog as just described to create settings presets for configuring the exporter is the recommended approach because you are sure to specify a valid combination of settings for the exporter component. Alternate ApproachAlternately, you can manually configure the exporter using the various WARNING: Configuring the exporter manually using the To use this technique, first get the default settings from the exporter, use the functions which operate on QuickTime atoms to locate the atoms associated with the desired settings, then update the atoms for the new settings. Next, configure the exporter with the new settings. Finally, call Here's the detailed steps:
This technique is demonstrated in Technical Q&A QA1147, 'Programmatic configuration of a Movie Export Component'. As noted above, only part of the settings atoms used to configure the exporters are documented. Therefore, it may not be possible to fully configure the exporter using this technique. However, the definitions for the settings atoms used with the Standard Image Compression Dialog component and functions such as SCSetInfo can be found in the QuickTimeComponents.h header file. Atoms for the visual settings can be found in the For example, the spatial compression parameters used with the Standard Image Compression Dialog component are stored in the ' struct SCSpatialSettings { CodecType codecType; CodecComponent codec; short depth; CodecQ spatialQuality; }; Similarly, temporal compression parameters are stored in an atom with ID struct SCTemporalSettings { CodecQ temporalQuality; Fixed frameRate; long keyFrameRate; }; Compression data rate settings are stored in an atom with ID struct SCDataRateSettings { long dataRate; long frameDuration; CodecQ minSpatialQuality; CodecQ minTemporalQuality; }; References
Document Revision History
Posted: 2005-03-22 |
|