1

我正在AVMutableComposition从视频和音轨创建:

func makeComposition(videoTrack: AVAssetTrack, audioTrack: AVAssetTrack) -> AVComposition {
    let composition = AVMutableComposition()
    /* ... */
    let compositionAudioTrack = composition.addMutableTrack(withMediaType: .audio)!
    try compositionAudioTrack.insertTimeRange(someRange, of: audioTrack, at: .zero) // Error!
    /* ... */
    return composition
}

insertTimeRange(_:of:at:)以 AVFoundationError -11800AVError.code.unknown和未记录的底层NSOSStatusError-12780 失败。可能是什么情况?

4

1 回答 1

1

事实证明,当我调用audioTrackinsertTimeRange的源时,它已经发布了。保留对源的引用,因此您必须保留才能使用。AVAssetAVAssetTrackAVAssetAVAssetAVAssetTrack

于 2020-04-08T14:06:31.967 回答