# Problem with live video feed in Processing

**URL:** https://discourse.processing.org/t/problem-with-live-video-feed-in-processing/39328
**Category:** Libraries
**Created:** [October 17, 2022, 10:16pm UTC](https://discourse.processing.org/t/problem-with-live-video-feed-in-processing/39328 "2022-10-17T22:16:23Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![thinh.pham](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/thinh.pham/32/17197_2.png) [@thinh.pham](https://discourse.processing.org/u/thinh.pham)
#### Post date: [October 17, 2022, 10:16pm UTC](https://discourse.processing.org/t/problem-with-live-video-feed-in-processing/39328/1 "2022-10-17T22:16:23Z")

</div>

Hello,

I’m learning Processing and currently having problem with displaying video from webcam using Processing Video library. the console shows this:

```auto
Processing video library using bundled GStreamer 1.20.3
Scanning GStreamer plugins... Done.

(Processing core video:23010): GStreamer-CRITICAL **: 16:48:23.550: gst_bin_add_many: assertion 'GST_IS_ELEMENT (element_1)' failed

(Processing core video:23010): GStreamer-CRITICAL **: 16:48:23.558: gst_element_link_pads_full: assertion 'GST_IS_ELEMENT (dest)' failed

```

and the display window is black.

Can anyone help with this? I’m running Processing 4.0.1 Apple Silicon version.

Thank you,

---

<div class="post-metadata">

### Author: ![sableraph](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sableraph/32/251_2.png) [@sableraph](https://discourse.processing.org/u/sableraph)
#### Post date: [October 18, 2022, 10:52am UTC](https://discourse.processing.org/t/problem-with-live-video-feed-in-processing/39328/2 "2022-10-18T10:52:36Z")

</div>

Hello @thinh.pham I have noticed the same issue and reported it on Github (see link below). It seems like the video library is currently broken on Apple Silicon.

> <https://github.com/processing/processing4/issues/575>
>
> \## Description
> 
> Attempting to initialize camera capture on Apple Silicon cause…s a critical error in GStreamer. On an Intel Mac, the same issue does \_not\_ happen. Note: this issue has been mentioned on the forum \[here\](https://discourse.processing.org/t/capture-doesnt-work-mac-m1/38781).
> 
> \## Expected Behavior
> 
> 
> The camera capture should be initiated without errors.
> 
> \## Current Behavior
> 
> A critical error is raised and the camera capture can not be initiated. See below:
> 
> \`\`\`
> Processing video library using bundled GStreamer 1.20.3
> Scanning GStreamer plugins... Done.
> Available cameras:
> FaceTime HD Camera
> 
> (Processing core video:4365): GStreamer-CRITICAL \*\*: 13:31:26.506: gst\_bin\_add\_many: assertion 'GST\_IS\_ELEMENT (element\_1)' failed
> 
> (Processing core video:4365): GStreamer-CRITICAL \*\*: 13:31:26.513: gst\_element\_link\_pads\_full: assertion 'GST\_IS\_ELEMENT (dest)' failed
> \`\`\`
> 
> \## Steps to Reproduce
> 
> 
> 1. Use an M1 MacBook Pro
> 2. Try running the \[capture example\](https://processing.org/reference/libraries/video/Capture.html) from the reference
> 3. See errors in the console
> 
> Below is a stripped down version of the example that still triggers the error. The error doesn't happen if you comment out \`cam = new Capture(this, cameras\[0\]);\`
> 
> \`\`\`Java
> import processing.video.\*;
> 
> Capture cam;
> 
> void setup() {
> size(640, 480);
> 
> String\[\] cameras = Capture.list();
>   
> if (cameras.length == 0) {
> println("There are no cameras available for capture.");
> exit();
> } else {
> println("Available cameras:");
> for (int i = 0; i \< cameras.length; i++) {
> println(cameras\[i\]);
> }
> 
> cam = new Capture(this, cameras\[0\]);
> //cam.start();     
> }      
> }
> \`\`\`
> 
> \## Your Environment
> \* Processing version: 4.0.1
> \* Operating System and OS version: MacOS 12.5.1 Monterey 
> \* Other info: M1 Max CPU
> 
> \## Possible Causes / Solutions
> 
> Unknown

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [October 18, 2022, 12:33pm UTC](https://discourse.processing.org/t/problem-with-live-video-feed-in-processing/39328/3 "2022-10-18T12:33:40Z")

</div>

You could also see if this example works for you - [gst1-java-examples/SwingCamera at master · gstreamer-java/gst1-java-examples · GitHub](https://github.com/gstreamer-java/gst1-java-examples/tree/master/SwingCamera)

Might help narrow down whether this is a bug in Processing Video or lower down the stack.

---

<div class="post-metadata">

### Author: ![sableraph](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sableraph/32/251_2.png) [@sableraph](https://discourse.processing.org/u/sableraph)
#### Post date: [October 18, 2022, 1:44pm UTC](https://discourse.processing.org/t/problem-with-live-video-feed-in-processing/39328/4 "2022-10-18T13:44:56Z")

</div>

Just saw the following workaround [suggested on the Github issue](https://github.com/processing/processing4/issues/575#issuecomment-1282368416).

```auto
cam = new Capture(this, 640, 480, "pipeline:avfvideosrc device-index=0 ! video/x-raw, width=640, height=480, framerate=30/1");

```

This worked for me on macOS 12.5.1 (Monterey) on an M1 Macbook Pro.

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [October 18, 2022, 1:58pm UTC](https://discourse.processing.org/t/problem-with-live-video-feed-in-processing/39328/5 "2022-10-18T13:58:22Z")

</div>

Also try `"pipeline:autovideosrc"`. If it works, that is at least cross-platform.

---

<div class="post-metadata">

### Author: ![sableraph](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sableraph/32/251_2.png) [@sableraph](https://discourse.processing.org/u/sableraph)
#### Post date: [October 19, 2022, 9:40am UTC](https://discourse.processing.org/t/problem-with-live-video-feed-in-processing/39328/6 "2022-10-19T09:40:00Z")

</div>

Thanks for the tip! The following worked for me:

```auto
cam = new Capture(this, 640, 480, "pipeline:autovideosrc ! video/x-raw, width=640, height=480, framerate=30/1");

```

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [October 19, 2022, 9:53am UTC](https://discourse.processing.org/t/problem-with-live-video-feed-in-processing/39328/7 "2022-10-19T09:53:28Z")

</div>

What about without the caps bit too? eg. just `"pipeline:autovideosrc"`. If that works it would exclude one possible problem. I need to do more testing of the GStreamer bindings on native Apple Silicon (currently still doing most stuff with x86\_64 JVM via Rosetta). Might be something awry going on in device discovery, or the way that Processing Video is using that.

---

<div class="post-metadata">

### Author: ![sableraph](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sableraph/32/251_2.png) [@sableraph](https://discourse.processing.org/u/sableraph)
#### Post date: [October 19, 2022, 9:59am UTC](https://discourse.processing.org/t/problem-with-live-video-feed-in-processing/39328/8 "2022-10-19T09:59:00Z")

</div>

> [@neilcsmith](#):
>
> What about without the caps bit too?

Thanks for the suggestion 🙂 However, I’m not sure I understand what you mean. Could you share your version of the line of code in question?

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [October 19, 2022, 10:01am UTC](https://discourse.processing.org/t/problem-with-live-video-feed-in-processing/39328/9 "2022-10-19T10:01:09Z")

</div>

Just -

```auto
cam = new Capture(this, 640, 480, "pipeline:autovideosrc");

```

---

<div class="post-metadata">

### Author: ![sableraph](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sableraph/32/251_2.png) [@sableraph](https://discourse.processing.org/u/sableraph)
#### Post date: [October 19, 2022, 10:15am UTC](https://discourse.processing.org/t/problem-with-live-video-feed-in-processing/39328/10 "2022-10-19T10:15:14Z")

</div>

Thanks! It technically works but the image gets stretched.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/1/a/1a379689a02e061de789a2b0c4c7b622a9b2df06.jpeg)
