Ohad Regev Ohad Regev - 4 months ago 21x
iOS Question

iOS AVCaptureSession - How to get/set the number of frames per second recorded?

I'm new to AVCaptureSession and wish to better understand how to work with it.
So I managed capturing the video stream as separated CIImages and convert them to UIImages.
Now I wish to be able to get the number of Frames Per Second captured and preferably to be able to set it.

Any idea how to do that?


You could use AVCaptureConnection's videoMinFrameDuration accessor to set the value.

See the AVCaptureConnection documentation

Consider output be AVCaptureVideoDataOutput object.

AVCaptureConnection *conn = [output connectionWithMediaType:AVMediaTypeVideo];

if (conn.isVideoMinFrameDurationSupported)
    conn.videoMinFrameDuration = CMTimeMake(1, CAPTURE_FRAMES_PER_SECOND);
if (conn.isVideoMaxFrameDurationSupported)
    conn.videoMaxFrameDuration = CMTimeMake(1, CAPTURE_FRAMES_PER_SECOND);

More info, see my answer in this SO question