1

i found the strange behaviour while save the QTMovie to a file in a hard drive..(example:Desktop)... it shows the different frame image than the start time frame image as a preview in the desktop..... but if i open the saved QTMovie in a "Quick Time Player" it shows the correct frame image at the start time...

i suspect that it might be bug in cocoa ...

here is my code snippet for trim the original movie and save the trimmed movie to a different file:

QTMovie *newmovie;
NSError *error = nil;

newmovie = [[QTMovie alloc] initToWritableData:[NSMutableData data] error:&error];

[newmovie setAttribute:[NSNumber numberWithBool:YES] forKey:QTMovieEditableAttribute];

QTTime starttime = QTMakeTimeWithTimeInterval(videostarttime);
QTTime duration = QTMakeTimeWithTimeInterval(currentclipduration);


QTTimeRange range = QTMakeTimeRange(starttime, duration);
[newmovie insertSegmentOfMovie:mvmovie timeRange:range atTime:QTZeroTime];


NSDictionary *dictionary = [NSDictionary 
                        dictionaryWithObjects:
                        [NSArray arrayWithObjects:
                         [NSNumber numberWithBool:YES],
                         [NSNumber numberWithBool:YES],
                         [NSNumber numberWithLong:kQTFileTypeMP4],  // TODO - allow to select the codec
                         nil]
                        forKeys:
                        [NSArray arrayWithObjects:
                         QTMovieFlatten, QTMovieExport, QTMovieExportType, nil]];




NSString *fileextn,*underscore,*combinedstring;

clipcount++;




NSString *intString = [NSString stringWithFormat:@"%d", clipcount];
fileextn = @".MP4 ";
underscore = @"_";
intString = [intString stringByAppendingString:fileextn];


combinedstring = [underscore stringByAppendingString:intString];

NSString* filename ;

filename = [curFileName stringValue].stringByDeletingPathExtension;

filename = [filename stringByAppendingString:combinedstring];

NSString *result = [[NSHomeDirectory() stringByAppendingPathComponent:@"Desktop"] stringByAppendingPathComponent:filename];



[newmovie writeToFile:result withAttributes:dictionary];

[newmovie release];

can anyone please help me to fix this problem?....i dont know what i did wrong... execpt the "preview frame image of the saved QTMovie file all are working as per the expectation...

Thanks & Regards, Muthu

mammaiap
  • 11
  • 2

0 Answers0