Skip to content

Instantly share code, notes, and snippets.

@tgmarinho
Forked from navarrothiago/README.md
Created July 17, 2020 14:40
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tgmarinho/acd22530b4a44a05dd9810bf39402e5a to your computer and use it in GitHub Desktop.
Save tgmarinho/acd22530b4a44a05dd9810bf39402e5a to your computer and use it in GitHub Desktop.
Transform your smartphone camera in a WebCam to make video conference

Transform your smartphone (e.g., Iphone, Samsung, Motorola, etc) camera in a WebCam to make video conference (e.g., Google Meeting, Zoom, Discord, etc).

Setup

Install an app IP camera in your smarthphone

Examples:

Install v4l2loopback

Go to https://github.com/umlaeute/v4l2loopback and see the instructions.
Manjaro Linux users: pamac install v4l2loopback-dkms

Check video devices

ls /dev/video* e.g. output: /dev/video0 /dev/video1

Install OBS Studio

Go to https://obsproject.com/ to get more information.

Install OBS plugin

I used obs-v4l2sink to sink the obs output scenes to the other device created.
Manjaro Linux users: pamac install obs-v4l2sink

Usage

Create two virtual video devices

sudo modprobe v4l2loopback devices=2 video_nr=91,92 exclusive_caps=0,1 OBS:

  • device=2 - 2 capture device (1 to sink to PC and 1 to sink to OBS)
  • video_nr=91,92 - devices ids
  • exclusive_caps=0,1 - only /dev/video92 will be identify by the client (e.g. Google Meeting)

Check the created video devices

ls /dev/video* e.g. output: /dev/video0 /dev/video1 /dev/video91 /dev/video92

Start capture in you smart phone

Open the app in your smartphone and check the ip address. In my case, it shown the IP 192.168.15.5.

Sink video in your first created video device

Open the terminal in your PC and execute:
gst-launch-1.0 souphttpsrc location=http://192.168.15.5:80/live ! jpegdec ! videoconvert ! v4l2sink device=/dev/video91

Obs: Change the ip and the device acording to your configuration.

Open OBS Studio

Open other tab in the terminal and execute obs.

Insert video source

In Sources:

  • click on +
  • select Video Capture Device (V4L2)
  • click on ok
  • On the Device field, select Dummy video device 0
  • click on ok
  • Centralize the added source on the screen

Whooll: you can setup the screen as your wish!!

Sink video in your second created video device

Now, we are going to use the the installed OBS plugin.
In OBS:

  • click on Tools -> v4l2sink -> ok
  • Write on Device Path: /dev/video92 (i.e., the second device created) Now, it will generate a Dummy device 1 (0x0001)

Configure your input video device in your app

e.g., if you are going to use Google Meeting:

Validation setup

  • Iphone 11 iOS 13.5.1 + iPCamera - High-End NetworkCam v1.4 App + Kernel: 5.4.44-1-MANJARO x86_64 + OBS Studio - 25.0.8-1 (linux)

References

FELL FREE TO COMMENT AND CONTRIBUTE

@Briketellen
Copy link

Thanks for this tutorial, I havent known that I can use my smartphones camera for a WebCam) Now join the conference will be easier. Is it works with any device, right? I would like to share this with other group members, so I how to do it for iOS. But can Android users set it up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment