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

Minimized Window not recorded #303

Closed sandeepmohil closed 4 months ago

sandeepmohil commented 4 months ago

While recording a Win Forum Application , Windows Handle is being paased. this.Handle

Recording works fine only when Window is visible. When Window is minimized black screen is recorded instead of the app.

Is there a way to fix this ?

Logs :

2024-07-02 16:11:14.044 [DEBUG] [RecordingManager.cpp | ConfigureOutputDir: 144] >> Video output folder is ready 2024-07-02 16:11:14.045 [INFO] [RecordingManager.cpp | operator (): 284] >> Starting recording task 2024-07-02 16:11:14.195 [DEBUG] [OutputManager.cpp | BeginRecording: 103] >> Sink Writer initialized 2024-07-02 16:11:14.199 [DEBUG] [RecordingManager.cpp | StartRecorderLoop: 705] >> Changed Recording Status to Recording 2024-07-02 16:11:17.927 [INFO] [WindowsGraphicsCapture.c | ProcessRecordingTim: 456] >> Restarted Windows Graphics Capture 2024-07-02 16:11:19.877 [DEBUG] [RecordingManager.cpp | EndRecording: 337] >> Stopped recording task 2024-07-02 16:11:19.910 [DEBUG] [RecordingManager.cpp | StartRecorderLoop: 698] >> Recording task was cancelled 2024-07-02 16:11:19.912 [INFO] [OutputManager.cpp | FinalizeRecording: 133] >> Cleaning up resources 2024-07-02 16:11:19.912 [INFO] [OutputManager.cpp | FinalizeRecording: 134] >> Finalizing recording 2024-07-02 16:11:19.914 [DEBUG] [CMFSinkWriterCallback.h | OnFinalize: 18] >> CMFSinkWriterCallback::OnFinalize 2024-07-02 16:11:19.940 [DEBUG] [OutputManager.cpp | FinalizeRecording: 157] >> Shut down IMFMediaSink 2024-07-02 16:11:19.940 [INFO] [RecordingManager.cpp | operator (): 306] >> Exiting recording task 2024-07-02 16:11:19.952 [DEBUG] [ScreenCaptureManager.cpp | CaptureThreadProc:1006] >> Exiting CaptureThreadProc 2024-07-02 16:11:19.960 [DEBUG] [RecordingManager.cpp | SetRecordingComplet: 406] >> Changed Recording Status to Idle 2024-07-02 16:11:19.960 [DEBUG] [RecordingManager.cpp | SetRecordingComplet: 411] >> Sent Recording Complete callback

sskodje commented 4 months ago

Hi! When windows are minimized, they are no longer rendered, so there is unfortunately nothing to record. You got to make sure not to minimize them.

SumitKumar-89 commented 4 months ago

Hii @sskodje I know that when window is minimized , it is no longer to rendered. So it's become black screen . But we want to record/ captured wpf application 's screen when window is minimized. Like recording must be continues while windows minimized

So is there any way to fix this ???

sskodje commented 4 months ago

So you want to record a still frame of the window? Try commenting out this line: https://github.com/sskodje/ScreenRecorderLib/blob/bcad5cf06fb4f7ed66dd8db5dc855a220fa7313b/ScreenRecorderLibNative/WindowsGraphicsCapture.cpp#L447

SumitKumar-89 commented 4 months ago

@sskodje , M working on application with dashboard having windows with charts which are being updated dynamically ..This is the reason I want to record the application window screen even when minimized. So can you help with this scenario?

sskodje commented 4 months ago

When you minimize a window, the operating system stops rendering it to desktop. Therefore it no longer sends any textures to the APIs this library uses to record video. So no, i cannot help you record windows that are minimized.

SumitKumar-89 commented 4 months ago

So , is there any indirect way to record the screen when the window is minimized.

On Wed, Jul 3, 2024, 2:44 PM Sverre Skodje @.***> wrote:

When you minimize a window, the operating system stops rendering it to desktop. Therefore it no longer sends any textures to the APIs this library uses to record video. So no, i cannot help you record windows that are minimized.

— Reply to this email directly, view it on GitHub https://github.com/sskodje/ScreenRecorderLib/issues/303#issuecomment-2205509588, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATF6AUCY752D7UP2TB4SDCLZKO6JHAVCNFSM6AAAAABKHITCMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBVGUYDSNJYHA . You are receiving this because you commented.Message ID: @.***>

aqibbanday commented 4 months ago

So , is there any indirect way to record the screen when the window is minimized. On Wed, Jul 3, 2024, 2:44 PM Sverre Skodje @.> wrote: When you minimize a window, the operating system stops rendering it to desktop. Therefore it no longer sends any textures to the APIs this library uses to record video. So no, i cannot help you record windows that are minimized. — Reply to this email directly, view it on GitHub <#303 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATF6AUCY752D7UP2TB4SDCLZKO6JHAVCNFSM6AAAAABKHITCMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBVGUYDSNJYHA . You are receiving this because you commented.Message ID: @.>

No