I wanted to use my mobile phone as web cam, because it has a half-way decent camera.
Inspiration: github:bluezio/ipwebcam-gst
Assumes that you have WiFi on your mobile phone
- Install Google Play:IP Webcam on your Android phone
- Configure it (pretty straight-forward) and start the server
- On your Void Linux machine:
sudo xbps-install -S v4l-utils v4l2loopback gst-plugins-good1
sudo depmod -a
# remember current devices
ls /dev/video*
sudo modprobe v4l2loopback
# this should now show 1 more device - the loopback
ls /dev/video*
# start a gstreamer pipeline piping the live feed into the loopback device
# the flags probably could do with some adjustment...
gst-launch-1.0 souphttpsrc location="http://<mobile phone IP>:<configured port>/videofeed" \
do-timestamp=true is-live=true ! \
multipartdemux ! decodebin ! \
videoflip method=horizontal-flip ! videoconvert ! v4l2sink device=/dev/video2
# better quality:
gst-launch-1.0 souphttpsrc location="http://<mobile phone IP>:<configured port>/videofeed" \
do-timestamp=true is-live=true ! \
multipartdemux ! decodebin ! \
videoflip method=horizontal-flip ! videoconvert ! \
videoscale ! videorate ! \
video/x-raw,format=YUY2,width=1280,height=720,framerate=12/1 ! \
v4l2sink device=/dev/video<N>
Once you've done that, you can simply select /dev/video<N>
inside your application (VLC, for example)