11

我正在尝试在嵌套层次结构中使用 AVMutableComposition。因此,我必须将一个作品放入另一个作品中。这样做会导致以下错误消息:

AVCompositionTest[45347:10703] comp2 >>> 操作无法完成

我使用以下代码剪断。

AVAsset *audioAsset = [AVAsset assetWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"02 Undefined" ofType:@"mp3"]]];

AVMutableComposition *comp1 = [AVMutableComposition composition];

BOOL success = YES;
NSError *error = nil;

success = [comp1 insertTimeRange:CMTimeRangeMake(kCMTimeZero, audioAsset.duration)
                         ofAsset:audioAsset
                          atTime:kCMTimeZero
                           error:&error];

if (!success) {
    NSLog(@"comp1 >>> %@", [error localizedDescription]);
}

AVMutableComposition *comp2 = [AVMutableComposition composition];

success = [comp2 insertTimeRange:CMTimeRangeMake(kCMTimeZero, audioAsset.duration)
                         ofAsset:comp1
                          atTime:kCMTimeZero
                           error:&error];

if (!success) {
    NSLog(@"comp2 >>> %@", [error localizedDescription]);
}

是否可以嵌套组合?

4

1 回答 1

3

无法嵌套AVMutableComposition资产。

于 2012-07-17T07:55:45.963 回答