scrcpy
scrcpy copied to clipboard
Hotkeys for record screen
To record a video I need to run the command:
scrcpy -r file.mkv
This method is inconvenient if the scrcpy is already running and I need to make a video. I will have to return to the console, close the program, enter the command. After recording the video, I will have to close the scrcpy and reopen it without parameters.
I would like to be able to manage the recording of video from the scrcpy, namely
- Start recording
- Pause recording
- Stop recording
For this, I can use third-party software as OBS, but when I test mobile applications in the scrcpy, switching to between different windows is distracting.
The problem for this is UX: how do you pass the filename when you record at any time (possibly several times per session)?
I think you should not ask the user to manually set the file name. It can be automatically generated. For example:
"Scrcpy screen record 2019-03-25 at 7.30.40.mkv"
I think we should add a new parameter to specify the directory for recorded videos.
For example:
scrcpy --record-dir ~/android_videos
Any news regarding this request?
Ref: https://github.com/Genymobile/scrcpy/issues/1186#issuecomment-592386916
Recording may only start on new keyframe (it may not just be "passive", record where you are). To start recording in the middle of the stream, the client must request to the device to generate a new keyframe (typically, just restart the encoding like on device rotation), then ignore all frames received before that keyframe (+ the config packet).
I understand correctly that this method will solve the problem? Should we expect a feature?
Would be nice!
the client must request to the device to generate a new keyframe (typically, just restart the encoding like on device rotation)
Now we have the requestReset method, it should be easier to add a "restart encoding" command?
https://github.com/Genymobile/scrcpy/blob/665ccb32f5306ebd866dc0d99f4d08ed2aeb91c3/server/src/main/java/com/genymobile/scrcpy/video/SurfaceCapture.java#L21
I had experimented it in my internal fork, it works very well, and doesn't affect mirroring at all.
Another use case I got from a developer is streaming the video to multiple clients (using Scrcpy server and a custom client), without such command, newly connected clients won't have a keyframe to start decoding so there will be several seconds of corrupted image.
how do you pass the filename when you record at any time (possibly several times per session)
SDL3 added an API to open a save dialog, so when stopping recording we can ask the user where to save (or discard) it. But it doesn't exist in SDL2, so I think saving to a user specified folder with auto-generated file names is also ok.