我正在尝试获取所有视频帧并将它们转换并存储为单独的图像。我在 AV Foundation Programming Guide 中使用此代码。
获取多个图像的代码是
CMTime firstThird = CMTimeMakeWithSeconds(durationSeconds/3.0, 600);
CMTime secondThird = CMTimeMakeWithSeconds(durationSeconds*2.0/3.0, 600);
CMTime end = CMTimeMakeWithSeconds(durationSeconds, 600);
这是硬编码的,但我想转换整个视频。我知道我可以使用 for 循环,但这durationsecond
意味着我如何使用从乞求到结束来获取所有帧?
这是我的尝试
for(float f=0.0; f<=durationSeconds; f++) {
[times addObject:[NSValue valueWithCMTime:CMTimeMakeWithSeconds(durationSeconds, 600)]];
}