简体   繁体   中英

Trimming video with in selected time frame

I have an application requirement where user can trim the video of any size with specified time frame. For example if there is a video of say 20 seconds , user can select from any second to any second (eg : 5 to 15). For this I need to display the time frame for the video, default video trimming using UIImagePicker and enabling allowsEditing property to YES doesn't show the time from where to where it is cut. Simply the requirement is like whats app video trimming, with display of time frames of video and trimming. Hoe can I achieve these goals? Any help is highly appreciated. Thanks in advance.

Yes, You can extract video from start to end duration.

You can do using like this and you get our more demo on github for video extration.

 CMTime duration = Your time duration ;

        AVMutableCompositionTrack *videoTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo
                                                                                preferredTrackID:kCMPersistentTrackID_Invalid];

        [videoTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, duration)
                                ofTrack:videoAsset3Track
                                 atTime:kCMTimeZero error:&error];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM