Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 3 (cancelled) on attempt to export video from iPhone 16 with APAC audio codec #49

Open
Igor-Poltavtsev opened this issue Oct 9, 2024 · 2 comments

Comments

@Igor-Poltavtsev
Copy link

Igor-Poltavtsev commented Oct 9, 2024

We have an issue on v.0.4.6 on exporting video created on iPhone 16 with APAC audio codec. Any suggestions?

@Igor-Poltavtsev Igor-Poltavtsev changed the title Error 3 on attempt to export video from iPhone 16 with APAC audio codec Error 3 (cancelled) on attempt to export video from iPhone 16 with APAC audio codec Oct 9, 2024
@belgiandubbel
Copy link

belgiandubbel commented Oct 9, 2024

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)

...

@Igor-Poltavtsev
Copy link
Author

Igor-Poltavtsev commented Oct 13, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants