To trim video I have used removeTimeRange method of AVMutableCompositionTrack.
[mCachedCompositionTrack removeTimeRange:CMTimeRangeMake(CMTimeMake(3, NSEC_PER_SEC), CMTimeMake(4, NSEC_PER_SEC))];
Here video length is 10 sec. and after calling above method video length should be 9sec (frames with timeRange 3 – 4 should be removed from track). But it is not happening instead it always returns actual video length with blank frames.
Any help will be appriciated.
I believe you are using the
CMTimeMakefunction incorrectly but it is hard to tell with so little code.CMTimeMakecreates a fraction of time. This should correspond to the number of frames per second. So if you want, in this case, to cut off one second. But it might be important to consider what the frame rate is as well.If the frame rate was 30 frames per second, I would create the time interval the following way:
CMTimeRangeMake(CMTimeMake(3*30, 30), CMTimeMake(4*30, 30))Have you tried this?