我正在尝试合并 .mp4 和 .caf 文件,所以我使用以下代码,
AVMutableCompositionTrack *compositionVideoTrack =
[mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo
preferredTrackID:kCMPersistentTrackID_Invalid];
[compositionVideoTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, videoAsset.duration)
ofTrack:[[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]
atTime:kCMTimeZero
error:nil];
但我得到了错误
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(0x32c4d2a3 0x3aae397f 0x32b98b75 0x748e7 0x74e61 0x34b400c5 0x34b40077 0x34b40055 0x34b3f90b 0x34b3fe01 0x34a685f1 0x34a55801 0x34a5511b 0x367495a3 0x32c22683 0x32c21ee9 0x32c20cb7 0x32b93ebd 0x32b93d49 0x367482eb 0x34aa9301 0x6f767 0x6f708)
libc++abi.dylib: terminate called throwing an exception
包括所有需要的框架和.dylib
文件。