Reputation:
I have two solutions to this problem:
SOLUTION A
AVMutableComposition
.timing
for all the other frames using removeTimeRange(...)
method.SOLUTION B
AVAssetReader
to extract all individual frames as an array of CMSampleBuffer
[CMSampleBuffer]
back into a movie skipping every 20 frames or so as per requirement.AVMutableComposition
and use scaleTimeRange(..)
to reduce overall timeRange
of video for timelapse effect.PROBLEMS
e.g. A 12 second timelapse might only be shown to have a duration of 5 seconds, so it keeps playing even when the seek has finished.
I mean the timing of the video gets all messed up for some reason.
I am searching for a technique that can produce a timelapse for a video right away , without waiting time .Solution A kind of does that , but is unsuitable because of timing problems and stuttering.
Any suggestion would be great. Thanks!
Upvotes: 1
Views: 1437
Reputation: 25491
You might want to experiment with the inbuilt thumbnail generation functions to see if they are fast/effecient enough for your needs.
They have the benefit of being optimised to generate images efficiently from a video stream.
Simply displaying a 'slide show' like view of the thumbnails one after another may give you the effect you are looking for.
There is iinfomrtaion on the key class, AVAssetImageGenerator, here including how to use it to generate multiple images:
Upvotes: 0