# Webcam sketch "mirror" not working

**URL:** <https://discourse.processing.org/t/webcam-sketch-mirror-not-working/20805>\
**Category:** Processing\
**Created:** [May 12, 2020, 10:28pm UTC](https://discourse.processing.org/t/webcam-sketch-mirror-not-working/20805 "2020-05-12T22:28:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sargentpilcher](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@sargentpilcher](https://discourse.processing.org/u/sargentpilcher)\
**Post date:** [May 12, 2020, 10:28pm UTC](https://discourse.processing.org/t/webcam-sketch-mirror-not-working/20805/1 "2020-05-12T22:28:16Z")

</div>

I’m just getting started with processing, attempting to learn the ropes, and I was watching a youtube tutorial where he pulls up the built in sketch “mirror” under “libraries \> video \> capture \> mirror” and my webcam lights up for a few seconds before turning off, and video never appears on the screen. No errors are shown, no problem compiling, which makes it difficult to troubleshoot the problem.

System specs:  
MacBook Pro 2019  
OSX 10.14.6

I’d appreciate any points in the right direction because I don’t even know where to start. My first guess is an OS compatibility issue but don’t know what I would do to fix that.

edit:

I’ve since tried several sketches involving the webcam, and none work. Are there any known issues with it?

---

<div class="post-metadata">

**Author:** ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)\
**Post date:** [May 13, 2020, 4:30am UTC](https://discourse.processing.org/t/webcam-sketch-mirror-not-working/20805/2 "2020-05-13T04:30:43Z")

</div>

Welcome to the sketches!

I’m on a 2015 Pro, never had a problem. If you’ve tried multiple sketches, it definitely sounds like a local issue. I’m just shooting in the dark at this point, but it might be a local security setting.

Does this in-browser sketch work for you?  
[https://p5js.org/examples/dom-video-capture.html](https://p5js.org/examples/dom-video-capture.html)

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [May 13, 2020, 1:29pm UTC](https://discourse.processing.org/t/webcam-sketch-mirror-not-working/20805/3 "2020-05-13T13:29:39Z")

</div>

It is most likely an issue with the version of gstreamer, the “old” library does not work with gstreamer-1.0+ which is what recent linux and presumably newer Mac have. There is [`beta` version of video library](https://github.com/processing/processing-video/releases/tag/r6-v2.0-beta4) available that supports gstreamer-1.0+, however you will need to modify your sketches to get them to work, might well work with test capture sketch though. Basically you have to name the Camera you are using. See [Video library to use new GStreamer bindings](https://discourse.processing.org/t/video-library-to-use-new-gstreamer-bindings/2223/2) and my JRubyArt example [https://github.com/ruby-processing/JRubyArt-examples/blob/master/processing\_app/library/video/capture/mirror.rb](https://github.com/ruby-processing/JRubyArt-examples/blob/master/processing_app/library/video/capture/mirror.rb).

---

<div class="post-metadata">

**Author:** ![sargentpilcher](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@sargentpilcher](https://discourse.processing.org/u/sargentpilcher)\
**Post date:** [May 13, 2020, 7:55pm UTC](https://discourse.processing.org/t/webcam-sketch-mirror-not-working/20805/4 "2020-05-13T19:55:39Z")

</div>

Good thinking! I didn’t even know there WAS a browser version of processing, great method to troubleshoot! It DOES work just fine in the browser version, camera and all. I suppose worst case scenario I could just use the browser version. I wonder if I can add custom libraries to it?

I tried to give processing permission to use my camera, but couldn’t quite figure out how. I settled for adding it to the accessibility list under the security and privacy tab, but no luck. Video doesn’t show up.

I’m going to give @monkstone idea, but my programing knowledge is VERY beginner, so I’m not confident I can pull it off, but I’m gonna try it.

---

<div class="post-metadata">

**Author:** ![sargentpilcher](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@sargentpilcher](https://discourse.processing.org/u/sargentpilcher)\
**Post date:** [May 13, 2020, 8:12pm UTC](https://discourse.processing.org/t/webcam-sketch-mirror-not-working/20805/5 "2020-05-13T20:12:39Z")

</div>

Hmm, I just downloaded it and installed it to test it out, but got a lot of errors and I’m not sure where to begin.

“processing.app.SketchException: Badly formed character constant (expecting quote, got i)  
at processing.mode.java.preproc.PdePreprocessor.checkForUnterminatedMultilineComment(PdePreprocessor.java:831)  
at processing.mode.java.preproc.PdePreprocessor.write(PdePreprocessor.java:868)  
at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:253)  
at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:155)  
at processing.mode.java.JavaBuild.build(JavaBuild.java:122)  
at processing.mode.java.JavaBuild.build(JavaBuild.java:104)  
at processing.mode.java.JavaMode.handleLaunch(JavaMode.java:122)  
at processing.mode.java.JavaEditor.lambda$0(JavaEditor.java:1099)  
at java.lang.Thread.run(Thread.java:748)”

I’m not asking anybody to do the work for me, and I really want to wrap my head around what I need to do to alleviate this issue. Is this a java library I need to install? I searched “java” in the add library section, but I didn’t see anything that looked like it was what I wanted. I’ll keep searching.

Thank you both for your pointers!

---

<div class="post-metadata">

**Author:** ![sargentpilcher](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@sargentpilcher](https://discourse.processing.org/u/sargentpilcher)\
**Post date:** [May 13, 2020, 8:43pm UTC](https://discourse.processing.org/t/webcam-sketch-mirror-not-working/20805/6 "2020-05-13T20:43:06Z")

</div>

Just an update. Just because I run into this kind of thing fairly frequently, I’ve taken to installing windows with bootcamp on my macs, so I just tried this out on windows 10, and it works fine. I am fine with that for now, and I appreciate both of your help with the issue. Technological growing pains is all.

---

<div class="post-metadata">

**Author:** ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)\
**Post date:** [May 14, 2020, 12:24am UTC](https://discourse.processing.org/t/webcam-sketch-mirror-not-working/20805/7 "2020-05-14T00:24:27Z")

</div>

> [@sargentpilcher](#):
>
> I suppose worst case scenario I could just use the browser version. I wonder if I can add custom libraries to it?

You’re in luck! [P5.js has some great libraries](https://p5js.org/libraries/) that are meant to operate within the Processing structure(`draw()`, `setup()`, etc) but, because P5js is itself just a JS library, you can actually use anything in the general javascript ecosystem! 🤯

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [May 14, 2020, 6:41am UTC](https://discourse.processing.org/t/webcam-sketch-mirror-not-working/20805/8 "2020-05-14T06:41:49Z")

</div>

@sargentpilcher There is [guide to manual install](https://github.com/processing/processing/wiki/How-to-Install-a-Contributed-Library) of processing libraries. Which you might find useful. The beta video library leaves a lot to be desired but works reasonably well.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [May 15, 2020, 8:09pm UTC](https://discourse.processing.org/t/webcam-sketch-mirror-not-working/20805/9 "2020-05-15T20:09:01Z")

</div>

Your problem with the webcam on macOS is probably this issue (which has documented workarounds, although no fix yet):

> <https://github.com/processing/processing-video/issues/134#issuecomment-617301980>
>
> Running the example file that comes with the Processing video library throws the following error:
> libc++abi.dylib: terminating with uncaught exception of type...
