J'essaye d'appeler ffmpeg de NSTask dans l'objectif-c. J'exécute la commande ffmpeg dans le terminal et ça fonctionne parfaitement à chaque fois. Je fais la même commande en utilisant NSTask, et il ne me donne jamais toute la sortie. Il coupe à mi-chemin à travers la sortie, à un endroit apparemment aléatoire à chaque fois. Voici mon code.NSTask et FFMpeg perdant la sortie
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSString* ffmpegPath = [[NSBundle mainBundle] pathForResource:@"ffmpeg" ofType:@""];
NSString* path = @"test.mov";
NSTask *task = [[NSTask alloc] init];
NSArray *arguments = [NSArray arrayWithObjects: @"-i", path, nil];
NSPipe *pipe = [NSPipe pipe];
NSFileHandle * read = [pipe fileHandleForReading];
[task setLaunchPath: ffmpegPath];
[task setArguments: arguments];
[task setStandardOutput: pipe];
[task launch];
[task waitUntilExit];
NSData* data = [read readDataToEndOfFile];
NSString* stringOutput = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"%@", stringOutput);
NSLog(@"%i", [task terminationStatus]);
NSLog(@"DONE");
}
Qu'est ce que c'est que "ffmpeg" que vous avez sauvegardé dans votre bundle de ressources, je ne peux trouver que les bibliothèques (.a) comme libavcodec.a etc .. – Swati
C'est l'application ffmpeg compilée http://www.ffmpeg.org / – Morgan