Loading...

quicktime-api@lists.apple.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

[QTTrack addImage:] and memory usage Daniel Kennett Wed Apr 25 06:04:39 2007

Good afternoon all.

I'm developing an application that allows you to place animated graphics objects on top of a video, in a similar fashion to Motion. When exporting the video, a track is added to the movie and the graphics are added on a frame by frame basis. Obviously, this creates a *lot* of images. Here's my loop:

for (time = 0; time < duration; time += 40) {
  NSImage *image = [[NSImage alloc] initWithSize: size];
  [dataView drawIntoImage:image forTime:time];
[track addImage:image forDuration:QTMakeTime(100, 1000) withAttributes:imageDict];
  [image release];
 }

[dataView drawIntoImage:] simply locks on to the passed image and draws into it, and doesn't retain or release anything. size is an NSSize equivalent to the natural size of the movie. The imageDict is set up as follows:

NSDictionary *imageDict = [NSDictionary dictionaryWithObjectsAndKeys:
            @"tiff", QTAddImageCodecType,
[NSNumber numberWithLong:codecHighQuality], QTAddImageCodecQuality, nil];

It works just fine, but exporting a video that is 19 seconds long at 25fps (== 475 images) at 1056 x 576 causes the program's memory use to shoot up to 2.5Gb from a couple of hundred megs. Anything much bigger/longer causes the memory usage to exceed the 4Gb limit and spew malloc errors everywhere.

I don't *think* that this is wrong - I'm creating 475 big images and adding them to a movie. However, is there a method of doing this that uses less memory?

Thanks,

-- Daniel _______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list      ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/alexiscircle%40gmail.com

This email sent to [EMAIL PROTECTED]