macoscocoascalingquicktimeqtkit

Scaling a QTMovie before appending


Using the QTKit framework, I'm developing a little app.

In the app, I'm trying to append a movie after a other movie, which in essence is already working (most of the time), but I'm having a little trouble with the appended movie. The movie is which I'm appending to is quite big, like 1920x1080, and the appended movie is usually much smaller, but I never know what size it exactly is. The appended movie sort of stays its own size in the previous 1920x1080 frame, as seen here: enter image description here

Is there anyone familiar with this? Is there a way I can scale the movie which I need to append to, to the size of the appended movie? There is no reference of such a thing in the documentation.

This is are some relevant methods: `QTMovie *segmentTwo = [QTMovie movieWithURL:finishedMovie error:nil]; QTTimeRange range = { .time = QTZeroTime, .duration = [segmentTwo duration] };

        [segmentTwo setSelection:range];
        [leader appendSelectionFromMovie:segmentTwo];

        while([[leader attributeForKey:QTMovieLoadStateAttribute] longValue] != 100000L)
        {
            //wait until QTMovieLoadStateComplete
        }

        NSDictionary *exportAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                          [NSNumber numberWithBool:YES], QTMovieExport,
                                          [NSNumber numberWithLong:kQTFileTypeMovie], QTMovieExportType, nil];

        NSString *outputFile = [NSString stringWithFormat:@"%@.mov", onderwerp];
        NSString *filepath = [[@"~/Desktop" stringByExpandingTildeInPath] stringByAppendingFormat:@"/%@", outputFile];
        BOOL succes = [leader writeToFile:filepath withAttributes:exportAttributes error:&theError];

Leader is initialized like this:

NSDictionary *movieAttributes = [NSDictionary dictionaryWithObjectsAndKeys:path, QTMovieFileNameAttribute, [NSNumber numberWithBool:YES], QTMovieEditableAttribute,  nil];

leader = [QTMovie movieWithAttributes: movieAttributes  error:&error];

Solution

  • This contained all the information I need, although without using the QTKit framework. QTKit - Merge two videos with different width and height?