glogic
glogic

Reputation: 4092

AVAssetExportSession merge videos with stereo

I am merging multiple videos together using AVAssetExportSession but the videos are in stereo and the resulting video is in dual mono. Is it possible to use AVAssetExportSession to merge videos and maintain the stereo channels? I see it is possible to merge in stereo using AVAssetWriter and

AudioChannelLayout stereoChannelLayout = {.mChannelLayoutTag = kAudioChannelLayoutTag_Stereo,
                .mChannelBitmap = 0,
                .mNumberChannelDescriptions = 0
            };

to make it stereo but I am using AVMutableVideoCompositionLayerInstruction with the AVAssetExportSession to handle video positioning within the merge so it would be ideal if there was a way to do it with AVAssetExportSession.

Upvotes: 0

Views: 671

Answers (1)

agressen
agressen

Reputation: 469

I found that you can replace AVAssetExportSession with SDAVAssetExportSession. You can then specify audio settings as you would for the AVAssetWriter while leveraging the benefits of the AVAssetExportSession.

I had to change __weak typeof(self) wself = self; to __weak SDAVAssetExportSession * wself = self; on line 172 of SDAVAssetExportSession.m.

Upvotes: 2

Related Questions