The resolution status of the issue I registered through Feedback Assistant is set to "Potential fix identified - In iOS 14.5" now. Also, when I tried some unsync cases in iOS 14.6, the problem is not reproduced.
Post
Replies
Boosts
Views
Activity
I use AVAssetReader and AVAssetWriter to export edited video. Since iOS 14.5.1, -11819 errors have occurred a lot too.
The feedback ID is FB8811460. Thanks!
I uploaded same question to Feedback Assistant. I hope this problem will be resolved well and I will cooperate actively.
Yes, but it has still a sync problem. Also, AVAsset.duration and AVAssetTrack.timeRange.duration is actually the same in the log.
FYI, here is the stackoverflow link - https://stackoverflow.com/questions/64349186/out-of-sync-between-video-and-audio-of-video-exported-by-avassetexportsession of my question. It has an image about audio tracks between source and exported video.
Thank you for the reply. Here is my code I use to construct AVMutableComposition.
let composition = AVMutableComposition()
let videoTrack = composition.addMutableTrack(
withMediaType: AVMediaType.video,
preferredTrackID: kCMPersistentTrackID_Invalid
)
let audioTrack = composition.addMutableTrack(
withMediaType: AVMediaType.audio,
preferredTrackID: kCMPersistentTrackID_Invalid
)
let assetVideoTrack = asset.tracks(withMediaType: AVMediaType.video).first
let assetAudioTrack = asset.tracks(withMediaType: AVMediaType.audio).first
let assetDuration = assetVideoTrack?.timeRange.duration
?? assetAudioTrack?.timeRange.duration
?? CMTime.zero
let timeRange = CMTimeRangeMake(start: CMTime.zero, duration: assetDuration)
let atTime = CMTime.zero
do {
if let assetVideoTrack = assetVideoTrack {
	try videoTrack?.insertTimeRange(
	 timeRange,
	 of: assetVideoTrack,
	 at: atTime
	)
}
if let assetAudioTrack = assetAudioTrack {
	try audioTrack?.insertTimeRange(
	 timeRange,
	 of: assetAudioTrack,
	 at: atTime
	)
}
} catch {
}