Skip to content

Instantly share code, notes, and snippets.

@frapontillo
Last active September 16, 2021 06:13
Show Gist options
  • Select an option

  • Save frapontillo/03c5cf96bbf41b869a2d159d68176ab8 to your computer and use it in GitHub Desktop.

Select an option

Save frapontillo/03c5cf96bbf41b869a2d159d68176ab8 to your computer and use it in GitHub Desktop.

Revisions

  1. frapontillo revised this gist Sep 16, 2021. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions rec-android.sh
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,6 @@
    #!/bin/bash

    adb shell screenrecord --bit-rate 6000000 /sdcard/$1.mp4 &
    # Get its PID
    PID=$!
    adb shell screenrecord --bit-rate 6000000 /sdcard/$1.mp4 & PID=$!
    # Upon a key press
    read -p "Press [Enter] to stop recording..."
    # Kills the recording process
  2. frapontillo created this gist May 24, 2021.
    17 changes: 17 additions & 0 deletions rec-android.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    #!/bin/bash

    adb shell screenrecord --bit-rate 6000000 /sdcard/$1.mp4 &
    # Get its PID
    PID=$!
    # Upon a key press
    read -p "Press [Enter] to stop recording..."
    # Kills the recording process
    kill $PID
    # Wait for 3 seconds for the device to compile the video
    sleep 3
    # Download the video
    adb pull /sdcard/$1.mp4
    # Delete the video from the device
    adb shell rm /sdcard/$1.mp4
    # Kill background process in case kill PID fails
    trap "kill 0" SIGINT SIGTERM EXIT