Home / IOS Development / ios – Insert slowMo AVComposition in AVMutableComposition

ios – Insert slowMo AVComposition in AVMutableComposition

PHPhotoLibrary provides an AV composition instead of an AVURLA set 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 timeline for editing. The hack I used before was to load the tracks and segments and find the mediaURL of the asset.

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

When I had mediaURL, I managed 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 inserted directly into the AVMutableComposition timeline?

Source link