sskodje / ScreenRecorderLib

A .NET library for screen recording in Windows, using native Microsoft Media Foundation for realtime encoding to h264 video or PNG images.
MIT License
414 stars 94 forks source link

Capture the pop out tab from window. #307

Closed saman1832 closed 2 months ago

saman1832 commented 4 months ago

I have a wpf application in which h have multiple tab and if I pop the tab out the pop out tab is not getting recorded. Or if any popup is opened that is not getting recorded as that is different window I guess. can we fix this?

sskodje commented 4 months ago

Yes, it's because it's a different window. I recommend recording the entire desktop, or a cropped desktop, in this scenario.

saman1832 commented 4 months ago

Actually the use case is we don't want to record full dekstop . So, will cropped desktop will not do full desktop recording? And how we do it?

saman1832 commented 4 months ago

@sskodje can you please let me know how we can do cropped desktop recording?

sskodje commented 4 months ago

Either globally on the entire output via the output options: https://github.com/sskodje/ScreenRecorderLib/wiki/Quickstart-guide-v5.x.x-and-newer.#change-the-options-with-recorderoptions

Or by configuring the source: https://github.com/sskodje/ScreenRecorderLib/wiki/Quickstart-guide-v5.x.x-and-newer.#source-properties

saman1832 commented 4 months ago

@sskodje Thnks for the update. Can we also change the sourceRect dynamically?

sskodje commented 4 months ago

Yes, using DynamicOptionsBuilder.

saman1832 commented 4 months ago

@sskodje I tried dynamicoption and it's working perfectly. thnks for the great work

Can we also record specific any two or three windows by passing the window handle or name?

sskodje commented 4 months ago

Yes. If you want them next to the desktop (side by side) add WindowRecordingSource, if you want them overlayed, use WindowOverlay.

saman1832 commented 4 months ago

@sskodje can you help me with code snippet?

I tried but no succes.

Actually I am recording the screen using window handle but when I open the popup or dialogue box then j want to capture that screen as overlay or as side by side. Please help me in this as I am stuck on this part.

sskodje commented 4 months ago

I see. There are currently some limitations that is in the way for your use case. I'm working on a fix, but here is a workaround in the mean time.

The overlays need to be added before starting the recording, and the recording has to be started (RecordingStatus = Recording) before applying dynamic options. Unfortunately there is also missing a property from the overlay to disable it from the start. This means you need to add a WindowOverlay object with a valid window handle, with for example size 1x1px, listen for OnStatusChanged change, call

rec.GetDynamicOptionsBuilder()
.SetVideoCaptureEnabledForOverlay(MyOverlay.ID, false)
.Apply()

to disable overlay recording temporarily when status is Recording. Now the overlay lies dormant and can be used later. When you need it, update MyOverlay with the Window handle, size and other info you want, and call


rec.GetDynamicOptionsBuilder()
.SetUpdatedOverlay(MyOverlay)
.SetVideoCaptureEnabledForOverlay(MyOverlay.ID, true)
.Apply()
sskodje commented 2 months ago

Added support for inserting overlays during a recording in progress with d016a24. Now you can simply call SetUpdatedOverlay() with a new overlay.