简体   繁体   English

AVAssetExportSession将视频与立体声合并

[英]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. 我正在使用AVAssetExportSession将多个视频合并在一起,但视频是立体声的,结果视频是双声道的。 Is it possible to use AVAssetExportSession to merge videos and maintain the stereo channels? 是否可以使用AVAssetExportSession合并视频并维护立体声通道? I see it is possible to merge in stereo using AVAssetWriter and 我看到可以使用AVAssetWriter和立体声进行合并

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 . 使它成为立体声,但我使用AVMutableVideoCompositionLayerInstructionAVAssetExportSession来处理合并中的视频定位,所以如果有办法用AVAssetExportSession这样做将是理想的。

I found that you can replace AVAssetExportSession with SDAVAssetExportSession . 我发现你可以用AVAssetExportSession替换SDAVAssetExportSession You can then specify audio settings as you would for the AVAssetWriter while leveraging the benefits of the AVAssetExportSession . 然后,您可以指定音频设置,你会为AVAssetWriter同时利用的好处AVAssetExportSession

I had to change __weak typeof(self) wself = self; 我不得不改变__weak typeof(self) wself = self; to __weak SDAVAssetExportSession * wself = self; to __weak SDAVAssetExportSession * wself = self; on line 172 of SDAVAssetExportSession.m . SDAVAssetExportSession.m第172 SDAVAssetExportSession.m

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM