After recently acquiring a new android smartphone, I’ve become interesting in testing the capabilities of its camera. One concept I’ve been curious to experiment with is live-streaming footage of my 3DS without the usage of a modded console, as I’ve seen this done fairly well. The first step to doing this though requires some setup, which is what I will explain in this guide.To stream footage from an android device to linux, I start with an app called IP Webcam. This allows the camera data to be sent over a network. There are two ways the data can be transferred: Wireless and USB tether. I opt for the USB method, since it should in theory reduce latency and data loss. This also prevents flooding my router with the data transfer. Note though, to accomplish this the USB tether option must be available on the android device. As far as I know this comes standard with recent Android versions (I have Android 5.1 Lollipop).
Once the stream is started, it can be access via the following local address:
Using an application such as VLC player’s network stream option to test this is often effective. Note that the IP address portion is set for a USB tether. If the device is connected via WiFi, the device’s network address will be used in its place.
To capture the stream, it needs to be directed to a video device. Packages for v4l2 (video 4 Linux), and gstreamer are required:
sudo pacmatic -S v4l2loopback-dkms gstreamer0.10-good-plugins
With this, a video loopback device must be loaded into the kernel:
sudo modprobe v4l2loopback
Finally, gstreamer is used to direct the video stream to the loopback device:
gst-launch-0.10 -vt souphttpsrc location='http://192.168.42.129:8080/videofeed' is-live=true ! multipartdemux ! decodebin2 ! v4l2sink device=/dev/videoX
Note that the X in <videoX> should be replaced with the number of the loopback device. In my case, since my laptop already has a webcam set to video0, the device is found in video1.
With this, the device can be used as a normal video device, such as a webcam for Skype, as an example. I plan on using this for streaming, likely by using Open Broadcast Studio for an easier setup, and live video mixing.