screenpipe icon indicating copy to clipboard operation
screenpipe copied to clipboard

[bounty] $1000 make RDP work

Open louis030195 opened this issue 1 year ago • 24 comments

current status:

i did a large part of the work here: https://github.com/mediar-ai/screenpipe/pull/686

but something is not working:

screenshots are showing my own screen instead of the connected users' screen

image

i properly am able to list sessions, get tokens, etc. but then it fails - tried both in python and in rust, same issue

definition of done:

make one of those bins work

https://github.com/mediar-ai/screenpipe/pull/686/files#diff-5f59a0279ffec923a1f389f4ec443da49d2e0bcf4de83d0f154a0a8ccf5d4e16

https://github.com/mediar-ai/screenpipe/pull/686/files#diff-62d7d5d81348edcf32b86ef4546e79b86bc50b7c1fa580f011426c5acc4f9569

eg:

  • screenpipe runs on a Windows 22 server
  • n clients connect to it through Microsoft Remote Desktop, each seeing their own user/session/screen
  • screenpipe capture each client screen/session (and not the local server screen)

you can send a new PR if you want - copy pasting my code and making it work

i can do the plumbing to the rest of the code (which is the easy part)

PS: it's a screenpipe enterprise solution, not related to our main codebase

/bounty 1000

louis030195 avatar Dec 05 '24 19:12 louis030195

💎 $1,000 bounty • screenpi.pe

Steps to solve:

  1. Start working: Comment /attempt #850 with your implementation plan
  2. Submit work: Create a pull request including /claim #850 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

❗ Important guidelines:

  • To claim a bounty, you need to provide a short demo video of your changes in your pull request
  • If anything is unclear, ask for clarification before starting as this will help avoid potential rework
  • Low quality AI PRs will not receive review and will be closed
  • Do not ask to be assigned unless you've contributed before

Thank you for contributing to mediar-ai/screenpipe!

Attempt Started (UTC) Solution Actions
🟢 @gerred Jan 02, 2025, 11:35:52 PM WIP
🟢 @nikxe Dec 06, 2024, 01:17:26 PM WIP
🟢 @RafaelJohn9 Jan 15, 2025, 07:26:53 AM WIP
🟢 @Neptune650 Jan 17, 2025, 04:00:24 AM #1163 Reward
🟢 @CorrM Sep 18, 2025, 03:49:44 AM #1967 Reward
🟢 @Raxephion Feb 20, 2025, 11:03:38 AM WIP
🟢 @rhysqi Mar 26, 2025, 09:21:12 AM #1683 Reward

algora-pbc[bot] avatar Dec 05 '24 21:12 algora-pbc[bot]

current status:

i did a large part of the work here: #686

but something is not working:

screenshots are showing my own screen instead of the connected users' screen

image

i properly am able to list sessions, get tokens, etc. but then it fails - tried both in python and in rust, same issue

definition of done:

make one of those bins work

https://github.com/mediar-ai/screenpipe/pull/686/files#diff-5f59a0279ffec923a1f389f4ec443da49d2e0bcf4de83d0f154a0a8ccf5d4e16

https://github.com/mediar-ai/screenpipe/pull/686/files#diff-62d7d5d81348edcf32b86ef4546e79b86bc50b7c1fa580f011426c5acc4f9569

eg:

* screenpipe runs on a Windows 22 server

* n clients connect to it through Microsoft Remote Desktop, each seeing their own user/session/screen

* screenpipe capture each client screen/session (and not the local server screen)

you can send a new PR if you want - copy pasting my code and making it work

i can do the plumbing to the rest of the code (which is the easy part)

PS: it's a screenpipe enterprise solution, not related to our main codebase

/bounty 1000

@louis030195 So if I understand correctly, one of the 3 users connects to the RDP server but does whatever work on their local machine, and screenpipe in the server will capture what each user is doing in their local machine and register it separately.

Doesn't this mean the server will need to be able to see the client's screen? Then wouldn't we need to do it the other way around? I.e. the server connects through RDP to the user machines, and captures the RDP contents.

Neptune650 avatar Dec 05 '24 22:12 Neptune650

@Neptune650 there is supposedly an API to just get the stream of user screen

because most of the time cloud desktop, like cloud gaming, etc. is just streaming the server OS to the local computer

louis030195 avatar Dec 05 '24 23:12 louis030195

@Neptune650 there is supposedly an API to just get the stream of user screen

because most of the time cloud desktop, like cloud gaming, etc. is just streaming the server OS to the local computer

@louis030195 btw, the "rdp2" program and screenpipe both run on the server? Or rdp2 runs on the client? We can talk over telegram if you'd like.

Neptune650 avatar Dec 05 '24 23:12 Neptune650

/attempt #850

Algora profile Completed bounties Tech Active attempts Options
@nikhilxe 1 bounty from 1 project
C++, JavaScript,
CSS & more
Cancel attempt

nikxe avatar Dec 06 '24 13:12 nikxe

@louis030195 I don't think it would be straight-forward due to Windows restrictions.

My only guess to achieve this is, we need to add run-as-service feature to the app, then run/install rdp2.exe as a service eg. rdp2.exe --service. Listen to user logon events, and on every new user logon, execute itself i.e rdp2.exe again, but in the respective user session context.

So there will be one process running as service and then one process each for every user session.

rdp2.exe --service (Service) |_ rdp2.exe (User 1) |_ rdp2.exe (User 2) |_ rdp2.exe (User 3)

This approach should definitely work

PS: Also need to ensure, rdp2.exe is in a Path that is accessible to other users as well, like %PROGRAMFILES%, and have execute permission for user group.

Antony007 avatar Dec 09 '24 17:12 Antony007

@Neptune650 there is supposedly an API to just get the stream of user screen because most of the time cloud desktop, like cloud gaming, etc. is just streaming the server OS to the local computer

@louis030195 btw, the "rdp2" program and screenpipe both run on the server? Or rdp2 runs on the client? We can talk over telegram if you'd like.

yes i just run rdp2 or rdp on the server

https://screen-record.com/ is able to record users' sessions without having to do anything on the client side

other thing to try https://gist.github.com/louis030195/e17d4b3c637928b89358c6816e461150

louis030195 avatar Dec 09 '24 18:12 louis030195

other thing to try https://gist.github.com/louis030195/e17d4b3c637928b89358c6816e461150

@louis030195 This solution most probably won't work from my experience¹, since RDP itself uses Windows Desktop Duplication API behind the scenes, and it takes exclusive control, preventing other applications from accessing the duplication API while the RDP session is active.

¹ Unless they have changed this behaviour in the latest Windows updates.

Antony007 avatar Dec 09 '24 18:12 Antony007

other thing to try https://gist.github.com/louis030195/e17d4b3c637928b89358c6816e461150

@louis030195 This solution most probably won't work from my experience¹, since RDP itself uses Windows Desktop Duplication API behind the scenes, and it takes exclusive control, preventing other applications from accessing the duplication API while the RDP session is active.

¹ Unless they have changed this behaviour in the latest Windows updates.

@louis030195 Antony is right; to actually record the user’s sessions, you would need a service in users’ client. Honestly, we can try to use fibers for that purpose to not be detected by kernel, thus not showing up in the process window. Fibers are a legit security issue in the Windows design part, but it can be used like this. But it needs to be attached to a process to work. So, I am not sure if it's possible with sandboxing of modern applications, and this goes straight into malware territory. But I think they just record the user by not showing themselves in the process manager using a similar method, then send the data in-real time.

To record multiple remote desktop sessions on a server like Windows Server 2022, you can capture each session's screen individually. This is done using the server's built-in tools to record each user's desktop separately. Thus, the cloud gaming.

zelosleone avatar Dec 21 '24 11:12 zelosleone

@Neptune650 there is supposedly an API to just get the stream of user screen because most of the time cloud desktop, like cloud gaming, etc. is just streaming the server OS to the local computer

@louis030195 btw, the "rdp2" program and screenpipe both run on the server? Or rdp2 runs on the client? We can talk over telegram if you'd like.

yes i just run rdp2 or rdp on the server

https://screen-record.com/ is able to record users' sessions without having to do anything on the client side

other thing to try https://gist.github.com/louis030195/e17d4b3c637928b89358c6816e461150

(*dxgi_factory).EnumAdapters1(0, &mut adapter);
if adapter.is_null() {
    return Err("Failed to find DXGI Adapter".into());
}

You are trying to access the wrong driver here. You need to use Microsoft's "Remote Display" driver instead. It wouldn't make sense to try to reach the physical driver of another device from your device.

return Err("Failed to duplicate output".into());

Duplication is not enabled by default for remote displays. Because simply, there is no "real" desktop to capture, and since it will 100% of the time fail, it's going to return your own physical desktop because of AcquireNextFrame

I wasn't sure if I should /-attempt on this, as someone else already started. However, I'll provide feedback anyways.

zelosleone avatar Dec 21 '24 11:12 zelosleone

@zelosleone not sure to understand,

To record multiple remote desktop sessions on a server like Windows Server 2022, you can capture each session's screen individually. This is done using the server's built-in tools to record each user's desktop separately. Thus, the cloud gaming.

what do you mean by that? which API is used in this case?

louis030195 avatar Dec 21 '24 15:12 louis030195

@zelosleone not sure to understand,

To record multiple remote desktop sessions on a server like Windows Server 2022, you can capture each session's screen individually. This is done using the server's built-in tools to record each user's desktop separately. Thus, the cloud gaming.

what do you mean by that? which API is used in this case?

https://learn.microsoft.com/en-us/windows/win32/termserv/terminal-services-api WTSVirtualChannelQuery and WTSQuerySessionInformationW via Remote Desktop Services API

zelosleone avatar Dec 21 '24 16:12 zelosleone

@zelosleone that's exactly what i did first but it was only capturing local machine instead of users:

https://github.com/mediar-ai/screenpipe/pull/686/files#diff-5f59a0279ffec923a1f389f4ec443da49d2e0bcf4de83d0f154a0a8ccf5d4e16

louis030195 avatar Dec 21 '24 16:12 louis030195

/attempt

9bany avatar Dec 30 '24 10:12 9bany

/attempt #850

Options

gerred avatar Jan 02 '25 23:01 gerred

/attempt #850

Options

RafaelJohn9 avatar Jan 15 '25 07:01 RafaelJohn9

💡 @Neptune650 submitted a pull request that claims the bounty. You can visit your bounty board to reward.

algora-pbc[bot] avatar Jan 17 '25 04:01 algora-pbc[bot]

Hey @louis030195 ,

What am not getting is do you want to take a screencapture of the full's client's desktop screen, or the client's RDP session screen, because the first is not possible without having a client's side app

In https://screen-record.com/ they have a light weight app, on the client side to manage this

RafaelJohn9 avatar Jan 20 '25 13:01 RafaelJohn9

/attempt #850

Options

Raxephion avatar Feb 20 '25 11:02 Raxephion

💡 @rhysqi submitted a pull request that claims the bounty. You can visit your bounty board to reward.

algora-pbc[bot] avatar Mar 26 '25 09:03 algora-pbc[bot]

@louis030195 Hello, i dont know about RDP, and im new to Rust, but i think you probably can solve it this way:

  • Transmit the PrtSc key via RDP
  • Share the clipboard via RDP. I guess PrtSc saves the image in some format that you can convert into image in server instead of using an image editor.

If it solves your issue i would like to get like 100 or 200usd if you can, i need money, anyway i know a lot about programming and stuff, be kind with me and i will give you feedback, and im learning rust. I have been coding since 11 years ago, but im new in rust and windows apis. Thank you so much, send to binance using my email [email protected]

AgCaliva avatar Aug 10 '25 00:08 AgCaliva

@AgCaliva Hello Agustin, thanks for taking the time to comment with your suggestion. It's appreciated, especially as you're new to Rust and RDP. I know - I learned Rust simpl for this project. And as an AI systems architect, RDP and networking isnt my domain. Having said that:

Regarding your idea to transmit the PrtSc key and use clipboard sharing: these are definitely interesting points, and I've actually looked into similar data transfer methods while working on addressing the RDP issues within Screenpipe.

To give you some context, my efforts to fix the RDP functionality have involved exploring some fairly advanced techniques. For instance, I've experimented with dynamically reconfiguring XCAP settings on the fly to try and optimize capture, and delved into low-level Windows API calls related to display mirroring and capture. I've even looked at unconventional bypass methods to keep Screenpipe recording and functional during RDP sessions, such as attempting to create a virtual display or intercepting rendering calls at a lower level – though these have proven to be impractical for a reliable, user-friendly solution thus far.

However, after quite a bit of research and experimentation, the core of the problem boils down to the fundamental design of RDP itself. It's built to send rendered graphics commands, not a continuous stream of raw pixel data in the way Screenpipe ideally needs for a smooth, interactive experience. The inherent latency and the way RDP serializes and transmits display updates can become bottlenecks when trying to achieve low-latency, high-frame-rate streaming. I've delved into the specifics of RDP's drawing primitives, its update protocols, and how it interacts with various display drivers and hardware. While your suggestion about PrtSc and the clipboard touches on available data transfer mechanisms within RDP, the main hurdle is how RDP fundamentally handles the continuous rendering and transmission of the remote visual information.

The final proposed solution from my end involves some networking-level adjustments to see if I can mitigate these RDP limitations, but this is now in the hands of our networking engineering team for implementation and testing.

Thanks again for your suggestion. I'm open to further discussion and any other insights you might have as I continue to work on this challenging issue. Perhaps my findings could assist you in your quest. All the best and thank you!

Best regards,

Pierre-Henri Rossouw

@Raxephion

Senior Generative AI Engineer | Multimodal Systems Architect |

On Sun, 10 Aug 2025 at 02:35, Agustin Caliva - AgCaliva < @.***> wrote:

AgCaliva left a comment (mediar-ai/screenpipe#850) https://github.com/mediar-ai/screenpipe/issues/850#issuecomment-3172263378

@louis030195 https://github.com/louis030195 Hello, i dont know about RDP, and im new to Rust, but i think you probably can solve it this way:

  • Transmit the PrtSc key via RDP
  • Share the clipboard via RDP so only the client you can paste the image into any image editor and save it. I guess PrtSc saves the image in some format that you can convert into image in server instead of using and image editor.

If it solves your issue i would like to get like 100 or 200usd if you can, i need money, anyway i know a lot about programming and stuff, be kind with me and i will give you feedback, and im learning rust. I have been coding since 11 years ago, but im new in rust and windows apis. Thank you so much, send to binance using my email @.***

— Reply to this email directly, view it on GitHub https://github.com/mediar-ai/screenpipe/issues/850#issuecomment-3172263378, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGFTJFXJ2U3WDVGSOOULKFT3M2HVNAVCNFSM6AAAAABTDEKD62VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCNZSGI3DGMZXHA . You are receiving this because you were mentioned.Message ID: @.***>

Raxephion avatar Aug 12 '25 11:08 Raxephion

/attempt #850

CorrM avatar Sep 18 '25 03:09 CorrM

@louis030195 is this issue issue still open? if yes so I start work on it ?

rishi-jat avatar Nov 01 '25 23:11 rishi-jat