1

I am adding a voiceover track to an existing video, which may include audio tracks. I'm using AVAssetExportSession to render the video to a .mov.

I'd like to keep track of which audio track is the voiceover, so if the user later wants to edit the voiceover, I know which track to update. I thought I would use a unique trackID.

So I call:

let compositionAudioTrack = composition.addMutableTrack(withMediaType: .audio, preferredTrackID: myAudioTrackID)!

where myAudioTrackID is a random Int32 I generated. I have confirmed that the trackID for the returned compositionAudioTrack is indeed = myAudioTrackID.

But when I render the video usign AVAssetExportSession, the trackID is reassigned to some other number.

How can I keep track of which audio track is mine?

Michael Lee
  • 339
  • 3
  • 11

0 Answers0