Saturday, 10 October 2020

Inserting slowMo AVComposition into AVMutableComposition

PHPhotoLibrary gives an AVComposition rather than an AVURLAsset for a video recorded in SlowMo. I want to insert slowMo videos into another AVMutableComposition, so this means I need to insert this AVComposition into AVMutableComposition which is my editing timeline. The hack I used before was to load the tracks and segments and find the mediaURL of asset.

                    AVCompositionTrack *track = [avAsset tracks][0];
                    AVCompositionTrackSegment *segment = track.segments[0];
                    mediaURL = [segment sourceURL];

Once I had mediaURL, I was able to create a new AVAsset that could be inserted into AVMutableComposition. But I wonder if there is a cleaner approach that allows the slowMo video composition to be directly inserted into the timeline AVMutableComposition?



from Inserting slowMo AVComposition into AVMutableComposition

No comments:

Post a Comment