Roman Kravtsov
Roman Kravtsov

Reputation: 23

iOS - AVAsynchronousCIImageFilteringRequest source image is empty

I use AVMutableVideoComposition(asset:applyingCIFiltersWithHandler:) to apply CIFilter for each frame. Here is my code:

let mainTrackAsset = AVAsset(url: url)
let mainCompositionWithFilter = AVMutableVideoComposition(asset: mainTrackAsset) { request in                
    let source = request.sourceImage
}

It works fine with video recorded from device, but if I save video from for example, Google Drive, source is empty CIImage fill [0 0 0 1 devicergb] extent=[infinite][0 0 1 1] opaque

The only difference between recorded and saved from web videos is that first element of mainTrackAsset.tracks has media type video for recorded and audio for saved from web

Is it a bug in AVFoundation or I've not understood how it works? Is there possibility to rearrange indices of mainTrackAsset.tracks?

Upvotes: 1

Views: 221

Answers (0)

Related Questions