Git Product home page Git Product logo

andrey1994 / screen_recorder_sdk Goto Github PK

View Code? Open in Web Editor NEW
45.0 5.0 15.0 5.95 MB

Library to take screenshots and record videos

Home Page: https://screen-recorder-sdk.readthedocs.io/en/latest/

License: MIT License

CMake 0.13% Batchfile 0.02% C++ 97.50% C 0.73% Python 0.94% Java 0.68%
screenshot screen-capture screensaver screen-recorder screenshot-utility screenshots python cpp video-recording

screen_recorder_sdk's Introduction

Screen Recorder SDK

Library to take screenshots and record videos

We use Desktop Duplication API to capture desktop and Media Foundation API to record video.

System Requirements

  • Windows >= 10, it may work on Windows 8.1 and Windows Server 2012, but we don't ensure it
  • DirectX, you can install it from Microsoft Website
  • Media Feature Pack, download it here
  • 64 bits Java or Python, we don't provide x86 libs

Build Status

*Windows(AppVeyor) Build status

screen_recorder_sdk's People

Contributors

andrey1994 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

screen_recorder_sdk's Issues

Draw Cursor

Desktop Duplication API doesnt track mouse movements(and its correct), we can add an option to capture mouse and draw it

Project compilation failed on Cmake for creating environment

Hi,

I've been trying to compile the package from source but getting error regarding: C:\Microsoft.Cpp.Default.props. I've installed CMAKE and Visual Studio 14 2015 x64 build tools. After moving to directory, i'm simply running the cmake_build.cmd file but no success. The command i ran:

$ ./cmake_build.cmd

Error:

image

Not Working

Output:

[2020-10-20 22:03:13.238] [recordLogger] [info] Created d3d11 device from 0
[2020-10-20 22:03:13.238] [recordLogger] [info] found 3 displays
[2020-10-20 22:03:13.238] [recordLogger] [error] desktopdiplication is unsupported on current desktop mode

I have 3 monitors, but I also tried it with one, and it still didn't work.

Parameter fps for start_video_recording has no effect

I have recorded a video with start_video_recording and handed in different values for fps.
However, this did not have any effect, the frame rate of the video was always variable, around 20, although the parameter had a value of e.g. 3 fps.

Error in System Arguments

Traceback (most recent call last):
File "E:\python prog\screen_recorder.py", line 85, in
main ()
File "E:\python prog\screen_recorder.py", line 67, in main
pid = int (sys.argv[1]) # pid == 0 means capture full screen
IndexError: list index out of range

Simple Sample is not working

win10 x64
monitor: 1366x768

Traceback (most recent call last):
  File "E:\ChatBotAI\AiCharli.py", line 28, in <module>
    main ()
  File "E:\ChatBotAI\AiCharli.py", line 10, in main
    pid = int (sys.argv[1]) # pid == 0 means capture full screen
IndexError: list index out of range

Process returned 1 (0x1)        execution time : 0.299 s

Processor Consumption [Too High]

I was testing on a virtual machine without a GPU and to my surprise the processor consumption of it is too high and slowing down the other processes. Is there any way to make it consume less power?

Track window position in real time

Currently we determine process window position on the desktop in the beginning and use these coordinates. Probably we can do it in real time and handle the case if process window was moved

Unable to record vertical displays (black screen)

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?

Error: not working

Traceback (most recent call last):
File "d:\Documents\Programming\PROJECTS\scr_cap.py", line 28, in
main ()
File "d:\Documents\Programming\PROJECTS\scr_cap.py", line 10, in main
pid = int (sys.argv[1])
IndexError: list index out of range

Identify and get RecorderParams.desktop_num of multiple displays

I had guessed that the order of desktop_num values is the same as the Identify order in the 'Display settings', or the get_monitors() order in the package 'screeninfo'.
However I only found that the primary display is always 0, and I don't know in what order the rest are numbered.
Could you tell me if there is a callable function from ScreenRecorder.dll that can get desktop_num and other key values corresponding to each displays or desktops?

Could not init InitializeSinkWriter

Hello , i'm getting following error when i try to record something ,please help me with the following issue:
[2020-08-25 17:09:11.433] [recordLogger] [error] Could not init InitializeSinkWriter
[2020-08-25 17:09:11.435] [recordLogger] [error] MFEncoder is not null
[2020-08-25 17:09:11.438] [recordLogger] [error] Could not init InitializeSinkWriter
[2020-08-25 17:09:11.441] [recordLogger] [error] MFEncoder is not null
[2020-08-25 17:09:11.444] [recordLogger] [error] Could not init InitializeSinkWriter
[2020-08-25 17:09:11.450] [recordLogger] [error] MFEncoder is not null

Doesn't get detected during a binary built [PyInstaller]

HI, first of really great for pulling this off. Its really helpful to me. I've just found an issue using the library when doing the final compile in a program. The library doesn't get detected by PyInstaller or other compilation tools. The imports do get detected and works fine, however the ScreenRecorder.dll file doesn't get detected and is not placed in the compiled directory. I tried the following commands:

$ pyinstaller file.py
$ pyinstaller --hidden-import screen_recorder_sdk file.py

At the end, i'd to go to the directory where the library is installed and manually copy the whole and place in compilation directory.

d3d11.h not found compilation error [VS 14 2015]

When compiling with Visual Studio 14 2015, the cmake command throws the following error:

C:\Users\sheik\Documents\Projects\screen_recorder_sdk\build>cmake --build . --config Release
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.

  Checking Build System
  Building Custom Rule C:/Users/sheik/Documents/Projects/screen_recorder_sdk/CMakeLists.txt
  ScreenRecorder.cpp
C:\Users\sheik\Documents\Projects\screen_recorder_sdk\src\ScreenRecorder\inc\RecorderDDA.h(6): fatal error C1083: Canno
t open include file: 'd3d11_4.h': No such file or directory [C:\Users\sheik\Documents\Projects\screen_recorder_sdk\buil
d\ScreenRecorder.vcxproj]
  Recorder.cpp
  RecorderDDA.cpp
C:\Users\sheik\Documents\Projects\screen_recorder_sdk\src\ScreenRecorder\inc\RecorderDDA.h(6): fatal error C1083: Canno
t open include file: 'd3d11_4.h': No such file or directory [C:\Users\sheik\Documents\Projects\screen_recorder_sdk\buil
d\ScreenRecorder.vcxproj]
  MFEncoder.cpp
  HandleD3DWindow.cpp
  Generating Code...

I've Direct X installed. And the compilation works fine when trying from Visual Studio 17 2022 but throws this error from 14 2015 version.

Failed to build dependecies.

I have numpy preinstalled in my Windows but when trying to install screen recorder sdk it fails to build numpy. How can I solve this?

Performance issues and freezes while using this tool

Hi, first of all good work creating this, it's easy to use and does the job.
I started using the lib for my nightly automated regression tests in order to capture video records of the tests that are failing, to help with debug.
Since then I'm seeing some errors with Insufficient memory thrown by opencv.
The thing is that the error comes when I try to do some image recognition using a different library that uses opencv.
Yesterday I deactivated screen recording during the tests and the errors are gone.
Maybe there's a memory leak here that prevents opencv to allocate memory for other tasks.

Here is the error I get:
File "C:\GitLab-Runner\builds\hbav6Snu\0\COP_QA\COP\d2c_regression\libs\image_utils.py", line 66, in locate
return pyautogui.locateOnScreen(ELEMENTS_PATH + element_image, minSearchTime=3, confidence=confidence)
File "c:\work_dir\cop_regression\lib\site-packages\pyscreeze_init_.py", line 360, in locateOnScreen
retVal = locate(image, screenshotIm, **kwargs)
File "c:\work_dir\cop_regression\lib\site-packages\pyscreeze_init_.py", line 340, in locate
points = tuple(locateAll(needleImage, haystackImage, **kwargs))
File "c:\work_dir\cop_regression\lib\site-packages\pyscreeze_init_.py", line 219, in _locateAll_opencv
result = cv2.matchTemplate(haystackImage, needleImage, cv2.TM_CCOEFF_NORMED)
cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\core\src\alloc.cpp:55: error: (-4:Insufficient memory) Failed to allocate 49838424 bytes in function 'cv::OutOfMemoryError'

Also here's the simplified code that I'm using to capture screen records, maybe I'm not using this correctly.

@pytest.fixture(scope="function", autouse=True)
def _capture_screen_record(self):
    screen_recorder.disable_log()
    params = screen_recorder.RecorderParams()
    screen_recorder.init_resources(params)
    screen_recorder.start_video_recording("temp_screen_record.mp4", 20, 4000000, True)
    yield
    screen_recorder.stop_video_recording()
    screen_recorder.free_resources()

Any input is appreciated, thanks

helpme to get pid of firefox or chrome browser pid

Hi,
I got pid of browser instance which i passed but still getting below error. help me pls.
[2020-07-17 11:28:57.177] [recordLogger] [info] Created d3d11 device from 0
[2020-07-17 11:28:57.178] [recordLogger] [info] found 1 displays
[2020-07-17 11:28:57.182] [recordLogger] [error] Unable to find window for pid 21708
[2020-07-17 11:28:57.182] [recordLogger] [error] Unable to get process window

Unable to get things working

Part of Code -

screen_recorder.enable_dev_log()
params = screen_recorder.RecorderParams()
screen_recorder.init_resources(params)

Output (as soon as i run the code) -

[2020-11-09 16:22:46.415] [recordLogger] [info] Created d3d11 device from 0
[2020-11-09 16:22:46.415] [recordLogger] [info] found 1 displays
[2020-11-09 16:22:46.418] [recordLogger] [error] invalid arg to create desktopdiplication
[2020-11-09 16:22:46.418] [recordLogger] [trace] stop video recording is called
[2020-11-09 16:22:48.433] [recordLogger] [trace] wait res for stop video is false

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.