Take the 2-minute tour ×

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.

share|improve this question
After removing this time range, do you export or write this edited composition? –  Ravin Mar 3 '12 at 7:24

1 Answer 1

up vote 2 down vote accepted

I believe you are using the CMTimeMake function incorrectly but it is hard to tell with so little code. CMTimeMake creates 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?

share|improve this answer
thank, I will try it and let you know. –  iOSPawan Mar 6 '12 at 2:55

Your Answer


