-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the best way to interrupt recording (programmable) in Windows? #818
Comments
Yes, it is not good. (note that if you record in
Unfortunately, no good solution. You could kill the |
import subprocess
import time
p = subprocess.Popen(['scrcpy', '--record', 'haha.mkv'])
time.sleep(3)
p.kill() emmm, both of them were broken thoroughly I think.
It works. A little weird but much better than restart adb server at least. Thanks! |
If you record longer (and actually move things on screen), data will be written to the mkv, and it will play in VLC or whatever. With mp4, data will be written, but it will not play. |
ok, thank you :) about how to find the adb shell process which runs the servercheck the cmdline of the process named
for multi devices:
|
You could also kill the process on the device instead:
(assuming it is the only one running) |
BTW,
Scrcpy will use the adb, which was included in prebuilt archives by default (I guess), if you configure scrcpy to $PATH. And if you already have an installed adb on your PC, actually you can not access your phone with this adb directly, because current adb design only supports one adb server connection per adbd. So if you gonna running |
I see the same issue with macOS as well. It will be helpful to have stop method/option with scrcpy to be executed from command line |
On macOS, Ctrl+C should work as expected, doesn't it? |
I implemented a fix for Windows: 28abd98 Please test by replacing these files in the v1.13 release:
|
@rom1v Manually it had no issues. I was able to get it worked on macOs via Java programming. I am looking for linux binary so I could get that installed in my test environment for which I do not have root access. Is it possible that linux binary is available? |
What about docker? #94
Thanks! I will try later. |
Linux binaries must be different for each distrib/version. That's why I don't publish them (but I I provide the prebuilt server, and building from linux is "easy" if you gollow the steps). |
AFAIU, if you perform static compile, then you can have a single build that will work on various distributions/versions. It also means that any and every library that scrcpy uses (client-side, obviously) also needs to be a static library (i.e. either use static version if distribution has it, or build one from source). |
@LBensman Absolutely. A static build would be great, but is not supported for now. If someone want to improve the build system to optionally build sdl and ffmpeg (only the parts scrcpy is using) and link statically, please go ahead. |
@rom1v so the static build feature is closed? Really need it. |
I used this package to solve this problem. https://pypi.org/project/console-ctrl/ command = f"{SCRCPY_PATH} --serial {self.serial} --no-display --record {TMP_PATH}\\file.mp4"
self.record_proc = subprocess.Popen(command,
shell=True,
creationflags=subprocess.CREATE_NEW_CONSOLE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE) def closeEvent(self, event):
if self.record_proc:
if self.record_proc.poll() is None:
console_ctrl.send_ctrl_c(self.record_proc.pid) |
I am looking the same solution for JVM. I want to record the video throught the java code, but killing the cmd process is only corrupting the video file. So I need to figure out how to send the finish recording event to the console throught the java code. I have also tried to kill app_process on the device but the video file is still corrupted. |
I faced to the same question。 would you find any solutions for the issue for JVM? |
:) hi
I can only get a broken video after sending a CTRL_C_EVENT signal to scrcpy process.
And,
disconnect the device
is not a programmable way.I have to restart my adb-server instead (it works), but it may influence other devices.
Any suggestions ~?
The text was updated successfully, but these errors were encountered: