Skip to content

Files

Latest commit

Dec 11, 2021
12caa46 · Dec 11, 2021

History

History
 
 

python

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Nov 7, 2020
Nov 14, 2020
Nov 7, 2020
Dec 11, 2021

README.md

Screen Recorder SDK

Library to take screenshots and record videos

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

For screenshots it cuts process window from desktop while for videos it captures full display without cutting for better performance

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

Installation

First option is:

git clone https://github.com/Andrey1994/screen_recorder_sdk
cd screen_recorder_sdk
cd python
pip install .

ALso you can install it from PYPI:

pip install screen_recorder_sdk

Simple Sample

import sys
import time
import numpy

from screen_recorder_sdk import screen_recorder


def main ():
    screen_recorder.enable_dev_log ()
    pid = int (sys.argv[1]) # pid == 0 means capture full screen
    screen_recorder.init_resources (pid)

    screen_recorder.get_screenshot (5).save ('test_before.png')

    screen_recorder.start_video_recording ('video1.mp4', 30, 8000000, True)
    time.sleep (5)
    screen_recorder.get_screenshot (5).save ('test_during_video.png')
    time.sleep (5)
    screen_recorder.stop_video_recording ()

    screen_recorder.start_video_recording ('video2.mp4', 30, 8000000, True)
    time.sleep (5)
    screen_recorder.stop_video_recording ()

    screen_recorder.free_resources ()

if __name__ == "__main__":
    main ()

More samples