我在将 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];
谁能帮我解决这个问题?....我不知道我做错了什么...除了“保存的 QTMovie 文件的预览帧图像都按预期工作...
谢谢和问候, 穆图