Arch Linux Camera – Using MJPG Stream as a Webcam Source

arch linuxcamera

I would like to use my Android smartphone as a webcam and found the app "IP webcam", which creates various outputs of the camera.

One such output is a MJPG stream, and I want to know if there is a way to get this stream to work as a webcam-source on my Arch Linux

I know there is Droidcam, but I just can't get it to work on my machine.

Best Answer

I can't test this because the app crashes on ICS, but this should be possible using v4l2loopback and gstreamer.

Compile and load the v4l2loopback kernel module. Note down the v4l2 device it creates (/dev/videoX).

Then use something like the following:

gst-launch-0.10 -v souphttpsrc location='http://<your_phones_ip>:<port>/' is-live=true user-id=<user> user-pw=<pass> ! multipartdemux ! decodebin2 ! v4l2sink device=/dev/videoX

While the gstreamer pipeline is running, the video should appear in /dev/videoX and the device can be used like a normal webcam.

Related Question