Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MetalPetal Video filter not working on transition #30

Open
R3l0ad3d opened this issue Aug 29, 2022 · 0 comments
Open

MetalPetal Video filter not working on transition #30

R3l0ad3d opened this issue Aug 29, 2022 · 0 comments

Comments

@R3l0ad3d
Copy link

I want to use filter on video. thats why is use VideoIO. filter work but the problem is transition.
` func videoFilterSet(){
guard let result = result else{
return}

    let context = try! MTIContext(device: MTLCreateSystemDefaultDevice()!)
    let handler = MTIAsyncVideoCompositionRequestHandler(context: context, tracks: result.composition.tracks, on: .main) { request in
        self.filter.inputImage = request.anySourceImage
        return self.filter.outputImage!
    }
    let composition = VideoComposition(propertiesOf: result.composition, compositionRequestHandler: handler.handle(request:))
    let playerItem = AVPlayerItem(asset: result.composition)
    playerItem.videoComposition = composition.makeAVVideoComposition()
    player.replaceCurrentItem(with: playerItem)

    self.player.seek(to: .zero)
    self.player.replaceCurrentItem(with: playerItem)
    self.player.play()
}`

please see this code for filter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant