schirmshots


Nameschirmshots JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/schirmshots
Summaryrecords multiple (background) windows using ctypes and ffmpeg - Windows only
upload_time2023-08-20 08:10:14
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords screen recording background ffmpeg
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# records multiple (background) windows using ctypes and ffmpeg - Windows only

### pip install schirmshots

### Tested against Windows 10 / Python 3.10 / Anaconda 

```python

Customizable Recording Parameters - The function allows you to specify various recording parameters, such as the
output video file path, the target window's handle (HWND), the window's position and dimensions,
whether to run in headless mode, desired frame rate, compression parameters, and more.
This level of customization gives you fine-grained control over the recording process.

Headless Mode - If the headless parameter is set to true, the function utilizes the FakeHeadless class to run in
headless mode. This means that it hides the window that is being recorded. This can be advantageous for automation and background tasks.

Hotkey Termination - The function supports a hotkey combination (killhotkey)
to terminate the recording process. This provides an easy and user-friendly way to stop the recording if needed.

Error Handling - The code includes error handling for various scenarios, such as removing an existing video
file before starting the recording and handling exceptions that might arise during the recording process.
This helps ensure a smoother execution even in the presence of unexpected issues.

Dynamic Window Resizing - The code includes functionality to dynamically resize the target window before recording,
which can be useful if you want to ensure a specific window size for the recording. If you resize the window,
the frames won't be recorded, and the window will automatically be resized to the dimensions from the beginning, and the recording
will go on. However, you can move the window during the recording

External Process Management - The code manages external processes, like launching a subprocess which starts a main
process (completely independent) for every recording
and ensuring it runs in the background. That means you can record multiple windows at once and use all your CPUs

Start recording video of a specific window using specified parameters.

Args:
	videofile (str): The path to the output video file.
	hwnd (int): The handle of the target window to be recorded.
	windowpos (tuple, optional): The position and dimensions of the window as a tuple (startx, starty, width, height).
		If None, the window's position and dimensions will not be altered before recording.
	headless (int | bool, optional): Set to 1 or True to run in headless mode (hides the window that is being recorded), 0 or False otherwise.
	framerate (int, optional): The approximate desired recording frame rate. Default is 0 (no specific framerate).
	params (tuple, optional): Additional parameters for video compression, as a tuple of tuples.
		Default is (("-vcodec", "libx264"), ("-crf", 0), ("-preset", "ultrafast")).
	killhotkey (str, optional): The hotkey combination to terminate the recording. Default is "ctrl+alt+e" - can be used multiple times.
	use_client (int | bool, optional): Set to 1 or True to use the client area of the window, 0 or False otherwise.

Returns:
	None

Example:
	from schirmshots import start_recording # needs to be in a file - not directly from the console - make sure that ffmpeg is installed

	start_recording(
		headless = 0,
		videofile= f'c:\\myvideofile2.mkv',
		windowpos=None,# (0,0,640,480),
		hwnd=3477668,
		framerate = 30,
		params = (("-vcodec", "libx264"), ("-crf", 0), ("-preset", "slow")),
		killhotkey='ctrl+alt+e',
	)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/schirmshots",
    "name": "schirmshots",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "screen,recording,background,ffmpeg",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e8/03/21c900a0fe7ae2edbd18c9128df699f09d9deb880f4d4555ac2bc0925442/schirmshots-0.10.tar.gz",
    "platform": null,
    "description": "\r\n# records multiple (background) windows using ctypes and ffmpeg - Windows only\r\n\r\n### pip install schirmshots\r\n\r\n### Tested against Windows 10 / Python 3.10 / Anaconda \r\n\r\n```python\r\n\r\nCustomizable Recording Parameters - The function allows you to specify various recording parameters, such as the\r\noutput video file path, the target window's handle (HWND), the window's position and dimensions,\r\nwhether to run in headless mode, desired frame rate, compression parameters, and more.\r\nThis level of customization gives you fine-grained control over the recording process.\r\n\r\nHeadless Mode - If the headless parameter is set to true, the function utilizes the FakeHeadless class to run in\r\nheadless mode. This means that it hides the window that is being recorded. This can be advantageous for automation and background tasks.\r\n\r\nHotkey Termination - The function supports a hotkey combination (killhotkey)\r\nto terminate the recording process. This provides an easy and user-friendly way to stop the recording if needed.\r\n\r\nError Handling - The code includes error handling for various scenarios, such as removing an existing video\r\nfile before starting the recording and handling exceptions that might arise during the recording process.\r\nThis helps ensure a smoother execution even in the presence of unexpected issues.\r\n\r\nDynamic Window Resizing - The code includes functionality to dynamically resize the target window before recording,\r\nwhich can be useful if you want to ensure a specific window size for the recording. If you resize the window,\r\nthe frames won't be recorded, and the window will automatically be resized to the dimensions from the beginning, and the recording\r\nwill go on. However, you can move the window during the recording\r\n\r\nExternal Process Management - The code manages external processes, like launching a subprocess which starts a main\r\nprocess (completely independent) for every recording\r\nand ensuring it runs in the background. That means you can record multiple windows at once and use all your CPUs\r\n\r\nStart recording video of a specific window using specified parameters.\r\n\r\nArgs:\r\n\tvideofile (str): The path to the output video file.\r\n\thwnd (int): The handle of the target window to be recorded.\r\n\twindowpos (tuple, optional): The position and dimensions of the window as a tuple (startx, starty, width, height).\r\n\t\tIf None, the window's position and dimensions will not be altered before recording.\r\n\theadless (int | bool, optional): Set to 1 or True to run in headless mode (hides the window that is being recorded), 0 or False otherwise.\r\n\tframerate (int, optional): The approximate desired recording frame rate. Default is 0 (no specific framerate).\r\n\tparams (tuple, optional): Additional parameters for video compression, as a tuple of tuples.\r\n\t\tDefault is ((\"-vcodec\", \"libx264\"), (\"-crf\", 0), (\"-preset\", \"ultrafast\")).\r\n\tkillhotkey (str, optional): The hotkey combination to terminate the recording. Default is \"ctrl+alt+e\" - can be used multiple times.\r\n\tuse_client (int | bool, optional): Set to 1 or True to use the client area of the window, 0 or False otherwise.\r\n\r\nReturns:\r\n\tNone\r\n\r\nExample:\r\n\tfrom schirmshots import start_recording # needs to be in a file - not directly from the console - make sure that ffmpeg is installed\r\n\r\n\tstart_recording(\r\n\t\theadless = 0,\r\n\t\tvideofile= f'c:\\\\myvideofile2.mkv',\r\n\t\twindowpos=None,# (0,0,640,480),\r\n\t\thwnd=3477668,\r\n\t\tframerate = 30,\r\n\t\tparams = ((\"-vcodec\", \"libx264\"), (\"-crf\", 0), (\"-preset\", \"slow\")),\r\n\t\tkillhotkey='ctrl+alt+e',\r\n\t)\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "records multiple (background) windows using ctypes and ffmpeg - Windows only",
    "version": "0.10",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/schirmshots"
    },
    "split_keywords": [
        "screen",
        "recording",
        "background",
        "ffmpeg"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f1a22f021dd93147686a180cdf4bcd4d8287f27b8cb8686c494d417b501ba099",
                "md5": "1ef7678c96459cf54674c59f51567779",
                "sha256": "df2820f0455ec12cf28fc3fca7aa940d1ed5a69ec49290f201330443e59eeca6"
            },
            "downloads": -1,
            "filename": "schirmshots-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1ef7678c96459cf54674c59f51567779",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 14027,
            "upload_time": "2023-08-20T08:10:12",
            "upload_time_iso_8601": "2023-08-20T08:10:12.570735Z",
            "url": "https://files.pythonhosted.org/packages/f1/a2/2f021dd93147686a180cdf4bcd4d8287f27b8cb8686c494d417b501ba099/schirmshots-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e80321c900a0fe7ae2edbd18c9128df699f09d9deb880f4d4555ac2bc0925442",
                "md5": "5790949b79dccfc9339c7c7d71b1182f",
                "sha256": "6eed9db25367878f0cbcdfe77c919c84ed92353b24c40b3cb1aaf926a980a052"
            },
            "downloads": -1,
            "filename": "schirmshots-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "5790949b79dccfc9339c7c7d71b1182f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 12787,
            "upload_time": "2023-08-20T08:10:14",
            "upload_time_iso_8601": "2023-08-20T08:10:14.465654Z",
            "url": "https://files.pythonhosted.org/packages/e8/03/21c900a0fe7ae2edbd18c9128df699f09d9deb880f4d4555ac2bc0925442/schirmshots-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-20 08:10:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "schirmshots",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "schirmshots"
}
        
Elapsed time: 0.28376s