googlesamples / mlkit

A collection of sample apps to demonstrate how to use Google's ML Kit APIs on Android and iOS
Apache License 2.0
3.51k stars 2.92k forks source link

Is it possible to detect faces during video playback? #694

Closed JamesTongBussiness closed 1 year ago

JamesTongBussiness commented 1 year ago

Thanks for ML Kit team, now we can detect faces in images and video easily.

I think that it is possible to detect human faces in real time when shooting video with a camera, but is it possible to detect faces with mlkit even during video playback?

It seems that it is necessary to use the captureOutput(_, DidOutput:from:) function of AVCaptureVideoDataOutputSampleBufferDelegate when processing video with mlkit, but it is possible to execute that function when playing video with AVPlayer?

If it is possible, please let me know the sample code or how to implement it.

Thanks.

miworking3 commented 1 year ago

Please refer to Apple's doc on how to get the frames while playing a video and send them to ML Kit on Face Detection. Thanks.