Search code examples
macosgstreamergstreamer-1.0

Gstreamer cannot find internal camera on a Mac


I have installed Gstreamer via homebrew on my mac. I want to stream the mac's internal camera's footage, however when I run gst-device-monitor-1.0 I keep getting Probing devices... Failed to start device monitor!

I also tried running the same command with GST_DEBUG=2 and then I get

WARN devicemonitor gstdevicemonitor.c:501:gst_device_monitor_start:<devicemonitor0> No filters have been set, will expose all devices found
0:00:00.002759000 24294 0x7ffc5151c190 WARN devicemonitor gstdevicemonitor.c:507:gst_device_monitor_start:<devicemonitor0> No providers match the current filters

The version I'm running is

gst-device-monitor-1.0 version 1.20.0
GStreamer 1.20.0

How do I get this to work? I have checked the mac settings and I don't see anything that'd block this. How do I make gstreamer see my mac's internal camera?


Solution

  • I have the same problem on my Mac (M1, macOS Monterey). It is issue of gst-device-monitor-1.0. According to its source code it cannot find any corresponding device providers:

      if (monitor->priv->filters->len == 0) {
        GST_WARNING_OBJECT (monitor, "No filters have been set, will expose all "
            "devices found");
        gst_device_monitor_add_filter_unlocked (monitor, NULL, NULL);
      }
    
      if (monitor->priv->providers->len == 0) {
        GST_OBJECT_UNLOCK (monitor);
        GST_WARNING_OBJECT (monitor, "No providers match the current filters");
        return FALSE;
      }
    

    The problem appeared a year ago and has not yet been resolved: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/780 https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/667

    Still gstreamer itself can access video (including mac's internal camera) and audio sources on macOS just fine.

    Video:

    gst-launch-1.0 avfvideosrc device-index=0 ! video/x-raw, framerate=30/1, width=1280, height=720 ! queue ! autovideosink
    

    Audio:

    gst-launch-1.0 -v osxaudiosrc device=0 ! audio/x-raw ! queue ! autoaudiosink
    

    Note: avfvideosrc is part of gst-plugins-bad, osxaudiosrc - part of gst-plugins-good