You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
What is the best way to interrupt recording (programmable) in Windows? #818
scrcpy --no-display --record file.mp4
scrcpy -Nr file.mkv
# interrupt recording with Ctrl+C
# Ctrl+C does not terminate properly on Windows, so disconnect the device
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.
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.
For Windows, for simplicity, prebuilt archives with all the dependencies (including adb) are available
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 adb shell pkill app_process, you need to keep only one adb in your $PATH (or, keep a specific order?). What's more, pkill seems to works above android 6 at least.
@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?
@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?
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).
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).
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.
Activity
rom1v commentedon Sep 25, 2019
Yes, it is not good.
(note that if you record in
mkvinstead ofmp4, the video is less broken, since mp4 writes its header at the end – which is then not written)Unfortunately, no good solution.
You could kill the
adb shellprocess which runs the server.williamfzc commentedon Sep 25, 2019
emmm, both of them were broken thoroughly I think.
It works. A little weird but much better than restart adb server at least. Thanks!
rom1v commentedon Sep 25, 2019
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.
williamfzc commentedon Sep 26, 2019
ok, thank you :)
about how to find the adb shell process which runs the server
check the cmdline of the process named
adb.exe. scrcpy's cmdline will always be:for multi devices:
rom1v commentedon Sep 27, 2019
You could also kill the process on the device instead:
(assuming it is the only one running)
williamfzc commentedon Feb 28, 2020
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
adb shell pkill app_process, you need to keep only one adb in your $PATH (or, keep a specific order?). What's more,pkillseems to works above android 6 at least.lbathina commentedon May 6, 2020
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
rom1v commentedon May 6, 2020
On macOS, Ctrl+C should work as expected, doesn't it?
rom1v commentedon May 8, 2020
I implemented a fix for Windows: 28abd98
Please test by replacing these files in the v1.13 release:
scrcpy.exeSHA256: 5c6516793f638d7d2b5ef518b1c59421087e1a3bbc3a1e3ac3a44617b6d2315d
scrcpy-serverSHA256: 6d124307e081b8bbccc478dcf82731aad3cc994e7502197c9bae3847d3169dc7
Properly handle Ctrl+C on Windows
lbathina commentedon May 8, 2020
@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?
williamfzc commentedon May 8, 2020
What about docker? #94
Thanks! I will try later.
rom1v commentedon May 8, 2020
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).
LBensman commentedon May 8, 2020
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).
rom1v commentedon May 8, 2020
@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.
walkthunder commentedon Feb 11, 2021
@rom1v so the static build feature is closed? Really need it.
k-inoway commentedon Oct 19, 2021
I used this package to solve this problem.
A portion of the code is also attached for reference.
I hope this helps. :)
https://pypi.org/project/console-ctrl/
pomidorum1989 commentedon Oct 13, 2022
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.
cjjdream commentedon Feb 23, 2023
I faced to the same question。 would you find any solutions for the issue for JVM?