Skip to content

Instantly share code, notes, and snippets.

@pfmaggi
Created January 5, 2022 13:08
Show Gist options
  • Save pfmaggi/0ea0fd7c04d08f0781d41d0132f14efa to your computer and use it in GitHub Desktop.
Save pfmaggi/0ea0fd7c04d08f0781d41d0132f14efa to your computer and use it in GitHub Desktop.
#!/bin/bash
DEVICES=`adb devices | grep -v devices | grep device | cut -f 1`
for device in $DEVICES; do
DISPLAYS=`adb -s $device shell dumpsys SurfaceFlinger --display-id | cut -d" " -f 2`
for display in $DISPLAYS; do
echo "Capturing from $display on $device"
output="screen_$(echo $device)_$(echo $display)_$(date +%Y%m%d_%H%M%S).png"
adb -s $device exec-out screencap -p -d $display > $output
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment