So long as I add the unique audio observe within the video, an error “Invalid pattern cursor, or pattern out of vary” might be reported when exporting.
var audioInputParams: [AVMutableAudioMixInputParameters] = []
for audioTrack in audioTracks {
guard let observe = mixComposition.addMutableTrack(withMediaType: .audio, preferredTrackID: kCMPersistentTrackID_Invalid) else {
proceed
}
let audioTimeRange: CMTimeRange = .init(begin: .zero, period: audioTrack.timeRange.period)
strive observe.insertTimeRange(audioTimeRange, of: audioTrack, at: .zero)
observe.preferredTransform = audioTrack.preferredTransform
let audioInputParam = AVMutableAudioMixInputParameters(observe: observe)
audioInputParam.setVolumeRamp(fromStartVolume: issue.quantity, toEndVolume: issue.quantity, timeRange: audioTimeRange)
audioInputParam.trackID = observe.trackID
audioInputParams.append(audioInputParam)
}
After I lower the period of audioTimeRange by 1 second it simply works effective
let audioTimeRange: CMTimeRange = .init(begin: .zero, period: .init(seconds: audioTrack.timeRange.period.seconds - 1, preferredTimescale: audioTrack.timeRange.period.timescale))
Some movies are regular, and a few movies are improper. I checked the timeRange of the video observe vs the audio observe, they’re all the identical
The video of the error is right here: Video
I’ve searched rather a lot, however nobody has the identical error as me