NextLevelSessionExporter
NextLevelSessionExporter copied to clipboard
Error 3 (cancelled) on attempt to export video from iPhone 16 with APAC audio codec
We have an issue on v.0.4.6 on exporting video created on iPhone 16 with APAC audio codec. Any suggestions?
I concur - have same issue on an iPhone 16 Pro with videos recorded on the iPhone 16 Pro device. The problem seems to be Record Sound = Spacial in Settings.app | Camera. The videos have 2 audio tracks, one of them the problematic APAC track. I have partially solved it for now by modifying NextLevelSessionExporter.setupAudioOutput() by filtering out the APAC track before submitting it to AVAssetReaderAudioMixOutput:
NextLevelSessionExporter.swift:418 - setupAudioOutput()
...
var audioTracksToUse: [AVAssetTrack] = []
// Remove APAC tracks
for audioTrack in audioTracks {
let mediaSubtypes = audioTrack.formatDescriptions.filter { CMFormatDescriptionGetMediaType($0 as! CMFormatDescription) == kCMMediaType_Audio }.map { CMFormatDescriptionGetMediaSubType($0 as! CMFormatDescription) }
for mediaSubtype in mediaSubtypes where mediaSubtype != kAudioFormatAPAC {
audioTracksToUse.append(audioTrack)
}
}
self._audioOutput = AVAssetReaderAudioMixOutput(audioTracks: audioTracksToUse, audioSettings: nil)
...
Thanks, @belgiandubbel we applied similar solution and seems it works. We modify incoming assets - remove track with apac codec. After NextLevelSessionExporter will be updated we just remove our custom solution.
Please take a moment to review PR https://github.com/NextLevel/NextLevelSessionExporter/pull/51
📎 https://github.com/NextLevel/NextLevelSessionExporter/pull/51