1

I would like to access the camera on my (own) Android phone with an USB-cable and Linux Mint. Is there a way I can stream the camera to my Linux without using additional software like Droidcam? If yes, how can I save an image every x seconds?

1 Answer 1

2

When you say without additional software am assuming adb doesn't count.

  1. Install adb
sudo apt update
sudo apt-get install android-tools-adb
  1. Connect your device
  2. Enable USB debugging and file transfer
  3. Make sure your device is recognized by running adb devices. You should see something like this.
List of devices attached
12345678    device
  1. Write the following photo_loop.sh
#!/bin/bash
adb shell am start -a android.media.action.STILL_IMAGE_CAMERA
sleep 3
for number in {1..100}
do
    adb shell input tap 540 1840
    sleep 10
done
adb pull sdcard/DCIM/Camera ./
exit 0
  1. Run it
bash photo_loop.sh

Notes:

  • There might be a better way to do this directly that am not aware of.
  • The script might require adjustments.
  1. 540 1840 correspond to x and y coordinates of the shatter button in the camera. This means you should change the coordinates to match your screen and application.
  2. As you can probably tell the script takes 100 pictures every 10 seconds. You can alter this by changing the for statement and sleep command respectively.
  3. The last command will transfer all photos taken by your camera to your working directory, so you might have to change that if your photos are stored someplace else.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .