# Capture: How to solve "same name" issue with multiple cameras on linux?

**URL:** <https://discourse.processing.org/t/capture-how-to-solve-same-name-issue-with-multiple-cameras-on-linux/4805>\
**Category:** Libraries\
**Created:** [October 24, 2018, 11:20am UTC](https://discourse.processing.org/t/capture-how-to-solve-same-name-issue-with-multiple-cameras-on-linux/4805 "2018-10-24T11:20:47Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![LFSaw](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lfsaw/32/2069_2.png) [@LFSaw](https://discourse.processing.org/u/LFSaw)\
**Post date:** [October 24, 2018, 11:20am UTC](https://discourse.processing.org/t/capture-how-to-solve-same-name-issue-with-multiple-cameras-on-linux/4805/1 "2018-10-24T11:20:47Z")

</div>

Hey there, first post 🙂

I am trying to make available 2 PSEYE cameras on an Ubuntu linux machine. Unfortunately, they show up with the same name and using

```auto
  String[] cameras = Capture.list();

  for (int i = 0; i < numCams; ++i) {
    cams[i] = new Capture(this, camWidth, camHeight, cameras[i], camFps);
    cams[i].start();
  }

```

does not yield in the right behaviour.  
Looking at the sourcecode of the Capture constructor shows me that it only searches for the first occurrence of the name and returns that object.

AFICS a constructor that lets me directly access the object at the _index_ of the list would solve the problem, however, I am not at all experienced in writing/adapting processing libraries.

Any help much appreciated, I am happy to test out possible solutions or even install/configure eclipse if someone could guide me through the necessary steps!

Btw, here is the corresponding issue:

> <https://github.com/processing/processing-video/issues/68>

---

<div class="post-metadata">

**Author:** ![hamoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hamoid/32/58_2.png) [@hamoid](https://discourse.processing.org/u/hamoid)\
**Post date:** [October 24, 2018, 11:58am UTC](https://discourse.processing.org/t/capture-how-to-solve-same-name-issue-with-multiple-cameras-on-linux/4805/2 "2018-10-24T11:58:58Z")

</div>

Hi! Welcome to the forum 🙂

In case you want to try building it, you could

```
git clone https://github.com/processing/processing-video.git

```

to download the source code to the current folder in your shell.

```
sudo apt install ant

```

if you don’t have ant yet. Finally

```
ant build

```

which should build the library as a jar binary. I don’t remember if you then have to copy the produced library (which might be in a sub folder) to the Processing libraries folder, replacing the existing one and then restart your sketch.

@neilcsmith Does Praxislive work around this issue somehow? Or does it use the Processing Video library as it is?

---

<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 24, 2018, 2:00pm UTC](https://discourse.processing.org/t/capture-how-to-solve-same-name-issue-with-multiple-cameras-on-linux/4805/3 "2018-10-24T14:00:31Z")

</div>

> [@hamoid](#):
>
> Does Praxislive work around this issue somehow? Or does it use the Processing Video library as it is?

PraxisLIVE has its own video library built directly on top of the GStreamer bindings. It doesn’t have this problem because you can set any GStreamer elements you want as a source, but defaults to device indexes on Linux. It’s also more efficient (than v2 beta) as it passes video buffers directly from GStreamer to the texture upload.

This video support might make it back to Processing. In the meantime @LFSaw why not give Processing a whirl in PraxisLIVE instead?! 😄

---

<div class="post-metadata">

**Author:** ![LFSaw](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lfsaw/32/2069_2.png) [@LFSaw](https://discourse.processing.org/u/LFSaw)\
**Post date:** [October 24, 2018, 2:16pm UTC](https://discourse.processing.org/t/capture-how-to-solve-same-name-issue-with-multiple-cameras-on-linux/4805/4 "2018-10-24T14:16:06Z")

</div>

Thanks for all the heads up!

I am not aware of PraxisLIVE yet, but, since I work with PS Eyes, I found a solution to my problem by the Java-port of the [PS3EYEDriver project by diwi](https://github.com/diwi/PS3Eye). This library also works on OSX (where the gstreamer-based implementation is creating a NULLpointer exception for even a single PS3Eye).

However, I could imagine that this seemingly “trivial to implement” feature for the `Capture` class might be worth looking into.

---

<div class="post-metadata">

**Author:** ![LFSaw](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lfsaw/32/2069_2.png) [@LFSaw](https://discourse.processing.org/u/LFSaw)\
**Post date:** [October 24, 2018, 2:16pm UTC](https://discourse.processing.org/t/capture-how-to-solve-same-name-issue-with-multiple-cameras-on-linux/4805/5 "2018-10-24T14:16:46Z")

</div>

Thanks hamoid, when I am in need to adapt libraries again, I’ll give this a whirl. much appreciated!

---

<div class="post-metadata">

**Author:** ![LFSaw](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lfsaw/32/2069_2.png) [@LFSaw](https://discourse.processing.org/u/LFSaw)\
**Post date:** [March 15, 2019, 3:14pm UTC](https://discourse.processing.org/t/capture-how-to-solve-same-name-issue-with-multiple-cameras-on-linux/4805/6 "2019-03-15T15:14:20Z")

</div>

Small update on this in case people are trying to use `PS3Eye` on OSX 10.14: [https://github.com/diwi/PS3Eye/issues/4](https://github.com/diwi/PS3Eye/issues/4)

---

<div class="post-metadata">

**Author:** ![LFSaw](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lfsaw/32/2069_2.png) [@LFSaw](https://discourse.processing.org/u/LFSaw)\
**Post date:** [March 15, 2019, 3:17pm UTC](https://discourse.processing.org/t/capture-how-to-solve-same-name-issue-with-multiple-cameras-on-linux/4805/7 "2019-03-15T15:17:12Z")

</div>

in case someone is interested here is what I used this info for:

Access webcams as simple light sensor arrays, values forwarded as OSC messages: [https://github.com/tai-studio/light2osc](https://github.com/tai-studio/light2osc)

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [March 15, 2019, 3:24pm UTC](https://discourse.processing.org/t/capture-how-to-solve-same-name-issue-with-multiple-cameras-on-linux/4805/8 "2019-03-15T15:24:12Z")

</div>

i am little bit confused about that error on that numbers,

```auto
short VENDOR_ID_hex = 0x1415;
short VENDOR_ID = 5141;
if ( VENDOR_ID_hex == VENDOR_ID ) println("SAME!");

```

can you check again?

---

<div class="post-metadata">

**Author:** ![LFSaw](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lfsaw/32/2069_2.png) [@LFSaw](https://discourse.processing.org/u/LFSaw)\
**Post date:** [March 15, 2019, 3:32pm UTC](https://discourse.processing.org/t/capture-how-to-solve-same-name-issue-with-multiple-cameras-on-linux/4805/9 "2019-03-15T15:32:26Z")

</div>

hmm… this is _really_ weird… I did not really check the hex-codes (they are both the same…) but interestingly, changing something in the class file (the two lines) magically made the camera work…  
This is literally the only thing I changed.

Now, changing it back (obviously) results in the code perfectly working… My java (jar/compile/\*) knowledge is nearly non-existing, could it be that touching the code overwrites the `.jar` file (sitting somwhere in the package)?

---

<div class="post-metadata">

**Author:** ![hamoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hamoid/32/58_2.png) [@hamoid](https://discourse.processing.org/u/hamoid)\
**Post date:** [March 15, 2019, 7:51pm UTC](https://discourse.processing.org/t/capture-how-to-solve-same-name-issue-with-multiple-cameras-on-linux/4805/10 "2019-03-15T19:51:11Z")

</div>

Will there be a video showing it in action? 🙂

---

<div class="post-metadata">

**Author:** ![colin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/colin/32/230_2.png) [@colin](https://discourse.processing.org/u/colin)\
**Post date:** [April 29, 2019, 8:42am UTC](https://discourse.processing.org/t/capture-how-to-solve-same-name-issue-with-multiple-cameras-on-linux/4805/11 "2019-04-29T08:42:51Z")

</div>

Hi @LFSaw, did you fix your issue ? If so, how did you fix it ?  
I encounter the exact same problem on Linux. 😶
