1
使用下面的代碼,我收到此錯誤:NSTask失敗22撤消臨時過程可可
NSTask: Task create for path '/Users/media/Library/Developer/Xcode/DerivedData/Manager-gnixeptcszdoubbnfcncumzypwge/Build/Products/Debug/lib' failed: 22, "Invalid argument". Terminating temporary process.
我沒有得到什麼這背後的問題。對於ffmpegPresetLaunchPath
- (void)startProcessingVideo {
NSLog(@"Processing Video Low Resolution");
NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];
// NSTimeInterval is defined as double
NSNumber *timeStampObj = [NSNumber numberWithInt:timeStamp];
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterNoStyle];
NSString *convertNumber = [formatter stringForObjectValue:timeStampObj];
NSLog(@"timeStampObj:: %@", convertNumber);
NSString *fileNameNumber = [convertNumber stringByAppendingString:[self genRandStringLength:8]];
NSLog(@"fileNameNumber:::: %@", fileNameNumber);
NSString *aString = [[NSString stringWithFormat:@"%@%@%@", thumbnailDirPath,@"/Mobile" ,fileNameNumber] retain];
//NSString *string = [aString stringByAppendingString:@"_H"];
fileNameMP4Mobile = [aString stringByAppendingString:@".mp4"];
NSLog(@"string:::: %@", aString);
[lblMessage setStringValue:@"Started!"];
NSTask *task= [NSTask new];
[task setLaunchPath:ffmpegPresetLaunchPath];
[task setArguments:[NSArray arrayWithObjects:
@"-y",
@"-i",
inputFilePath,// @"1.wmv",
@"-vcodec",
@"libx264",
@"-fpre",
@"libx264-fast.ffpreset",
@"-b",
@"500k",
@"-s",
@"640*480",
@"-r",
@"30",
@"-aspect",
@"16:9",
@"-ab",
@"128k",
@"-ac",
@"2",
@"-ar",
@"44100",
fileNameMP4Mobile,nil]];
[task setCurrentDirectoryPath:thumbnailDirPath];
NSPipe *outputPipe = [NSPipe pipe];
[task setStandardInput:[NSPipe pipe]];
[task setStandardOutput:outputPipe];
[task launch];
[task waitUntilExit];
[task release];
NSData *outputData = [[outputPipe fileHandleForReading] readDataToEndOfFile];
NSString *outputString = [[[NSString alloc] initWithData:outputData encoding:NSUTF8StringEncoding] autorelease];
[lblMessage setStringValue:@"Video Generated!"];
[self startProcessingVideoHighResolution];
}
值:
ffmpegPresetLaunchPath = [[NSString stringWithFormat:@"%@%@", currentDir, @"/lib/"] retain];
價值的NSLog:
ffmpegPresetLaunchPath::: /Users/media/Library/Developer/Xcode/DerivedData/FileManager-gnixeptcszdoubbnfcncumzypwge/Build/Products/Debug/lib/
請幫助解決這個問題。
請顯示'ffmpegPresetLaunchPath'的值;這幾乎肯定會導致錯誤。 – trojanfoe 2012-03-05 13:50:20
請檢查,我編輯了這個問題。 – 2012-03-05 14:00:58