将QTMovie保存到mac os x中的文件后,预览图像无法正确显示确切的帧图像

时间:2012-10-18 03:50:00

标签: macos cocoa quicktime qtkit

我在将QTMovie保存到硬盘驱动器中的文件时发现了奇怪的行为..(例如:桌面)...它显示了与开始时间帧图像不同的帧图像作为桌面预览... ..但如果我在“Quick Time Player”中打开保存的QTMovie,它会在开始时显示正确的帧图像...

我怀疑它可能是可可中的错误......

这是我的代码片段,用于修剪原始影片并将剪裁后的影片保存到其他文件中:

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];

任何人都可以帮我解决这个问题吗?....我不知道我做错了什么... execpt“保存的QTMovie文件的预览帧图像都按预期工作......

谢谢&问候, MUTHU

0 个答案:

没有答案