My experiments show that AVMutableComposition scaleTimeRange is limited to scaling up to 8x faster than the original composition.
This limit is not documented anywhere.
Is it a true limit? If so, is there any way around it?
Relevant code below, with some boilerplate abstracted into functions not included here:
AVMutableComposition *comp = [[AVMutableComposition alloc] init];
AVMutableCompositionTrack *videoComp =
[comp addMutableTrackWithMediaType:AVMediaTypeVideo
preferredTrackID:kCMPersistentTrackID_Invalid];
AVAsset* asset = AddVideoToTrack(videoComp, kCMTimeZero,
CMTimeMake(startSeconds, 1),
CMTimeMake(endSeconds, 1),
videoFilepath);
float initialDuration = endSeconds - startSeconds;
CMTime startTime = kCMTimeZero;
CMTime endTime = CMTimeMake(initialDuration, 1);
CMTimeRange inputRange = CMTimeRangeFromTimeToTime(startTime, endTime);
[videoComp scaleTimeRange:inputRange toDuration:CMTimeMakeWithSeconds(initialDuration / playbackSpeed, 1)];
ExportWithSDAVAssetExportSession(videoComp);