Core Image: From CIImage to Metal and Beyond · Route Video Frames through Core Image | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5428948-core-image-from-ciimage-to-metal-and-beyond/lessons/18

Hi Sam,
I followed the steps in your tutorial, I have a few questions hope you can help

  1. How do I change filters on button click?? Like I have 5 filters and I want t to apply/remove based on button click
  2. Is there a way to add the slider to increase/decrease the effect on live filter?
    3 How do you export into video?? Can we achieve that??

I’m really new to IOS so sorry in advance if I sound stupid :blush:
Thanks

hi @niraj0107

It’s been a while since I looked at this, but here are my best ideas of answers:

  1. I have a feeling that you’ll need to tear down the old filter pipeline and create a new one instead. So create a new set of filters, and replace the ones you’ve already got. I could be wrong, but I’m reasonably confident that that’ll work at the very least.
  2. Yes! You can create a slider, and then update attributes of a filter live. If you look at this project I created for a conference, there is a macOS app called GreatWhenItWorks, which demonstrates how you can use sliders with Core Image. It’s not quite the same, because it’s macOS, and not iOS, but it should be suitably similar to give you an idea.
  3. You can export the video yes. You need to take a look into building an AVFoundation pipeline to capture the video, and stream it to disk / across the network. There is some documentation here I think: Apple Developer Documentation

Sorry to not give you really simple answers, but hopefully I’ve pointed you in roughly the right direction—good luck!

sam