scrcpy
scrcpy copied to clipboard
Using ^C to stop mp4 recording corrupts file (windows)
- OS: [Windows.]
- Scrcpy version: [2.7]
- Installation method: [windows release]
- Device model: [Galaxy S23]
- Android version: [14]
Describe the bug
When finishing with ^C recording, it says it completed but the file is corrupt when choosing mp4 method. mkv doesn't produce this bug but it produces jagged quality in the first few seconds. I tried using adb to kill the process but it keeps recording when trying to do that. Corruption not always occurs but around 50% of the time
Do you use "Windows Terminal"? https://github.com/Genymobile/scrcpy/issues/5122#issuecomment-2265289619
I tried using adb to kill the process but it keeps recording when trying to do that.
That's should not be possible. if you kill adb, then scrcpy terminates, and this terminates the recording.
Please post a whole console output when you kill adb (also include the command you executed).
Does it work correctly when you close the scrcpy window (not the terminal)?
Nevermind, seems like all I had to do is taskkill adb.exe
But the best is to close the scrcpy window.
Ctrl+c should also work in theory, but not with Windows terminal for some reason.
Ctrl C in the console window works 50% of the time, the other 50% in windows it corrupts the header of the mp4. I am waiting for the --time-limit on your next version, until then I have to make my own GUI to stop recording
Ctrl+c should also work in theory, but not with Windows terminal for some reason.
Ctrl C in the console window works 50% of the time
When I say that it does not work, I mean that it abruptly kills the process (which is never ok), instead of sending the equivalent of SIGINT so that the process terminates gracefully and scrcpy can finish running properly.
I am waiting for the --time-limit on your next version
You can use the binary from #5370, it includes the time-limit fix (afbaf59abba79a79ab6f4c659ff3d832e02a8e7f).
I am waiting for the --time-limit on your next version
You can use the binary from #5370, it includes the time-limit fix (afbaf59).
Thank you, I didn't know I can download it. This will be very useful.
Please also test interrupting using Ctrl+c with this version: https://github.com/Genymobile/scrcpy/issues/5122#issuecomment-2408888597
That will help to fix the problem.
Ctrl C does not always work, I try using it and sometimes it reacts, sometimes it just keeps recording until i manually close the window. Last time I closed the window the file was corrupted. But the time--limit works perfectly.
Ctrl C does not always work
Even with the version I published this morning here? https://github.com/Genymobile/scrcpy/issues/5122#issuecomment-2408888597 (on that version, time-limit will still be broken though)
I am waiting for the --time-limit on your next version
You can use the binary from #5370, it includes the time-limit fix (afbaf59).
With this version
With this version
No, as a test to fix recording interruption on Windows, I'd like you to test https://github.com/Genymobile/scrcpy/issues/5122#issuecomment-2408888597 please.
Ok i'll give it a test soon when I'm done recording some stuff that needs time-limit
As of now after testing, ^C works fine when directly running scrcpy.exe, but still corrupts if used in console window through cmd.exe sometimes. So basically it needs to be directly running and not through a cmd window for some reason.
Thank you for your tests. Is your terminal "Windows terminal" (like in the videos in https://github.com/Genymobile/scrcpy/issues/5122#issuecomment-2242503206), or the old default console (https://github.com/Genymobile/scrcpy/issues/5122#issuecomment-2265153630)?
It's not Windows Terminal, it's cmd.exe
OK. Do you get the line Recording complete to mp4 file: file.mp4 at the end when you press Ctrl+c after running scrcpy --record=file.mp4?
Yes, I get that line, but 50% of the time (maybe more) its corrupted, unplayable Does not happen with mkv however the mkv has jagged/scrambled display on the first few seconds.
Yes, I get that line
Oh ok, that's a different problem then.
Could you please post such a corrupted file?
Sure, I'll post one when I get home tonight.
https://github.com/user-attachments/assets/2ef66425-dc4b-4d06-bd04-983a723a6c40
OK, that's very strange if Recording complete to mp4 file: file.mp4 is correctly printed.
Can you reproduce the problem if you close the scrcpy window?
It depends on if I run it through cmd or directly through the .exe What do you want to test? Maybe just contact me on discord so we can test it live, if you want. EvilLurker
I am using it on Mac, and the file is always corrupt if I record a long video. The short video is fine.
How do you stop recording on your mac? DO NOT close the console (i.e. do not abruptly kill the app), but either close the scrcpy window or Ctrl+c in the console.
How do you stop recording on your mac? DO NOT close the console (i.e. do not abruptly kill the app), but either close the scrcpy window or Ctrl+c in the console.
I tried "close app window" and "ctrl+c", but the results were the same. My long videos are normally 3 hours sessions.
What's the output in the console when you close scrcpy? (in particular the log about recording)