Add time-limit argument (original) (raw)

Related but not solving my issue:

Is your feature request related to a problem? Please describe.
I am trying to automate the acquisition of videos from an android phone which can last for hours.
I know how long the recording should be, so something like adb screenrecord --time-limit would be great (see here)

Describe the solution you'd like
Something similar to adb screenrecord --time-limit=S <file> would be great (see here), where S is the amount of time in seconds of the desired recording duration.

Describe alternatives you've considered
My automation system is only working on windows, unfortunately.
I tried interrupting the scrcpy process after a fixed amount of time in multiple ways but it is either not stopping or produces a corrupted video file.

Tests:

import subprocess, signal, time

proc = subprocess.Popen(["scrcpy", "-Nr", "test.mp4"], creationflags=subprocess.CREATE_NEW_PROCESS_GROUP) print("sleeping") time.sleep(5) print("terminating") proc.terminate() # also tried proc.send_signal(signal.CTRL_C_EVENT) and proc.send_signal(signal.CTRL_BREAK_EVENT)