そのため、IRC チャンネルで議論した結果、Handbrake ではできないことがわかりました。
ただし、ffmpeg を使用した比較的簡単な方法を次に示します。
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
outputPipe = [NSPipe pipe];
taskOutput = [outputPipe fileHandleForReading];
current_task = [[NSTask alloc] init];
NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
NSString *stillName = [NSString stringWithFormat:@"%@_still%d.png", [MY_FILE substringToIndex:([draggedFile length]-4)], MY_STILL_NUMBER];
[current_task setLaunchPath: [NSString stringWithFormat:@"%@/ffmpeg", resourcePath]];
// save just frame at current time
// by leaving -ss before the -i, we enable direct indexing within ffmpeg, which saves a still in about a second, rather than a minute or so on a long video file
NSArray *arguments = [NSArray arrayWithObjects:@"-ss", currentFrameTime, @"-i", draggedFile, @"-vframes", @"1", @"-f", @"image2", stillName, nil];
[current_task setArguments:arguments];
[current_task setStandardInput:[NSPipe pipe]];
[current_task setStandardOutput:outputPipe];
[current_task setStandardError:outputPipe];
[defaultCenter addObserver:self selector:@selector(saveTaskCompleted:) name:NSTaskDidTerminateNotification object:current_task];
[current_task launch];
[taskOutput readInBackgroundAndNotify];
だから、私は(ビデオを変換するために)Handbrakeのタスクを使用してから、静止画を保存するために別のタスクを使用しています。ffmpeg だけでもいいのですが、私は Handbrake が好きなので、この 2 つを活用します。
これが誰にでも役立つことを願っています。