使用下面的代码,我收到此错误:
NSTask: Task create for path '/Users/media/Library/Developer/Xcode/DerivedData/Manager-gnixeptcszdoubbnfcncumzypwge/Build/Products/Debug/lib' failed: 22, "Invalid argument". Terminating temporary process.
我不知道这背后的问题是什么。
- (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的值为:
ffmpegPresetLaunchPath = [[NSString stringWithFormat:@"%@%@", currentDir, @"/lib/"] retain];
NSLOG中的价值:
ffmpegPresetLaunchPath::: /Users/media/Library/Developer/Xcode/DerivedData/FileManager-gnixeptcszdoubbnfcncumzypwge/Build/Products/Debug/lib/
请帮助解决此问题。