Requests: GetStreamScreenshot
Description
Adds a new request called GetStreamScreenshot which returns a Base64-encoded screenshot of the stream (program).
Motivation and Context
I require this feature for a remote production where I cannot use remote desktop software to see the actual program in real time. Currently there is no way to take a screenshot of the program, which is "immutable" until the transition button is pressed. This feature allows you to take a screenshot of the main texture frame (which also contains stinger transitions). This PR also closes #1130.
https://github.com/obsproject/obs-websocket/assets/6547306/e28a7131-cca6-4fa0-9525-538d417e9759
How Has This Been Tested?
Tested OS(s): Windows 11 22H2 22621.2715
I checked out the obs-studio repository, followed the build instructions, made changes to the plugins\obs-websocket folder, and built obs-studio to test my changes. Since this is mostly copy/paste from the source screenshot request with tweaks to capture the main texture, I expect no problems.
Types of changes
- New request/event (non-breaking)
Checklist:
- [x] I have read the Contributing Guidelines.
- [x] All commit messages are properly formatted and commits squashed where appropriate.
- [x] My code is not on
masteror arelease/*branch. - [x] The code has been tested.
- [x] I have included updates to all appropriate documentation.
Is there anything blocking this?
Hi, I want to get stream screenshot of the scene, how should I modify it, because the current function is to get the current stream, when I have more than one scene, he can only get the current stream.
Hi, I want to get stream screenshot of the scene, how should I modify it, because the current function is to get the current stream, when I have more than one scene, he can only get the current stream.
This is out of the topic but use GetSourceScreenshot.
Even if the request GetStreamScreenshot is not implemented, user can retrieve the screenshot by two steps; GetCurrentProgramScene and GetSourceScreenshot. Though the transition cannot be captured, assuming transition takes not a long period of time and the request won't be called frequently, I don't think there is much difference. So, I don't think this PR is necessary. In my opinion, if the request is called frequently, pipelined implementation to stage the texture and other encodings such as H.264 would be preferable.
There is a significant discrepancy between using GetCurrentProgramScene and GetSourceScreenshot. The screenshot may not accurately reflect the current program content, especially if the source is being edited while the program scene remains static. This can lead to missleading displaying of programm content using both requests, which is why this PR is necessary to address the behavior.
I agree that for frequent calls, a pipelined implementation to stage the texture or use encodings like H.264 would be ideal. However, I’ve already encountered challenges with this implementation (as I am not an experienced C programmer), and if further optimization is required, I will definitely need assistance here.
Curious what the status is on this. Very much looking forward to this feature.
@Lombra There is help wanted. I cannot further improve the code from the feedback that @norihiro provided.