I'm using UIImagePicker to allow the user to create a video and then trim it. I need to split that video into multiple frames and let the user choose one of them.
In order to show the frames I likely must convert them to UIImage. How can I do this? I must use AVFoundation but I couldn't find a tutorial on how to get & convert the frames.
Should I do the image capture with AVFoundation too? If so do I have to implementing trimming myself?
Just open the Camera Roll or Photos app on the device, find and play the video, then pause at the video frame which you like to grab and save as image file, finally press the home and sleep buttons simultaneously.
The trick is to simply change the frame rate of the output to whatever we want using the -r n option where n is the number of frames per second. 1 frame per second would be -r 1 , one frame every four seconds would be -r 0.25 , one frame every ten seconds would be -r 0.1 and so on.
I think the answer in this question is what you are looking for.
iPhone Read UIimage (frames) from video with AVFoundation.
There are 2 methods specified by the accepted answer. You can use either one according to your requirement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With