ios - Processing all frames in an AVAsset -
I am trying to get a AVAsset
through each frame and for each frame An image like the process I am unable to find anything from my searches.
The task that I am trying to complete will appear in such a pseudo code
frames as an image for each frame in the property and Convert a CVMAT process and store the data of the center points
The only center of the phonematic code in the store center points in the array, I do not know how to write in each frame. And capture it in an image Ia being.
Can anyone help?
Use an answer.
1) Load the movie file into an AVAsset
object.
2) Create an AVAssetImageGenerator
object. <3) Pass the estimated time of the frame where you want to get an image back from the movie.
to
the AVAssetImageGenerator
to the 2 properties requested timetire
and requested timetableproperty
to
Although this method is slow and I have not found any fast way.
Load the movie from // URLs. MovieAsset = [AVASEet Asset URL: self.movieURL]; NSERE * Filmtrack = [Self. MovieSetset Screenplay with Media Type: AVMediaType Video]; AVAssetTrack * movieTrack = [Filmtrack ObjectAntEndex: 0]; // Create Image Generator AVAssetImageGenerator * imageGenerator = [[AVAssetImageGenerator alloc] initWithAsset: self.movieAsset]; // Create a variable for time estimate Float64 durationSeconds = CMTimeGetSeconds (self.movieAsset.duration); Float 64 timeframe = 1.0 / (float 64) mitruck. Nominalframerette; Float 64 total frames = period seconds * movieTrack.nominalFrameRate; // Stretch for frame (int counter = 0; counter & lt; = totalFrames; counter ++) via frame {ctme real time; Float 64 secs in = (float) counter / total frames) * PeriodSecond; CMTime imageTimeEstimate = CMTimeMakeWithSeconds (second in, 600); NSError * error; CGImageRef image = [imageGenerator copyCGImageAtTime: imageTimeEstimate Real Time: & amp; Real time error: & amp; Error]; ... Make some processing on the image CGImageRelease (image); }
Comments
Post a Comment