How can I get video capture from a virtual webcam?

I want to use the processing video library (or another library) to receive a video stream of my OBS virtualcam. However printArray(Capture.list()); only returns the physical webcam, and not the video stream I need created by OBS (open broadcasting software). I tried looking at ipcapture, but it wants an ip address for the mpeg stream.

3 Likes

DID you solved it ?
HELP

im certainly no expert on this, but does this not cover the requirements?

it suggests using obs studio which seemingly provides video capture.

1 Like

was this ever solved? i have the same problem, cant get the obs virtual camera as video input into processing. it is not recognized as camera (or anything else) although other programs (zoom, chrome, etc.) do recognize it as if it were a piece of connected hardware.

1 Like

Did anybody ever solve it? OBS virtual camera shows as a normal webcam in other softwares (Discord) but not Processing.

Hello @AtrashDingDong,

It works here with:

Processing 4.3
https://processing.org/

GStreamer 1.24.3 < I could see the virtual cams in the Capture.list() once I installed this!
https://gstreamer.freedesktop.org/

OBS Studio 30.1.2 (64 bit) < Comes with a virtual camera!
https://obsproject.com/

OBS VirtualCam 2.0.5 < This is NOT needed! Here for reference only.
OBS Virtualcam | OBS Forums

NOTE: There is a note on the link above that recommends another solution which also worked:
Virtual Cam Filter | OBS Forums

:)

1 Like

Hello @glv , I followed your instructions to set it up, but I still cannot read the OBS virtual cam.

On both Win11 and Mac OS, I get the message BaseSrc: [mfvideosrc0] : Internal data stream error.

Is there anything else I need to pay attention to?

Hello @niuuin,

I did a fresh install of OBS Studio and the steps below worked for me.

I am using:

  • W10
  • Processing 4.3.1
  • OBS Studio 31.0.0(64 bit)
  • GStreamer 1.24.10

No other plugins required!

Steps using OBS Studio:

  • Stop the Virtual Camera
  • Open Tools > Auto-Configuration Wizard
  • Select I will only be using the virtual camera
  • Start the Virtual Camera

It only works if you install GStreamer.

You must select the correct camera:

:)

Hello folks!

Can someone please test this on their system(s):

Processing code (modified one of examples):

/**
 * CustomPipeline 
 * by Andres Colubri. 
 * 
 * Create a Capture object with a pipeline description to 
 * get video from non-standard sources.
 */

// This was modified below by GLV:

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:");
    printArray(cameras);
    
    // The camera can be initialized directly using an 
    // element from the array returned by list():
    cam = new Capture(this, cameras[7]);   
    cam.start(); 
    }      
  }

void draw() 
  {
  if (cam.available() == true) 
    {
    cam.read();
    }
  image(cam, 0, 0, width, height);
  }

Please provide a detailed list of your hardware and software.

I am using:

  • W10
  • Processing 4.3.1
  • OBS Studio 31.0.0(64 bit)
  • GStreamer 1.24.10

I also opened an issue here:

It works here for me:

Thanks!

:)