Virtual webcam as phone camera in Android Emulator in Linux

It's really useful to be able to emulate a camera when working with an Android Emulator, for example to present a static image on the screen, a real time video, or even stream your desktop.

This can be achieved with WebcamStudio for Linux, and the same results can be achieved in your macOS or OSX installation by using CamTwistStudio.

To install Webcamstudio in Ubuntu, follow these steps:

Then, create your AVD by choosing "Webcam0" as the phone camera, and then, before running your emulated device, run Webcamstudio and choose what you want to stream, press "record", and also press record on the output device (at the right bottom of your screen). You are now streaming directly to your virtual video capture device (aka webcam!).

With CamTwistStudio the procedure is similar, although the interface varies.

NOTE: In order for the emulated phone to use your virtual camera, you have to be streaming BEFORE launching the emulator.