How to display QuickTime Export dialog?
|
|
Thread rating:  |
google@whooley.utvinternet.com - 28 Jun 2006 17:02 GMT Is it possible to display the QuickTime Export dialog? - the dialog that appears if you try to Export a movie from the Quicktime player, or "Share", as Quicktime from iMovie. (Since it's in both applications, I'm assuming it's a generic Quicktime dialog and not from the apps themselves).
I need to hint a large number of Quicktime movies for streaming (just shy of 1,000), and doing so manually would be pretty tedious. I was hoping to present this Export dialog for the first movie, export it, and save the export settings so the rest of the movies can be exported using the same settings and without any user interaction required for each movie.
Can this be done? The closes sample code I've found is QTHintMovies, but the Export dialog it presents is far too basic. I need to be able to select codecs, video and audio bit rates, etc.
Reinder Verlinde - 28 Jun 2006 18:46 GMT > Is it possible to display the QuickTime Export dialog? - the dialog > that appears if you try to Export a movie from the Quicktime player, or [quoted text clipped - 8 lines] > using the same settings and without any user interaction required for > each movie. When I tried, over a year ago, I did not have much luck with them, but, in theory, you can do this in AppleScript.
I see its dictionary contains "save export settings to ..." and "export to ... using settings file ...". These seem to be newer than what I used then, so you may get lucky.
> Can this be done? The closes sample code I've found is QTHintMovies, > but the Export dialog it presents is far too basic. I need to be able > to select codecs, video and audio bit rates, etc. I haven't checked what it does, but QTHintMovies does not appear to use GraphicsExportRequestSettings. Again, you may get lucky using it. <http://developer.apple.com/documentation/QuickTime/Reference/QTRef_Graph icsImportExport/index.html?http://developer.apple.com/documentation/Quick Time/Reference/QTRef_GraphicsImportExport/Reference/reference.html#//appl e_ref/c/func/GraphicsExportRequestSettings>
Reinder
google@whooley.utvinternet.com - 28 Jun 2006 21:26 GMT > I haven't checked what it does, but QTHintMovies does not appear to use > GraphicsExportRequestSettings. Again, you may get lucky using it. [quoted text clipped - 3 lines] > Time/Reference/QTRef_GraphicsImportExport/Reference/reference.html#//appl > e_ref/c/func/GraphicsExportRequestSettings> Thanks Reinder. The link you provided is broken for me, but I'll find it.
I think the call QuickTime and iMovie use is QTExportSessionShowUI(), but it's undocumented and I've no idea what parameters it takes. (I know using an undocumented call is a bit risky, but it's for an internal tool in this case, so that's not a problem).
Michael Ash - 28 Jun 2006 23:19 GMT > Is it possible to display the QuickTime Export dialog? - the dialog > that appears if you try to Export a movie from the Quicktime player, or [quoted text clipped - 12 lines] > but the Export dialog it presents is far too basic. I need to be able > to select codecs, video and audio bit rates, etc. I'm not entirely sure what you're talking about, but it looks like the regular QT export thing to me. Take a look at QTAmateur:
http://www.mikeash.com/?page=software/qtamateur/index.html
If it does what you need, it has a batch export function that should come in handy for your kilomovie. And if it does not, but it looks like it's going in the right direction, let me know and I can hook you up with the code for it.
 Signature Michael Ash Rogue Amoeba Software
google@whooley.utvinternet.com - 29 Jun 2006 14:03 GMT > I'm not entirely sure what you're talking about, but it looks like the > regular QT export thing to me. Take a look at QTAmateur: [quoted text clipped - 5 lines] > going in the right direction, let me know and I can hook you up with the > code for it. Thanks for that Michael, the batch export is what I need. The export dialog it uses is slightly different from that in Quicktime Player and iMovie, but it has the 'Movie Settings' window which is perfect.
I saw you're using MovieExportDoUserDialog, and realised I was using the right function, but on the wrong component. I was specifying 'hint' as the component manufacturer, instead of kAppleManufacturer.
Unfortunately, it's crashing on MovieExportDoUserDialog. Here's the code from QTHintMovies, edited only to change the component manufacturer, and to use paths instead of FSSpecs.
ComponentDescription myCompDesc; MovieExportComponent myExporter = NULL; long myFlags = createMovieFileDeleteCurFile | movieFileSpecValid; ComponentResult myErr = badComponentType; Boolean myCancelled = false;
// find and open a movie export component that can hint a movie file myCompDesc.componentType = MovieExportType; myCompDesc.componentSubType = MovieFileType; myCompDesc.componentManufacturer = kAppleManufacturer ;//FOUR_CHAR_CODE('hint'); myCompDesc.componentFlags = 0; myCompDesc.componentFlagsMask = 0; myExporter = OpenComponent(FindNextComponent(NULL, &myCompDesc)); if (myExporter == NULL) goto bail;
// use the default progress procedure SetMovieProgressProc(theMovie, (MovieProgressUPP)-1L, 0);
// get the preferences file for this application NSString* prefsFilePath = nil; prefsFilePath = QTHints_GetPrefsFilePath(moviePath) ;
// read existing movie exporter settings from a file; if we aren't going to prompt // the user for exporter settings, these stored settings will be used; otherwise, // these stored settings will be used as initial values in the settings dialog box QTUtils_GetExporterSettingsFromFile(myExporter, prefsFilePath);
if (thePromptUser) {
// display a dialog box to prompt the user for desired movie exporter settings myErr = MovieExportDoUserDialog(myExporter, theMovie, NULL, 0, 0, &myCancelled); if (myCancelled) goto bail; // save the existing settings into our preferences file QTUtils_SaveExporterSettingsInFile(myExporter, prefsFilePath); }
if (!myCancelled) { Handle dataReference = nil ; OSType dataReferenceType ; myErr = QTNewDataReferenceFromFullPathCFString( (CFStringRef)moviePath, kQTNativeDefaultPathStyle,0,&dataReference,&dataReferenceType) ;
myErr = ConvertMovieToDataRef( theMovie, NULL, dataReference, dataReferenceType, MovieFileType,FOUR_CHAR_CODE('TVOD'), myFlags, myExporter) ; }
google@whooley.utvinternet.com - 29 Jun 2006 17:59 GMT > If it does what you need, it has a batch export function that should come > in handy for your kilomovie. And if it does not, but it looks like it's > going in the right direction, let me know and I can hook you up with the > code for it. Unfortunately, it's not really suitable. If QTAmateur encounters a movie it can't open (some of the source movies provided to me may be invalid), the batch export will stop and can't be restarted - there's no option to skip or remove a movie from the batch. The app also crashed after a hundred movies or so (quite possibly caused by an invalid movie).
Also, it's not apparent how the movies are sorted in the batch, hence if a batch stops for any reason, it's very difficult to determine from which point to resume.
If you could provide a code snippet for the movie export - or a link to relevant Apple sample - I'd really appreciate it!
Thanks for your help, Mike.
Michael Ash - 29 Jun 2006 19:05 GMT >> If it does what you need, it has a batch export function that should come >> in handy for your kilomovie. And if it does not, but it looks like it's [quoted text clipped - 7 lines] > crashed after a hundred movies or so (quite possibly caused by an > invalid movie). It was a pretty quick job, and I'm not too shocked that error recovery might not be done properly. I'm sure it could be better.
> Also, it's not apparent how the movies are sorted in the batch, hence > if a batch stops for any reason, it's very difficult to determine from > which point to resume. It should just go from the top down.
> If you could provide a code snippet for the movie export - or a link to > relevant Apple sample - I'd really appreciate it! I've gone ahead and just posted the whole source code here:
http://mikeash.com/tmp/QTAmateur.tar.gz
It should build fine on a recent Xcode and you can take a look at how it works. If you have changes you'd like to send back to me, or just suggestions on what I coould do better, please let me know.
 Signature Michael Ash Rogue Amoeba Software
google@whooley.utvinternet.com - 30 Jun 2006 11:44 GMT > It should just go from the top down. It does go from top to bottom, but the order the files are listed in the batch seems random, it's certainly not alphabetical, based on size or date created/modified - could it be based on the node ID of the movie files? I'll take a look at the code later.
> I've gone ahead and just posted the whole source code here: > [quoted text clipped - 3 lines] > works. If you have changes you'd like to send back to me, or just > suggestions on what I coould do better, please let me know. Really appreciate you passing that on! I'm a little busy verifying that c. 1,000 movies open and play to completion correctly (!!!), but I'll be happy to pass on any changes I make.
Thanks again, Mike.
Michael Ash - 30 Jun 2006 16:50 GMT >> It should just go from the top down. > > It does go from top to bottom, but the order the files are listed in > the batch seems random, it's certainly not alphabetical, based on size > or date created/modified - could it be based on the node ID of the > movie files? I'll take a look at the code later. If you're dragging them all in at once then it'll probably be in whatever order they were on the pasteboard, and I have no idea what that is.
It might be worth it for you to add a sort button or something. Probably wouldn't be a bad idea for me either. :)
>> I've gone ahead and just posted the whole source code here: >> [quoted text clipped - 7 lines] > c. 1,000 movies open and play to completion correctly (!!!), but I'll > be happy to pass on any changes I make. Great. Have fun.
 Signature Michael Ash Rogue Amoeba Software
Ben Artin - 30 Jun 2006 17:15 GMT > >> It should just go from the top down. > > [quoted text clipped - 5 lines] > If you're dragging them all in at once then it'll probably be in whatever > order they were on the pasteboard, and I have no idea what that is. The order in which you receive drag items from the Finder is annoying -- it's essentially random, although it actually has to do with the way that those items are internally represented in the Finder. For most sensible user experience, you should sort them before processing them.
Ben
 Signature If this message helped you, consider buying an item from my wish list: <http://artins.org/ben/wishlist>
I changed my name: <http://periodic-kingdom.org/People/NameChange.php>
-- Posted via a free Usenet account from http://www.teranews.com
Michael Ash - 30 Jun 2006 20:06 GMT >> If you're dragging them all in at once then it'll probably be in whatever >> order they were on the pasteboard, and I have no idea what that is. [quoted text clipped - 3 lines] > are internally represented in the Finder. For most sensible user experience, you > should sort them before processing them. So it would appear. Thanks for the info.
 Signature Michael Ash Rogue Amoeba Software
|
|
|