kal21
kal21

Reputation: 461

In iOS How to capture frames from a video file as stream of UIImages?

I am interested in reading Video file as a series of UIImages on iOS. Is there anyway to do that using AVFoundation APIs.

Upvotes: 1

Views: 1209

Answers (1)

Chris McGrath
Chris McGrath

Reputation: 1936

Create an AVAssetReader with the video track of the file. With an AVAssetReaderTrackOutput, you can send it the copyNextSampleBuffer message to receive a CMSampleBuffer. Each call will produce another frame from the video.

Inside the AVFoundation Programming Guide there is sample code showing how to set up an AVAssetReader as well as a method for making the conversion from CMSampleBuffer to UIImage.

Upvotes: 1

Related Questions