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

DXGI_ERROR_UNSUPPORTED error when recording #220

Closed vincent1000 closed 1 year ago

vincent1000 commented 1 year ago

DXGI_ERROR_UNSUPPORTED error appears when I start to record on some machines. I am not sure whether this is related with cpus and graphics card, but both of these two machines have these same information: CPU: AMD Ryzen 7 5800H with Radeon Graphics Graphics card: NVIDIA GeForce RTX 3050.

My setting is as followed.

VideoEncoderOptions = new VideoEncoderOptions
                {
                    Framerate = 8,
                    IsFixedFramerate = false,
                    IsFragmentedMp4Enabled = false,
                    IsThrottlingDisabled = false,
                    IsHardwareEncodingEnabled = false,
                    IsLowLatencyEnabled = false,
                    IsMp4FastStartEnabled = false
                },
sskodje commented 1 year ago

As these are laptops, I'm guessing it's related to a known bug with Windows and dual GPU's described here. If so, it should work using Windows Graphics Capture mode instead, or by forcing the program to use the dedicated GPU. I'll try to see if i can implement a way to force what GPU to use.

sskodje commented 1 year ago

Fixed with 8ef3231ab577e2bb641521807957ad6d1a0d249c