5

I would like to create a virtual camera device using gstreamer on OSX

I am able to create it on *nix systems using

 gst-launch-1.0 -v videotestsrc pattern=snow ! video/x-raw,width=1280,height=720 ! v4l2sink device=/dev/video1

On osx I get a erroneous pipeline v4l2

I would like to be able to pipe the output into applications such as skype etc.,

Any pointers in this direction ? Should I use syphon?

Pavan K
  • 4,085
  • 8
  • 41
  • 72

2 Answers2

3

The way to go is to use CoreMediaIO framework. You can create a virtual device using the framework and feed in any stream using a wrapper. Some pointers for wrappers can be seen here.

Pavan K
  • 4,085
  • 8
  • 41
  • 72
  • @RoyShilkrot I posted the question and I did post the answer to my question. The answer has 2 code sample projects listed which solve the problem if you had taken the time to look. The sample project from CoreMediaIO creates a new virtual camera device and that device can be fed input. The second project shows an example how to feed an input into the created virtual device. – Pavan K Jun 21 '18 at 23:04
2

This gstreamer command:

./gst-launch-1.0 -v videotestsrc pattern=snow ! video/x-raw,width=1280,height=720 ! osxvideosink

Works on OSX Sierra if you install Gstreamer on OSX from the following packages which will install in the /Library/Frameworks/Gstreamer.framework/ folder. Execute commands from the Commands subfolder.

https://gstreamer.freedesktop.org/data/pkg/osx/1.12.0/

This link has a standard package, a development package and a dmg with lots of smaller distribution packages. To pipe output you will need to choose an appropriate sink - either appsink, and write it yourself, or one of the many other sink types in Gstreamer. Hope that gets you started!

Markw63
  • 71
  • 8
  • I can see the video on a window using this. However, I would like to pump the video into other applications such as skype. I would like to do something like camtwist – Pavan K Jun 01 '17 at 10:50
  • Well on Gstreamer, the method is appsink, per the examples. Or a standard sink element ( see docs), or copy one of the elements and push the buffers yourself into your app if you want to add effects. Gstreamer requires some serious reading to get into it I am afraid. – Markw63 Jun 01 '17 at 19:02
  • Yup I figured out the route. – Pavan K Jun 02 '17 at 09:48
  • @PavanK I know this thread is very old, but could you explain what route you took? – Jaiyam Sharma Aug 07 '21 at 03:21