Add time-limit argument (original) (raw)
- I have checked that a similar feature request does not already exist.
Related but not solving my issue:
- stop recording option is not available in scrcpy #1032
- What is the best way to interrupt recording (programmable) in Windows? #818
- stop recording option is not available in scrcpy #1032
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:
start /B scrcpy -Nr test.mp4 && timeout /t 5 /nobreak >nul && taskkill /im scrcpy.exe /f: corrupted file- Python script
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)
- Results: corrupted file with
terminate()andCTRL_BREAK_EVENT, process not terminating withCTR_C_EVENT. In any case, no useful output file - While running scrcpy, send
adb shell pkill <adb process pid>(see What is the best way to interrupt recording (programmable) in Windows? #818 (comment)). Nothing happens.