0 Replies
      Latest reply on Mar 11, 2020 12:58 AM by zakrutilo
      zakrutilo Level 1 Level 1 (0 points)

        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 web (e.g. upload video to Google.Drive and save it back to device) , source is an empty CIImage


        fill [0 0 0 1 devicergb]
        extent=[infinite][0 0 1 1]


        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?