-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
Added Save Screenshot #2040
base: dev
Are you sure you want to change the base?
Added Save Screenshot #2040
Conversation
Pressing the MOD + Q key will save a screenshot the next time the screen is rendered. It saves a PNG file with a date time stamp filename. It uses lodepng to encode the file. Thanks Lode Vandevenne (https://github.com/lvandeve/lodepng) The save_screenshot function has been modified from user1902824 (https://stackoverflow.com/questions/34255820/save-sdl-texture-to-file) Limitations. If 2 screenshots are taken within the same second, the file name will be the same and the first file will be overwritten Does not handle client side screen rotation.
Thank you for working on this. This is a feature often requested (#684), and it is not trivial.
Why not the current frame immediately? (if the screen content does not change, the next frame could be sent seconds or minutes later in theory) I have several general remarks. This PR adds a dependency (lodepng). Scrcpy already depends on FFmpeg, which can encode images, so I'd prefer to use FFmpeg. This is far less straightforward, but this avoids a separate image encoder (I have pending work for decoding images too). Btw, since the input picture is already compressed (it comes from a H.264 stream), it would be better to save it to JPG than PNG (lossless is unnecessary on a lossy input). Also, encoding a picture takes time: it should not be done on the UI thread, but on a separate thread. I think that it would be more straightforward to encode the content of the decoded frame (the rendering frame in Regards |
Also came here to add that instant screenshot would be amazing to add. It's probably the only feature missing from this amazing program at the moment. |
If I press a key mod + Q, it doesn't take a screenshot. What could be the reason? My version: scrcpy v1.17 on Jan 2. |
This PR has not been merged. You can build scrcpy based on this PR manually to include this feature. |
Can you help me with how I can do it? I'd be grateful for. |
You will need to build scrcpy from my PR. |
7e8a942
to
c0de365
Compare
This could be a convenient solution so don't have to go through different commands for screenshots. |
How we can build with this PR? |
Pressing the MOD + Q key will save a screenshot the next time the screen is rendered.
It saves a PNG file with a date time stamp filename.
It uses lodepng to encode the file. Thanks Lode Vandevenne (https://github.com/lvandeve/lodepng)
The save_screenshot function has been modified from user1902824 (https://stackoverflow.com/questions/34255820/save-sdl-texture-to-file)
Limitations.
If 2 screenshots are taken within the same second, the file name will be the same and the first file will be overwritten
Does not handle client side screen rotation.