When using a CIFilter
with an AVVideoComposition
, how can I access the current frame number in the AVAsynchronousCIImageFilteringRequest
callback?
The best I was able to do is estimate the frame number from the time:
^(AVAsynchronousCIImageFilteringRequest * _Nonnull request) {
double seconds = CMTimeGetSeconds(request.compositionTime);
double fps = [[_avAsset tracksWithMediaType:AVMediaTypeVideo] firstObject].nominalFrameRate;
int frame = round(seconds * fps);
// (Calculate filter parameters based on frame number)
}
But this isn't accurate enough for me. Is there a way to access the frame number?