Hello! It turned out to solve this problem with a trick when creating an AVComposition. Namely, when creating AVComposition, I began to use two instead of one AVCompositionTrack in a checkerboard pattern. This solves the problem of not only different fps for neighboring videos, but also a different transform, if it was applied.
let videoTracks = [
composition.addMutableTrack(withMediaType: .video, preferredTrackID: kCMPersistentTrackID_Invalid)!,
composition.addMutableTrack(withMediaType: .video, preferredTrackID: kCMPersistentTrackID_Invalid)!
]
let timeRangeStart: CMTime = .zero
for (index, asset) in assets.enumerated() {
let videoTrack = videoTracks[index % 2]
let assetTrack = asset.tracks(withMediaType: .video).first
let timeRange = CMTimeRange(start: .zero, duration: asset.duration)
do {
try videoTrack.insertTimeRange(
timeRange,
of: assetTrack,
at: timeRangeStart
)
timeRangeStart = timeRangeStart + timeRange.duration
} catch {
logError()
}
}