screen_recorder_sdk icon indicating copy to clipboard operation
screen_recorder_sdk copied to clipboard

Unable to record vertical displays (black screen)

Open ain-cinematronic opened this issue 2 years ago • 7 comments

Hi,

When trying to record a vertical display, the output video file is completely black.

I also do not get any errors or message out of the ordinary in the log.

Do you know what causes this issues and how I could solve it?

ain-cinematronic avatar May 25 '23 09:05 ain-cinematronic

Is it ok for horizontal displays on the same system?

Andrey1994 avatar May 25 '23 09:05 Andrey1994

Hi Andrey, thank you for the reply

Yes, horizontal screen works perfectly (in fact, love the library btw, by far the best I could find with a python wrapper)

It is just when the display is set to portrait in Windows that the resulting screen is black.

I have a suspicion that the issue might be related to how the screen size is passed. When the screen is in portrait orientation, the width and height values are effectively swapped compared to a landscape orientation. I suspect this might be causing some confusion or conflict within the library's functionality.

What do you think?

ain-cinematronic avatar May 25 '23 09:05 ain-cinematronic

I will take a closer look at the source code this weekend, is it only for video or screenshots also?

Andrey1994 avatar May 25 '23 09:05 Andrey1994

Taking a screenshot also produces a black image in portrait mode.

I have briefly tried a fork of your project by PatrykTokarczyk (https://github.com/PatrykTokarczyk/screen_recorder_sdk.git)

who seems to have implemented a way to capture a portion of the screen (therefore allowing to set a height and width value)

With his fork, I also get a black screen normally, unless I choose to capture a "portion" of the screen and setting the width and height of the display in portrait mode.

Here is a code snippet:

        srcRight = 3840  # height
        srcBottom = 2160 # width
        
        screen_recorder.start_crop_video_recording(path_to_save, self.frame_rate, self.bitrate, self.hardware_acceleration_supported, srcLeft, srcTop, srcRight, srcBottom)

This way, it correctly captures a portrait video too.

I hope this finding helps! :)

EDIT: I would like to add further details after trying the fork of PatrykTokarczyk. Strangely enough, when I run a scan of the dll file from PatrykTokarczyk's repository with VirusTotal, it gets 1/69 virus warnings (which is most likely a false positive).

However, the dll from your repository provide give 0 warnings (which is great), which makes me wonder whether PatrykTokarczyk's approach triggers a false positive.

I just wanted to also share this information in case it is useful.

ain-cinematronic avatar May 25 '23 10:05 ain-cinematronic

Hey Andrey, have you found anything new about this bug by any chance?

ain-cinematronic avatar Jun 19 '23 17:06 ain-cinematronic

Hi, I can reproduce it but I have not found the issue yet, and its a little bit hard to debug for me since I have no external monitor to test

Andrey1994 avatar Jun 19 '23 21:06 Andrey1994

I think that can be the issue https://learn.microsoft.com/en-us/windows/win32/direct3ddxgi/desktop-dup-api#rotating-the-desktop-image

Andrey1994 avatar Jun 19 '23 22:06 Andrey1994