# Core Image: From CIImage to Metal and Beyond · Access the Camera with AVFoundation | raywenderlich.com

**URL:** <https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793>\
**Category:** 🎓 Courses & Articles\
**Created:** [September 24, 2019, 8:21pm UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793 "2019-09-24T20:21:47Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![samdavies](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/samdavies/32/108448_2.png) [@samdavies](https://forums.kodeco.com/u/samdavies)\
**Post date:** [September 24, 2019, 8:21pm UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/1 "2019-09-24T20:21:47Z")

</div>

* * *
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/16](https://www.raywenderlich.com/5428948-core-image-from-ciimage-to-metal-and-beyond/lessons/16)

---

<div class="post-metadata">

**Author:** ![mostafas](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/mostafas/32/81494_2.png) [@mostafas](https://forums.kodeco.com/u/mostafas)\
**Post date:** [January 28, 2020, 1:11pm UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/2 "2020-01-28T13:11:36Z")

</div>

hello sam, thanks for the very good explanation of CIIMage  
i’m new to ios and started from here with swiftUI, now i wan to implement this in swiftui, how can i get this done with swiftUI, i mean i could achieve it with images, but in case of video, i got stuck, i would appreciate it if you could direct me in the right way.  
thanks.

---

<div class="post-metadata">

**Author:** ![samdavies](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/samdavies/32/108448_2.png) [@samdavies](https://forums.kodeco.com/u/samdavies)\
**Post date:** [February 3, 2020, 7:45am UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/3 "2020-02-03T07:45:49Z")

</div>

Hi @mostafas

Apologies for the delay in my reply. I’m not an expert in SwiftUI, so I could be wrong, but I don’t think there is “native-SwiftUI” support for videos yet. However, SwiftUI has facility to integrate UIKit views, so you could look at wrapping `AVPlayerViewController` or an `AVPlayerLayer` directly.

I expect that that functionality of SwiftUI will improve over future releases, but until then we’ll have to use UIKit directly for some use cases.

Hope that helps

sam

---

<div class="post-metadata">

**Author:** ![kekquistador](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kekquistador/32/81494_2.png) [@kekquistador](https://forums.kodeco.com/u/kekquistador)\
**Post date:** [May 5, 2020, 10:45pm UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/4 "2020-05-05T22:45:55Z")

</div>

Where exactly Sam did you implement the rosy pink metal filter within the video feed. Really having a hardtime trying to find it

---

<div class="post-metadata">

**Author:** ![samdavies](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/samdavies/32/108448_2.png) [@samdavies](https://forums.kodeco.com/u/samdavies)\
**Post date:** [May 6, 2020, 1:09pm UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/5 "2020-05-06T13:09:43Z")

</div>

Hi @kekquistador,

I’m not entirely sure what you mean by “rosy pink metal filter”. Is this something referred to in this video? Can you send me a screenshot or a timecode?

Hopefully I’ll be able to point you in the right direction with a little more info.

Thanks

sam

---

<div class="post-metadata">

**Author:** ![kekquistador](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kekquistador/32/81494_2.png) [@kekquistador](https://forums.kodeco.com/u/kekquistador)\
**Post date:** [May 6, 2020, 8:29pm UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/6 "2020-05-06T20:29:34Z")

</div>

Sorry, lol was accidentally referring to your room color in film. It looked like it was shaded pink and the Apple tutorial for Metalkit involves a pink shader.

Is it possible to do livestreaming with a custom metal based filter?

when I try using your methods I usually get just a white screen

---

<div class="post-metadata">

**Author:** ![samdavies](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/samdavies/32/108448_2.png) [@samdavies](https://forums.kodeco.com/u/samdavies)\
**Post date:** [May 8, 2020, 9:42am UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/7 "2020-05-08T09:42:40Z")

</div>

=)

I have never tried live streaming a video that has been through a metal filter, but I think it must be possible. I think you could probably set up your AVFoundation pipeline to include filtering?

Sorry I can’t be of more help…

sam

---

<div class="post-metadata">

**Author:** ![kekquistador](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kekquistador/32/81494_2.png) [@kekquistador](https://forums.kodeco.com/u/kekquistador)\
**Post date:** [May 13, 2020, 9:46pm UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/8 "2020-05-13T21:46:28Z")

</div>

thats what Im doing now. Ive started the Metals pdf book from your website in an attempt to get a faster working video filters. Is it possible to use metal filters for video filtering?

thank you

---

<div class="post-metadata">

**Author:** ![samdavies](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/samdavies/32/108448_2.png) [@samdavies](https://forums.kodeco.com/u/samdavies)\
**Post date:** [May 14, 2020, 8:59am UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/9 "2020-05-14T08:59:05Z")

</div>

Yes!

If you combine the knowledge from:

[https://www.raywenderlich.com/5428948-core-image-from-ciimage-to-metal-and-beyond/lessons/11](https://www.raywenderlich.com/5428948-core-image-from-ciimage-to-metal-and-beyond/lessons/11)

and

[https://www.raywenderlich.com/5428948-core-image-from-ciimage-to-metal-and-beyond/lessons/16](https://www.raywenderlich.com/5428948-core-image-from-ciimage-to-metal-and-beyond/lessons/16)

Then you absolutely can use a custom Metal Core Image filter inside the video processing pipeline.

Good luck!

sam

---

<div class="post-metadata">

**Author:** ![kekquistador](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kekquistador/32/81494_2.png) [@kekquistador](https://forums.kodeco.com/u/kekquistador)\
**Post date:** [May 15, 2020, 12:37am UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/10 "2020-05-15T00:37:52Z")

</div>

yay i’ll try that  
the metal book gives a very good introduction to everything that needs to be included

---

<div class="post-metadata">

**Author:** ![kekquistador](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kekquistador/32/81494_2.png) [@kekquistador](https://forums.kodeco.com/u/kekquistador)\
**Post date:** [May 16, 2020, 11:18pm UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/11 "2020-05-16T23:18:26Z")

</div>

![Screen Shot 2020-05-16 at 6.12.09 PM](https://files.chunter.kodeco.com/original/3X/4/0/40b5a8c586e9babbebb33c144f359a86e75ca6cd.png) ![Screen Shot 2020-05-16 at 6.11.33 PM|601x500]

Hey, here is what I got from combining those 2 lessons.  
I did put in the 2 custom buildsettings revolving around -fcikernel.

I am not sure, but I always get a blank white screen on my older ipad and the debugging tells me compiler was not able to create the Passthrough kernel from the Metal file.

---

<div class="post-metadata">

**Author:** ![kekquistador](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kekquistador/32/81494_2.png) [@kekquistador](https://forums.kodeco.com/u/kekquistador)\
**Post date:** [May 18, 2020, 9:09pm UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/12 "2020-05-18T21:09:16Z")

</div>

Should I show you any more screenshots if possible?

---

<div class="post-metadata">

**Author:** ![samdavies](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/samdavies/32/108448_2.png) [@samdavies](https://forums.kodeco.com/u/samdavies)\
**Post date:** [May 19, 2020, 6:48pm UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/13 "2020-05-19T18:48:18Z")

</div>

I think it’s worth focusing on why the kernel is not compiling. I’m sorry, I don’t have a great memory, so am not sure whether there is anything additional that needs doing to get it to compile.

Did you manage to compile the pass-through kernel with the sample project downloaded from here?

sam

---

<div class="post-metadata">

**Author:** ![kekquistador](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kekquistador/32/81494_2.png) [@kekquistador](https://forums.kodeco.com/u/kekquistador)\
**Post date:** [May 19, 2020, 11:10pm UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/14 "2020-05-19T23:10:34Z")

</div>

I believe so, but that is with a picture and not the streaming. I am wondering if i have to add something or create something towards the commandque

---

<div class="post-metadata">

**Author:** ![kekquistador](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kekquistador/32/81494_2.png) [@kekquistador](https://forums.kodeco.com/u/kekquistador)\
**Post date:** [May 20, 2020, 1:06am UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/15 "2020-05-20T01:06:54Z")

</div>

I have only been using the passthrough kernel on the project as a test

---

<div class="post-metadata">

**Author:** ![kekquistador](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kekquistador/32/81494_2.png) [@kekquistador](https://forums.kodeco.com/u/kekquistador)\
**Post date:** [May 24, 2020, 8:36am UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/16 "2020-05-24T08:36:34Z")

</div>

Could there be other procedures Core Image filters go through. I noticed ther eis a CIsampler NSO object

---

<div class="post-metadata">

**Author:** ![samdavies](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/samdavies/32/108448_2.png) [@samdavies](https://forums.kodeco.com/u/samdavies)\
**Post date:** [May 25, 2020, 11:34am UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/17 "2020-05-25T11:34:57Z")

</div>

I’m sorry @kekquistador—I don’t have any experience of this, so can’t really offer any significant help. I don’t know what to suggest that you haven’t already tried.

I hope you manage to get to the bottom of it—good luck!

sam

---

<div class="post-metadata">

**Author:** ![kekquistador](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kekquistador/32/81494_2.png) [@kekquistador](https://forums.kodeco.com/u/kekquistador)\
**Post date:** [May 26, 2020, 6:01am UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/18 "2020-05-26T06:01:02Z")

</div>

Im working on it. I’ll keep you posted

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [July 6, 2020, 11:52pm UTC](https://forums.kodeco.com/t/core-image-from-ciimage-to-metal-and-beyond-access-the-camera-with-avfoundation-raywenderlich-com/82793/19 "2020-07-06T23:52:37Z")

</div>

@kekquistador Do you still have issues with this?
