Skip to content
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.

Changing the resolution results in "frozen" screenshots - D3D doesn't update to current screen #6

Closed
UsaidPro opened this issue Aug 5, 2019 · 3 comments

Comments

@UsaidPro
Copy link

UsaidPro commented Aug 5, 2019

When I change the resolution of my laptop after running my Python code with D3DShot, screenshot_to_disk_every() stops returning the current screen and instead returns the screen before resolution change. I don't know if this is an issue with Window's Desktop Duplication or this library.

My code:

import d3dshot
import time
import matplotlib.pyplot as plt
d = d3dshot.create()
d.screenshot_to_disk_every(10)

This issue occurs even with using other screenshot functions.

@nbrochu
Copy link
Member

nbrochu commented Aug 13, 2019

I think you will have issues with most screen capturing solutions, especially those that are closer to the metal and try to be efficient with resources when changing resolution once the context has been created.

The problem here is that by changing the resolution of a display, you invalidate the DXGI Output handle that has been acquired by D3DShot to capture stuff on that display. The handle is still valid for the desktop duplication API to use, but it's effectively a "zombie" display at that point and no new information can be returned (which you observed). The resolution-changed display effectively lives on as a new DXGI Output that you would have to detect and swap to seamlessly. This is not easy at all; not even sure it's possible.

Unfortunately, I don't think this is a reasonable issue to try and tackle. Did you accidentally stumble upon the behavior or is it part of your use case to change resolutions while capturing? Just curious.

@UsaidPro
Copy link
Author

UsaidPro commented Aug 15, 2019 via email

@nbrochu
Copy link
Member

nbrochu commented May 28, 2020

I'll close this one. It'll remain searchable to help people stumbling upon a similar situation.

@nbrochu nbrochu closed this as completed May 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants