I do not think that MPMoviePlayerControllercan help you.
Use AVAssetReaderand calculate the amount CMSampleBufferthat it returns to you. You can configure it so that you don’t even have to decode the frames by analyzing the file efficiently, so it should be fast and efficient in terms of memory.
Sort of
var asset = AVURLAsset(URL: url, options: nil)
var reader = AVAssetReader(asset: asset, error: nil)
var videoTrack = asset.tracksWithMediaType(AVMediaTypeVideo)[0] as! AVAssetTrack
var readerOutput = AVAssetReaderTrackOutput(track: videoTrack, outputSettings: nil)
reader.addOutput(readerOutput)
reader.startReading()
var nFrames = 0
while true {
var sampleBuffer = readerOutput.copyNextSampleBuffer()
if sampleBuffer == nil {
break
}
nFrames++
}
println("Num frames: \(nFrames)")
, , .