ffmpeg-screenshot-pipe


Nameffmpeg-screenshot-pipe JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/ffmpeg_screenshot_pipe
SummaryCapture Screenshots with Unparalleled Speed and Versatile Features - GDIgrab, DDAgrab, Ctypes, Multiprocessing, GPU, Mouse Capture...
upload_time2023-05-22 00:32:12
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords screenshots mss fast win32 ffmpeg gdigrab ddagrab
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Capture Screenshots with Unparalleled Speed and Versatile Features - GDIgrab, DDAgrab, Ctypes, Multiprocessing, GPU, Mouse Capture ...


### pip install ffmpeg-screenshot-pipe

## What is so special about ffmpeg-screenshot-pipe

- 3 methods of capturing screenshots: GDIgrab, DDAgrab or Ctypes
- Faster than all other libraries 
- Efficient mouse capture (with/without)
- Integration with FFmpeg for exceptional speed
- Capture windows running in the background
- Only a few dependencies - all of them pure Python except Numpy 
- Specify windows using HWND and (regex)search for targeted capture
- GPU acceleration for enhanced performance
- High-quality screen recordings and screenshots
- Versatile and powerful functionality
- Seamless integration with numpy for data processing workflows
- Fine-grained control over screen capture settings
- Minimal performance impact
- Suitable for content creators, software developers, and individuals with diverse screen capture needs.
- Multiprocessing for capturing various windows/screens/areas 

FFmpegshot is a versatile and powerful class designed for capturing screen recordings and screenshots. It offers a wide range of options and features that make it suitable for various use cases.

This class is particularly useful for people who require high-quality screen capture capabilities with advanced functionality. It provides efficient and fast screen capturing capabilities, thanks to its integration with 
[FFmpeg - the Gold Standard of Video Encoding/Decoding](https://ffmpeg.org/) , all captured data is conveniently converted to the popular [Numpy](https://numpy.org/doc/stable/index.html#) format, enabling seamless integration with other data processing workflows.

One of the key advantages of FFmpegshot is its exceptional speed, surpassing all other screen capturing methods. By leveraging FFmpeg's optimized encoding and decoding algorithms, it ensures efficient processing and minimal performance impact, resulting in swift and responsive screen captures.

Furthermore, FFmpegshot offers a plethora of options to cater to diverse needs. Users can capture mouse movements, extract frames from background windows, specify individual windows using HWND for capture, and even leverage GPU acceleration for enhanced performance. These features provide users with fine-grained control and flexibility over their screen capture requirements.

Whether it's for content creators seeking professional-grade screen recordings, software developers needing precise visual debugging tools, or individuals wanting efficient and reliable screen capture capabilities, FFmpegshot stands out as a powerful solution. Its combination of speed, versatility, and an array of options makes it an ideal choice for capturing and processing screen data.

## Very important: Find the right frame rate (fps)! 

### Find the optimal frame rate based on performance testing to avoid buffer read/write balance issue.


### Read this part very carefully!

```python

from ffmpeg_screenshot_pipe import FFmpegshot, get_max_framerate

# Use this function to get a rough idea how high you can go! 

mafa = get_max_framerate(
	function="capture_all_screens_gdigrab",
	startframes=45,
	endframes=150,
	timeout=2,
	framedifference=100,
	sleeptimebeforekilling=1,
)

# Frame rate testing results:
# 64 FPS -> 115 frames captured
# 65 FPS -> 115 frames captured
# 66 FPS -> 119 frames captured
# 67 FPS -> 120 frames captured
# 68 FPS -> 121 frames captured
# 69 FPS -> 123 frames captured
# 70 FPS -> 176 frames captured A difference of more than a hundred frames -> (buffer read/write balance issue)



# Based on the results, it seems that going beyond 69 frames per second may cause buffer read/write balance issues
# (on my PC - Intel i5, NVIDIA GeForce RTX 2060 SUPER, 64 GB RAM)
# It is advisable to stay a few frames below the limit to ensure smooth performance.
# Note that setting a very high frame rate (e.g., 240 FPS) may result in significantly lower actual frame rates
# due to buffer constraints.

```

#### Some functions to test the performance of this module


```python
def show_screenshot(screenshot):
    cv2.imshow("test", screenshot)
    if cv2.waitKey(1) & 0xFF == ord("q"):
        cv2.destroyAllWindows()
        return False
    return True
def show_screenshot_bench(
    screenshotiter, stop_at_frame=100, quitkey="q", show_screenshot=True
):
    def show_screenshotx():
        cv2.imshow("test", screenshot)
        if cv2.waitKey(1) & 0xFF == ord(quitkey):
            cv2.destroyAllWindows()
            return False
        return True

    framecounter = 0
    fps = 0
    start_time = time()
    for screenshot in screenshotiter:
        if stop_at_frame:
            if framecounter > stop_at_frame:
                break
            framecounter += 1
        if show_screenshot:
            sho = show_screenshotx()
        else:
            sho = True
        fps += 1
        if not sho:
            break
    print(f"fast_ctypes_screenshots: {fps / (time() - start_time)}")
    cv2.destroyAllWindows()
```

## DDAgrab methods (GPU)

Captures the Windows Desktop via Desktop Duplication API (D3D11) - same that OBS uses.
Note: Nvidia GPU is required to utilize these functions effectively

### Convenient usage with "with" statement

All functions with the suffix _ddagrab/_gdigrab can be called using the "with" statement


### DDAgrab - capture one screen 

[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/capture_one_screen_ddagrab_60_frames/video_588.mp4)

```python
	

with FFmpegshot() as sc:
	start_time, fps = time(), 0
	for screenshot in sc.capture_one_screen_ddagrab(
			monitor_index=0,
			frames=60,
			draw_mouse=True,
	):
		cont = show_screenshot(screenshot)
		if not cont:
			break
		fps += 1
	print(f'FPS: {fps / (time() - start_time)}')

#####################################################################		

# Reminder: Ensure to terminate FFmpeg instances if not using "with" statement
ffmpeg_screenshot = FFmpegshot()
# Capture and display screenshots
piciter = ffmpeg_screenshot.capture_one_screen_ddagrab(
	monitor_index=0,
	frames=60,
	draw_mouse=True,
)
# Terminate FFmpeg instances after usage
show_screenshot_bench(
	piciter, stop_at_frame=100, quitkey="q", show_screenshot=True
)
# don't forget to kill the ffmpeg instances after you are done
ffmpeg_screenshot.kill_ffmpeg()
	
```
### DDAgrab - capture all screens

[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/capture_all_screens_ddagrab_24_frames/video_228.mp4)

```python
with FFmpegshot() as sc:
	timestamp = timest()
	piciter = sc.capture_all_screens_ddagrab(  # generator
		frames=24, draw_mouse=True, return_empty=False
	)
	# Do something here ....


	# Important Note: The screenshots are taken individually and need to be concatenated for a continuous stream.
	# Traditional methods like cv2.hstack, cv2.vstack, or np.concatenate are too slow for real-time streaming.
	# When setting return_empty=True, the function returns an empty array, and the screenshot can be accessed
	# through temparrays.horizontal / temparrays.vertical (using https://github.com/hansalemaos/fastimgconcat).
	# The values in temparrays.vertical / temparrays.horizontal will be updated in the next iteration to avoid
	# allocating new memory. It is recommended to process the output data immediately after each iteration.
	# If you still need the arrays, make a copy (e.g., temparrays.horizontal.copy()), but keep in mind that copying
	# is an expensive operation.
	# The maximum frame rate achievable depends on the output video. For streaming purposes, up to 45 frames per
	# second (on my Intel i5, NVIDIA GeForce RTX 2060 SUPER, 64 RAM) can be achieved, but it is going to be much
	# lower if you write the file to your HDD..
```

### DDAgrab - capture a screenshot of a certain area

[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/capture_box_ddagrab_60_frames_1500x800/video_590.mp4)

```python

with FFmpegshot() as sc:
	timestamp = timest()
	piciter = sc.capture_box_ddagrab(  # generator 
		rectangle=(100, 200, 1600, 1000), # left, top, right, bottom
		frames=60,
		draw_mouse=True,
	)
	

```


### DDAgrab - Capturing a window using GPU acceleration

[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/capture_capture_window_ddagrab_notpad_60_client/video_589.mp4)


[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/capture_capture_window_ddagrab_notpad_60_window/video_588.mp4)



To capture a window using the GPU, you can leverage the power of FFmpegshot with the following considerations:

Restricting the screen capture to a specific screen: If you have multiple screens, it is recommended to 
capture only the screen where your application is running. For example, if your app is on the 
first screen, you can pass allowed_screens=(0,). By doing so, the capture process becomes 
more efficient. If you don't specify allowed_screens and have multiple screens, the capture process 
may become slower because the images are concatenated before being cropped to the appropriate size.

Limitations with capturing background windows: 
This function is not designed to capture background windows (see gdigrab). 
When you resize the window being captured, 
the resulting screenshot will also be resized accordingly.

In addition, you can utilize the searchdict dictionary to search for specific windows based on various 
criteria such as pid, title, windowtext, hwnd, length, tid, status, coords_client, dim_client, 
coords_win, dim_win, class_name, and path. This allows you to target 
specific windows for capturing. More details about the search criteria 
can be found in the appshwnd GitHub repository.  https://github.com/hansalemaos/appshwnd

```python

# Here is an overview:
searchdict = {
    "pid": 1004,
    "pid_re": "^1.*",
    "title": "IME",
    "title_re": "IM?E",
    "windowtext": "Default IME",
    "windowtext_re": r"Default\s*IME",
    "hwnd": 197666,
    "hwnd_re": r"\d+",
    "length": 12,
    "length_re": "[0-9]+",
    "tid": 6636,
    "tid_re": r"6\d+36",
    "status": "invisible",
    "status_re": "(?:in)?visible",
    "coords_client": (0, 0, 0, 0),
    "coords_client_re": r"\([\d,\s]+\)",
    "dim_client": (0, 0),
    "dim_client_re": "(1?0, 0)",
    "coords_win": (0, 0, 0, 0),
    "coords_win_re": r"\)$",
    "dim_win": (0, 0),
    "dim_win_re": "(1?0, 0)",
    "class_name": "IME",
    "class_name_re": "I?ME$",
    "path": "C:\\Windows\\ImmersiveControlPanel\\SystemSettings.exe",
    "path_re": "SystemSettings.exe",
}


capture_window_ddagrab(
	searchdict={
		"title_re": ".*Notepad.*",
		"status": "visible",
		"path_re": ".*notepad.exe.*",
	},
	frames=30,
	draw_mouse=True,
	allowed_screens=(), # Slow
)
capture_window_ddagrab(
	searchdict={
		"title_re": ".*Notepad.*",
		"status": "visible",
		"path_re": ".*notepad.exe.*",
	},
	frames=30,
	draw_mouse=True,
	allowed_screens=(0,), # Fast - captures only first screen
)
```

## GDIgrab

### Capturing (background) windows using GDIgrab

In addition to capturing windows using GPU acceleration, FFmpegshot also provides the
option to capture windows using gdigrab. Here are some important details about using gdigrab for window capture:

Capturing background windows: With gdigrab, it is possible to capture background windows. 
This means you can capture windows that are not in the foreground or currently active. 
It provides more flexibility in capturing specific windows of interest.

Resizing window capture: Unlike GPU-accelerated window capture, when you resize the window being 
captured using gdigrab, the resulting screenshot will not be automatically resized. 
The screenshot will maintain the original size of the window, regardless of any subsequent resizing.

Handling windows with the same title: One advantage of using this method is that it bypasses the problem of 
capturing windows with the same title. When using the title parameter in gdigrab, 
it creates a unique identification for the window for a short duration (e.g., 2 seconds)
 until the capturing starts. This ensures that the correct window with the specified 
 title is captured, even if multiple windows share the same title.

To utilize gdigrab for window capture and overcome the issue of multiple windows with the same title, 
you can use the capture_window_gdigrab function provided by FFmpegshot. 
By specifying search criteria in the searchdict parameter, including the window title or other properties, you can precisely target the desired window for capture.

By incorporating gdigrab into your screen capture workflow, you can capture background windows, 
handle windows with the same title, and obtain accurate representations of window content.
This offers additional flexibility and reliability for capturing specific windows of interest
in your screen recording or screenshot tasks.

### Capturing a Window 

[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/capture_capture_window_gdigrab_notpad_60/video_591.mp4)

```python

with FFmpegshot() as sc:
	timestamp = timest()
	piciter = sc.capture_window_gdigrab( # generator
		searchdict={
			"title_re": ".*Notepad.*",
			"status": "visible",
			"path_re": ".*notepad.exe.*",
		},
		frames=60,
		draw_mouse=True,
	)

```
### Capturing 2 screens (3840x1080)

[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/capture_all_screens_gdigrab_60/video_586.mp4)

The fastest methods on my PC for such a big area

```python
with FFmpegshot() as sc:
	timestamp = timest()
	piciter = sc.capture_all_screens_gdigrab( # generator
		frames=60,
		draw_mouse=True,
	)
```

### Capturing 1 screen

[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/capture_one_screen_gdigrab_60/video_590.mp4)


```python
with FFmpegshot() as sc:
	piciter = sc.capture_one_screen_gdigrab(
		monitor_index=0,
		frames=60,
		draw_mouse=True,
	)
```


## Ctypes


### Ideal for scenarios with minimal screenshot requirements


In addition to the impressive functionality offered by FFmpegshot, you can also utilize ctypes for capturing screens. FFmpegshot incorporates a supplementary module called [fast_ctypes_screenshots](https://github.com/hansalemaos/fast_ctypes_screenshots), specifically designed to enable screen capturing using ctypes.

Starting FFmpeg incurs a substantial overhead, especially if you only require a small number of screenshots. In such cases, you can employ these ctypes-based methods, which deliver exceptional speed and efficiency.

The following static functions are at your disposal for ctypes-based screen capture:

### capture_all_screens_ctypes(ascontiguousarray=False)

Captures all screens using ctypes, allowing you to specify whether to return an array as a contiguous memory block (ascontiguousarray).


### capture_one_screen_ctypes(monitor=0, ascontiguousarray=False)

Captures a specific screen using ctypes, with an optional parameter to specify the monitor index.


### capture_box_ctypes(rectangle: tuple[int, int, int, int], ascontiguousarray=False)

Captures a region defined by a rectangle using ctypes, with an optional parameter to specify whether to return a contiguous memory block.


### capture_window_window_ctypes(hwnd: int, ascontiguousarray=False)

Captures a window using ctypes based on its window handle (HWND), with an optional parameter to control the memory block.


### capture_window_client_ctypes(hwnd: int, ascontiguousarray=False)

Captures the client area of a window using ctypes based on its window handle (HWND), with an optional parameter to specify the memory block.


Here's an example of capturing all screens using ctypes in combination with FFmpegshot:

In this example, the capture_all_screens_ctypes function is used to capture all screens, with the 
ascontiguousarray parameter set to True to ensure a contiguous memory block. The captured 
frames are then copied to a new list, piciter2_, to address any buffer-related considerations.

By leveraging ctypes-based screen capturing through FFmpegshot, you can benefit from its 
functionality while exploring different capturing methods. This provides additional 
flexibility and options for your screen capture requirements.

```python
with FFmpegshot() as sc:
    piciter_ = sc.capture_all_screens_ctypes(ascontiguousarray=True)
    piciter2_ = []
    for ini, pi in enumerate(piciter_):
        piciter2_.append(pi.copy())
        if ini == 100:
            break
```


## Multiprocessing - capture various windows, screens or areas

[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/multicapture/capture_one_screen_ddagrab.mp4)


An example of how to record various screens separately.
It captures screenshots using the ddagrab method.
While there may be a slight delay in capturing the screenshots, 
it's important to note that I was simultaneously recording
two streams, one using Python and the other using OBS.

Here are some important points to consider:

The function works similar to the normal screenshot functions but requires you 
to create dictionaries for each function call.


When using multiprocessing, you can access the latest captured screenshots using procresults.results[index][-1].
The variable "prore" represents the numerical index (e.g., 0 and 1), and [-1] retrieves the newest screenshot.

To enable multiprocessing and handle the results, you can import the necessary modules:
from ffmpeg_screenshot_pipe.ffmpeg_screenshot_pipe_multi import runasync, procresults

The module procresults provides additional settings to control the process:
- procresults.dequebuffer determines the maximum number of screenshots saved in procresults.results[index].

- procresults.asyncsleep specifies the sleep duration (in seconds) between asynchronous function calls.
Setting it to zero can cause the program to freeze.

- procresults.sleeptimeafterkill sets the time (in seconds) to wait after killing the FFmpeg process
before calling sys.exit() to terminate the program gracefully.

- procresults.stop_flag is a Value object that, when set to True, terminates all processes.
It's important to allow sufficient time (e.g., 5 seconds) for the program to exit gracefully to avoid
lingering ffmpeg.exe zombie processes.

The function procresults.sleeptimebeforekill determines the time interval before forcefully 
terminating the processes.
By default, it uses a lambda function to calculate 90% of procresults.sleeptimeafterkill.

It's worth noting that all functions ending with _gdigrab or _ddagrab can be used in multiprocessing.
If you have a weaker CPU (e.g., Intel 5) but a powerful GPU (e.g., GeForce RTX 2060 SUPER), it's recommended
to use the _ddagrab functions for better performance.

### Whole example 

```python

import cv2
import kthread
from time import strftime
from ffmpeg_screenshot_pipe.ffmpeg_screenshot_pipe_multi import runasync, procresults

procresults.dequebuffer = 24
procresults.asyncsleep = 0.001
procresults.sleeptimeafterkill = 5
procresults.sleeptimebeforekill = lambda: procresults.sleeptimeafterkill * 0.9
activethreads = []

timest = lambda: strftime("%Y_%m_%d_%H_%M_%S")


def start_display_thread():
    activethreads.append(kthread.KThread(target=display_thread, name="cv2function"))
    activethreads[-1].daemon = True
    activethreads[-1].start()


def display_thread(stop_at_frame=None):
    co = 0
    goback = False
    cv2.waitKey(0)
    cv2.destroyAllWindows()
    while True:
        try:
            keys = list(procresults.results.keys())
            for prore in keys:
                try:
                    cv2.imshow(str(prore), procresults.results[prore][-1]) # this is how you have to access the results
                except Exception:
                    pass
                if cv2.waitKey(1) & 0xFF == ord("q"):
                    cv2.waitKey(0)
                    goback = True
                    break
                if stop_at_frame:
                    co = co + 1
                    if co > stop_at_frame:
                        cv2.destroyAllWindows()
                        goback = True
                    break
            if goback:
                break
        except Exception as e:
            print(e)
            continue

    cv2.destroyAllWindows()
    procresults.stopfunction()


def kill_active_threads():
    for th in activethreads:
        if th.is_alive():
            th.kill()


def run_parallel(dictlist):
    runasync(dictlist)
    kill_active_threads()


if __name__ == "__main__": # don't forget that when using multiprocessing!!
	
	# call the function that is doing something with the screenshots (in this case just showing) 
	# as a thread before you run runasync. 
    start_display_thread()
	
	
    dict0 = dict(
        function="capture_one_screen_ddagrab",
        monitor_index=0,
        frames=25,
        draw_mouse=True,
    )

    dict1 = dict(
        function="capture_one_screen_ddagrab",
        monitor_index=1,
        frames=25,
        draw_mouse=True,
    )
    run_parallel([dict0, dict1])


```
### More examples with multiprocessing

[Check out the result - Video - Capturing 3 Notepad Windows at the same time ](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/multicapture/capturing_3_notepad_windows.mp4)

[Check out the result - Video - Capturing 3 areas simultaneously ](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/multicapture/capture_3_boxes.mp4)

```python
kill_active_threads()  # killing the function start_display_thread
dict2 = dict(
	function="capture_box_ddagrab",
	rectangle=(100, 100, 500, 500),
	frames=30,
	draw_mouse=True,
)
dict3 = dict(
	function="capture_box_ddagrab",
	rectangle=(500, 500, 1000, 1000),
	frames=30,
	draw_mouse=True,
)
dict4 = dict(
	function="capture_box_ddagrab",
	rectangle=(2011, 900, 3400, 1070),
	frames=30,
	draw_mouse=True,
)

dict5 = dict(
	function="capture_window_ddagrab",
	searchdict={
		"hwnd": 328832,
		"status": "visible",
		"path_re": ".*notepad.exe.*",
	},
	frames=30,
	draw_mouse=True,
	allowed_screens=(0,),
	return_copy=True,
)

# "capturing_3_notepad_windows.mp4"
dict6 = dict(
	function="capture_window_ddagrab",
	searchdict={
		"hwnd": 591080,
		"status": "visible",
		"path_re": ".*notepad.exe.*",
	},
	frames=30,
	draw_mouse=True,
	allowed_screens=(0,),
	return_copy=True,
)
dict7 = dict(
	function="capture_window_ddagrab",
	searchdict={
		"hwnd": 67488,
		"status": "visible",
		"path_re": ".*notepad.exe.*",
	},
	frames=30,
	draw_mouse=True,
	allowed_screens=(0,),
	return_copy=True,
)
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/ffmpeg_screenshot_pipe",
    "name": "ffmpeg-screenshot-pipe",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "screenshots,mss,fast,win32,ffmpeg,gdigrab,ddagrab",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/39/26/36edc2ab7b5ec5ad1a232e925664434cd6f95bf2f17e79d3903976c39b6e/ffmpeg_screenshot_pipe-0.10.tar.gz",
    "platform": null,
    "description": "# Capture Screenshots with Unparalleled Speed and Versatile Features - GDIgrab, DDAgrab, Ctypes, Multiprocessing, GPU, Mouse Capture ...\r\n\r\n\r\n### pip install ffmpeg-screenshot-pipe\r\n\r\n## What is so special about ffmpeg-screenshot-pipe\r\n\r\n- 3 methods of capturing screenshots: GDIgrab, DDAgrab or Ctypes\r\n- Faster than all other libraries \r\n- Efficient mouse capture (with/without)\r\n- Integration with FFmpeg for exceptional speed\r\n- Capture windows running in the background\r\n- Only a few dependencies - all of them pure Python except Numpy \r\n- Specify windows using HWND and (regex)search for targeted capture\r\n- GPU acceleration for enhanced performance\r\n- High-quality screen recordings and screenshots\r\n- Versatile and powerful functionality\r\n- Seamless integration with numpy for data processing workflows\r\n- Fine-grained control over screen capture settings\r\n- Minimal performance impact\r\n- Suitable for content creators, software developers, and individuals with diverse screen capture needs.\r\n- Multiprocessing for capturing various windows/screens/areas \r\n\r\nFFmpegshot is a versatile and powerful class designed for capturing screen recordings and screenshots. It offers a wide range of options and features that make it suitable for various use cases.\r\n\r\nThis class is particularly useful for people who require high-quality screen capture capabilities with advanced functionality. It provides efficient and fast screen capturing capabilities, thanks to its integration with \r\n[FFmpeg - the Gold Standard of Video Encoding/Decoding](https://ffmpeg.org/) , all captured data is conveniently converted to the popular [Numpy](https://numpy.org/doc/stable/index.html#) format, enabling seamless integration with other data processing workflows.\r\n\r\nOne of the key advantages of FFmpegshot is its exceptional speed, surpassing all other screen capturing methods. By leveraging FFmpeg's optimized encoding and decoding algorithms, it ensures efficient processing and minimal performance impact, resulting in swift and responsive screen captures.\r\n\r\nFurthermore, FFmpegshot offers a plethora of options to cater to diverse needs. Users can capture mouse movements, extract frames from background windows, specify individual windows using HWND for capture, and even leverage GPU acceleration for enhanced performance. These features provide users with fine-grained control and flexibility over their screen capture requirements.\r\n\r\nWhether it's for content creators seeking professional-grade screen recordings, software developers needing precise visual debugging tools, or individuals wanting efficient and reliable screen capture capabilities, FFmpegshot stands out as a powerful solution. Its combination of speed, versatility, and an array of options makes it an ideal choice for capturing and processing screen data.\r\n\r\n## Very important: Find the right frame rate (fps)! \r\n\r\n### Find the optimal frame rate based on performance testing to avoid buffer read/write balance issue.\r\n\r\n\r\n### Read this part very carefully!\r\n\r\n```python\r\n\r\nfrom ffmpeg_screenshot_pipe import FFmpegshot, get_max_framerate\r\n\r\n# Use this function to get a rough idea how high you can go! \r\n\r\nmafa = get_max_framerate(\r\n\tfunction=\"capture_all_screens_gdigrab\",\r\n\tstartframes=45,\r\n\tendframes=150,\r\n\ttimeout=2,\r\n\tframedifference=100,\r\n\tsleeptimebeforekilling=1,\r\n)\r\n\r\n# Frame rate testing results:\r\n# 64 FPS -> 115 frames captured\r\n# 65 FPS -> 115 frames captured\r\n# 66 FPS -> 119 frames captured\r\n# 67 FPS -> 120 frames captured\r\n# 68 FPS -> 121 frames captured\r\n# 69 FPS -> 123 frames captured\r\n# 70 FPS -> 176 frames captured A difference of more than a hundred frames -> (buffer read/write balance issue)\r\n\r\n\r\n\r\n# Based on the results, it seems that going beyond 69 frames per second may cause buffer read/write balance issues\r\n# (on my PC - Intel i5, NVIDIA GeForce RTX 2060 SUPER, 64 GB RAM)\r\n# It is advisable to stay a few frames below the limit to ensure smooth performance.\r\n# Note that setting a very high frame rate (e.g., 240 FPS) may result in significantly lower actual frame rates\r\n# due to buffer constraints.\r\n\r\n```\r\n\r\n#### Some functions to test the performance of this module\r\n\r\n\r\n```python\r\ndef show_screenshot(screenshot):\r\n    cv2.imshow(\"test\", screenshot)\r\n    if cv2.waitKey(1) & 0xFF == ord(\"q\"):\r\n        cv2.destroyAllWindows()\r\n        return False\r\n    return True\r\ndef show_screenshot_bench(\r\n    screenshotiter, stop_at_frame=100, quitkey=\"q\", show_screenshot=True\r\n):\r\n    def show_screenshotx():\r\n        cv2.imshow(\"test\", screenshot)\r\n        if cv2.waitKey(1) & 0xFF == ord(quitkey):\r\n            cv2.destroyAllWindows()\r\n            return False\r\n        return True\r\n\r\n    framecounter = 0\r\n    fps = 0\r\n    start_time = time()\r\n    for screenshot in screenshotiter:\r\n        if stop_at_frame:\r\n            if framecounter > stop_at_frame:\r\n                break\r\n            framecounter += 1\r\n        if show_screenshot:\r\n            sho = show_screenshotx()\r\n        else:\r\n            sho = True\r\n        fps += 1\r\n        if not sho:\r\n            break\r\n    print(f\"fast_ctypes_screenshots: {fps / (time() - start_time)}\")\r\n    cv2.destroyAllWindows()\r\n```\r\n\r\n## DDAgrab methods (GPU)\r\n\r\nCaptures the Windows Desktop via Desktop Duplication API (D3D11) - same that OBS uses.\r\nNote: Nvidia GPU is required to utilize these functions effectively\r\n\r\n### Convenient usage with \"with\" statement\r\n\r\nAll functions with the suffix _ddagrab/_gdigrab can be called using the \"with\" statement\r\n\r\n\r\n### DDAgrab - capture one screen \r\n\r\n[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/capture_one_screen_ddagrab_60_frames/video_588.mp4)\r\n\r\n```python\r\n\t\r\n\r\nwith FFmpegshot() as sc:\r\n\tstart_time, fps = time(), 0\r\n\tfor screenshot in sc.capture_one_screen_ddagrab(\r\n\t\t\tmonitor_index=0,\r\n\t\t\tframes=60,\r\n\t\t\tdraw_mouse=True,\r\n\t):\r\n\t\tcont = show_screenshot(screenshot)\r\n\t\tif not cont:\r\n\t\t\tbreak\r\n\t\tfps += 1\r\n\tprint(f'FPS: {fps / (time() - start_time)}')\r\n\r\n#####################################################################\t\t\r\n\r\n# Reminder: Ensure to terminate FFmpeg instances if not using \"with\" statement\r\nffmpeg_screenshot = FFmpegshot()\r\n# Capture and display screenshots\r\npiciter = ffmpeg_screenshot.capture_one_screen_ddagrab(\r\n\tmonitor_index=0,\r\n\tframes=60,\r\n\tdraw_mouse=True,\r\n)\r\n# Terminate FFmpeg instances after usage\r\nshow_screenshot_bench(\r\n\tpiciter, stop_at_frame=100, quitkey=\"q\", show_screenshot=True\r\n)\r\n# don't forget to kill the ffmpeg instances after you are done\r\nffmpeg_screenshot.kill_ffmpeg()\r\n\t\r\n```\r\n### DDAgrab - capture all screens\r\n\r\n[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/capture_all_screens_ddagrab_24_frames/video_228.mp4)\r\n\r\n```python\r\nwith FFmpegshot() as sc:\r\n\ttimestamp = timest()\r\n\tpiciter = sc.capture_all_screens_ddagrab(  # generator\r\n\t\tframes=24, draw_mouse=True, return_empty=False\r\n\t)\r\n\t# Do something here ....\r\n\r\n\r\n\t# Important Note: The screenshots are taken individually and need to be concatenated for a continuous stream.\r\n\t# Traditional methods like cv2.hstack, cv2.vstack, or np.concatenate are too slow for real-time streaming.\r\n\t# When setting return_empty=True, the function returns an empty array, and the screenshot can be accessed\r\n\t# through temparrays.horizontal / temparrays.vertical (using https://github.com/hansalemaos/fastimgconcat).\r\n\t# The values in temparrays.vertical / temparrays.horizontal will be updated in the next iteration to avoid\r\n\t# allocating new memory. It is recommended to process the output data immediately after each iteration.\r\n\t# If you still need the arrays, make a copy (e.g., temparrays.horizontal.copy()), but keep in mind that copying\r\n\t# is an expensive operation.\r\n\t# The maximum frame rate achievable depends on the output video. For streaming purposes, up to 45 frames per\r\n\t# second (on my Intel i5, NVIDIA GeForce RTX 2060 SUPER, 64 RAM) can be achieved, but it is going to be much\r\n\t# lower if you write the file to your HDD..\r\n```\r\n\r\n### DDAgrab - capture a screenshot of a certain area\r\n\r\n[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/capture_box_ddagrab_60_frames_1500x800/video_590.mp4)\r\n\r\n```python\r\n\r\nwith FFmpegshot() as sc:\r\n\ttimestamp = timest()\r\n\tpiciter = sc.capture_box_ddagrab(  # generator \r\n\t\trectangle=(100, 200, 1600, 1000), # left, top, right, bottom\r\n\t\tframes=60,\r\n\t\tdraw_mouse=True,\r\n\t)\r\n\t\r\n\r\n```\r\n\r\n\r\n### DDAgrab - Capturing a window using GPU acceleration\r\n\r\n[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/capture_capture_window_ddagrab_notpad_60_client/video_589.mp4)\r\n\r\n\r\n[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/capture_capture_window_ddagrab_notpad_60_window/video_588.mp4)\r\n\r\n\r\n\r\nTo capture a window using the GPU, you can leverage the power of FFmpegshot with the following considerations:\r\n\r\nRestricting the screen capture to a specific screen: If you have multiple screens, it is recommended to \r\ncapture only the screen where your application is running. For example, if your app is on the \r\nfirst screen, you can pass allowed_screens=(0,). By doing so, the capture process becomes \r\nmore efficient. If you don't specify allowed_screens and have multiple screens, the capture process \r\nmay become slower because the images are concatenated before being cropped to the appropriate size.\r\n\r\nLimitations with capturing background windows: \r\nThis function is not designed to capture background windows (see gdigrab). \r\nWhen you resize the window being captured, \r\nthe resulting screenshot will also be resized accordingly.\r\n\r\nIn addition, you can utilize the searchdict dictionary to search for specific windows based on various \r\ncriteria such as pid, title, windowtext, hwnd, length, tid, status, coords_client, dim_client, \r\ncoords_win, dim_win, class_name, and path. This allows you to target \r\nspecific windows for capturing. More details about the search criteria \r\ncan be found in the appshwnd GitHub repository.  https://github.com/hansalemaos/appshwnd\r\n\r\n```python\r\n\r\n# Here is an overview:\r\nsearchdict = {\r\n    \"pid\": 1004,\r\n    \"pid_re\": \"^1.*\",\r\n    \"title\": \"IME\",\r\n    \"title_re\": \"IM?E\",\r\n    \"windowtext\": \"Default IME\",\r\n    \"windowtext_re\": r\"Default\\s*IME\",\r\n    \"hwnd\": 197666,\r\n    \"hwnd_re\": r\"\\d+\",\r\n    \"length\": 12,\r\n    \"length_re\": \"[0-9]+\",\r\n    \"tid\": 6636,\r\n    \"tid_re\": r\"6\\d+36\",\r\n    \"status\": \"invisible\",\r\n    \"status_re\": \"(?:in)?visible\",\r\n    \"coords_client\": (0, 0, 0, 0),\r\n    \"coords_client_re\": r\"\\([\\d,\\s]+\\)\",\r\n    \"dim_client\": (0, 0),\r\n    \"dim_client_re\": \"(1?0, 0)\",\r\n    \"coords_win\": (0, 0, 0, 0),\r\n    \"coords_win_re\": r\"\\)$\",\r\n    \"dim_win\": (0, 0),\r\n    \"dim_win_re\": \"(1?0, 0)\",\r\n    \"class_name\": \"IME\",\r\n    \"class_name_re\": \"I?ME$\",\r\n    \"path\": \"C:\\\\Windows\\\\ImmersiveControlPanel\\\\SystemSettings.exe\",\r\n    \"path_re\": \"SystemSettings.exe\",\r\n}\r\n\r\n\r\ncapture_window_ddagrab(\r\n\tsearchdict={\r\n\t\t\"title_re\": \".*Notepad.*\",\r\n\t\t\"status\": \"visible\",\r\n\t\t\"path_re\": \".*notepad.exe.*\",\r\n\t},\r\n\tframes=30,\r\n\tdraw_mouse=True,\r\n\tallowed_screens=(), # Slow\r\n)\r\ncapture_window_ddagrab(\r\n\tsearchdict={\r\n\t\t\"title_re\": \".*Notepad.*\",\r\n\t\t\"status\": \"visible\",\r\n\t\t\"path_re\": \".*notepad.exe.*\",\r\n\t},\r\n\tframes=30,\r\n\tdraw_mouse=True,\r\n\tallowed_screens=(0,), # Fast - captures only first screen\r\n)\r\n```\r\n\r\n## GDIgrab\r\n\r\n### Capturing (background) windows using GDIgrab\r\n\r\nIn addition to capturing windows using GPU acceleration, FFmpegshot also provides the\r\noption to capture windows using gdigrab. Here are some important details about using gdigrab for window capture:\r\n\r\nCapturing background windows: With gdigrab, it is possible to capture background windows. \r\nThis means you can capture windows that are not in the foreground or currently active. \r\nIt provides more flexibility in capturing specific windows of interest.\r\n\r\nResizing window capture: Unlike GPU-accelerated window capture, when you resize the window being \r\ncaptured using gdigrab, the resulting screenshot will not be automatically resized. \r\nThe screenshot will maintain the original size of the window, regardless of any subsequent resizing.\r\n\r\nHandling windows with the same title: One advantage of using this method is that it bypasses the problem of \r\ncapturing windows with the same title. When using the title parameter in gdigrab, \r\nit creates a unique identification for the window for a short duration (e.g., 2 seconds)\r\n until the capturing starts. This ensures that the correct window with the specified \r\n title is captured, even if multiple windows share the same title.\r\n\r\nTo utilize gdigrab for window capture and overcome the issue of multiple windows with the same title, \r\nyou can use the capture_window_gdigrab function provided by FFmpegshot. \r\nBy specifying search criteria in the searchdict parameter, including the window title or other properties, you can precisely target the desired window for capture.\r\n\r\nBy incorporating gdigrab into your screen capture workflow, you can capture background windows, \r\nhandle windows with the same title, and obtain accurate representations of window content.\r\nThis offers additional flexibility and reliability for capturing specific windows of interest\r\nin your screen recording or screenshot tasks.\r\n\r\n### Capturing a Window \r\n\r\n[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/capture_capture_window_gdigrab_notpad_60/video_591.mp4)\r\n\r\n```python\r\n\r\nwith FFmpegshot() as sc:\r\n\ttimestamp = timest()\r\n\tpiciter = sc.capture_window_gdigrab( # generator\r\n\t\tsearchdict={\r\n\t\t\t\"title_re\": \".*Notepad.*\",\r\n\t\t\t\"status\": \"visible\",\r\n\t\t\t\"path_re\": \".*notepad.exe.*\",\r\n\t\t},\r\n\t\tframes=60,\r\n\t\tdraw_mouse=True,\r\n\t)\r\n\r\n```\r\n### Capturing 2 screens (3840x1080)\r\n\r\n[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/capture_all_screens_gdigrab_60/video_586.mp4)\r\n\r\nThe fastest methods on my PC for such a big area\r\n\r\n```python\r\nwith FFmpegshot() as sc:\r\n\ttimestamp = timest()\r\n\tpiciter = sc.capture_all_screens_gdigrab( # generator\r\n\t\tframes=60,\r\n\t\tdraw_mouse=True,\r\n\t)\r\n```\r\n\r\n### Capturing 1 screen\r\n\r\n[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/capture_one_screen_gdigrab_60/video_590.mp4)\r\n\r\n\r\n```python\r\nwith FFmpegshot() as sc:\r\n\tpiciter = sc.capture_one_screen_gdigrab(\r\n\t\tmonitor_index=0,\r\n\t\tframes=60,\r\n\t\tdraw_mouse=True,\r\n\t)\r\n```\r\n\r\n\r\n## Ctypes\r\n\r\n\r\n### Ideal for scenarios with minimal screenshot requirements\r\n\r\n\r\nIn addition to the impressive functionality offered by FFmpegshot, you can also utilize ctypes for capturing screens. FFmpegshot incorporates a supplementary module called [fast_ctypes_screenshots](https://github.com/hansalemaos/fast_ctypes_screenshots), specifically designed to enable screen capturing using ctypes.\r\n\r\nStarting FFmpeg incurs a substantial overhead, especially if you only require a small number of screenshots. In such cases, you can employ these ctypes-based methods, which deliver exceptional speed and efficiency.\r\n\r\nThe following static functions are at your disposal for ctypes-based screen capture:\r\n\r\n### capture_all_screens_ctypes(ascontiguousarray=False)\r\n\r\nCaptures all screens using ctypes, allowing you to specify whether to return an array as a contiguous memory block (ascontiguousarray).\r\n\r\n\r\n### capture_one_screen_ctypes(monitor=0, ascontiguousarray=False)\r\n\r\nCaptures a specific screen using ctypes, with an optional parameter to specify the monitor index.\r\n\r\n\r\n### capture_box_ctypes(rectangle: tuple[int, int, int, int], ascontiguousarray=False)\r\n\r\nCaptures a region defined by a rectangle using ctypes, with an optional parameter to specify whether to return a contiguous memory block.\r\n\r\n\r\n### capture_window_window_ctypes(hwnd: int, ascontiguousarray=False)\r\n\r\nCaptures a window using ctypes based on its window handle (HWND), with an optional parameter to control the memory block.\r\n\r\n\r\n### capture_window_client_ctypes(hwnd: int, ascontiguousarray=False)\r\n\r\nCaptures the client area of a window using ctypes based on its window handle (HWND), with an optional parameter to specify the memory block.\r\n\r\n\r\nHere's an example of capturing all screens using ctypes in combination with FFmpegshot:\r\n\r\nIn this example, the capture_all_screens_ctypes function is used to capture all screens, with the \r\nascontiguousarray parameter set to True to ensure a contiguous memory block. The captured \r\nframes are then copied to a new list, piciter2_, to address any buffer-related considerations.\r\n\r\nBy leveraging ctypes-based screen capturing through FFmpegshot, you can benefit from its \r\nfunctionality while exploring different capturing methods. This provides additional \r\nflexibility and options for your screen capture requirements.\r\n\r\n```python\r\nwith FFmpegshot() as sc:\r\n    piciter_ = sc.capture_all_screens_ctypes(ascontiguousarray=True)\r\n    piciter2_ = []\r\n    for ini, pi in enumerate(piciter_):\r\n        piciter2_.append(pi.copy())\r\n        if ini == 100:\r\n            break\r\n```\r\n\r\n\r\n## Multiprocessing - capture various windows, screens or areas\r\n\r\n[Check out the result - Video](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/multicapture/capture_one_screen_ddagrab.mp4)\r\n\r\n\r\nAn example of how to record various screens separately.\r\nIt captures screenshots using the ddagrab method.\r\nWhile there may be a slight delay in capturing the screenshots, \r\nit's important to note that I was simultaneously recording\r\ntwo streams, one using Python and the other using OBS.\r\n\r\nHere are some important points to consider:\r\n\r\nThe function works similar to the normal screenshot functions but requires you \r\nto create dictionaries for each function call.\r\n\r\n\r\nWhen using multiprocessing, you can access the latest captured screenshots using procresults.results[index][-1].\r\nThe variable \"prore\" represents the numerical index (e.g., 0 and 1), and [-1] retrieves the newest screenshot.\r\n\r\nTo enable multiprocessing and handle the results, you can import the necessary modules:\r\nfrom ffmpeg_screenshot_pipe.ffmpeg_screenshot_pipe_multi import runasync, procresults\r\n\r\nThe module procresults provides additional settings to control the process:\r\n- procresults.dequebuffer determines the maximum number of screenshots saved in procresults.results[index].\r\n\r\n- procresults.asyncsleep specifies the sleep duration (in seconds) between asynchronous function calls.\r\nSetting it to zero can cause the program to freeze.\r\n\r\n- procresults.sleeptimeafterkill sets the time (in seconds) to wait after killing the FFmpeg process\r\nbefore calling sys.exit() to terminate the program gracefully.\r\n\r\n- procresults.stop_flag is a Value object that, when set to True, terminates all processes.\r\nIt's important to allow sufficient time (e.g., 5 seconds) for the program to exit gracefully to avoid\r\nlingering ffmpeg.exe zombie processes.\r\n\r\nThe function procresults.sleeptimebeforekill determines the time interval before forcefully \r\nterminating the processes.\r\nBy default, it uses a lambda function to calculate 90% of procresults.sleeptimeafterkill.\r\n\r\nIt's worth noting that all functions ending with _gdigrab or _ddagrab can be used in multiprocessing.\r\nIf you have a weaker CPU (e.g., Intel 5) but a powerful GPU (e.g., GeForce RTX 2060 SUPER), it's recommended\r\nto use the _ddagrab functions for better performance.\r\n\r\n### Whole example \r\n\r\n```python\r\n\r\nimport cv2\r\nimport kthread\r\nfrom time import strftime\r\nfrom ffmpeg_screenshot_pipe.ffmpeg_screenshot_pipe_multi import runasync, procresults\r\n\r\nprocresults.dequebuffer = 24\r\nprocresults.asyncsleep = 0.001\r\nprocresults.sleeptimeafterkill = 5\r\nprocresults.sleeptimebeforekill = lambda: procresults.sleeptimeafterkill * 0.9\r\nactivethreads = []\r\n\r\ntimest = lambda: strftime(\"%Y_%m_%d_%H_%M_%S\")\r\n\r\n\r\ndef start_display_thread():\r\n    activethreads.append(kthread.KThread(target=display_thread, name=\"cv2function\"))\r\n    activethreads[-1].daemon = True\r\n    activethreads[-1].start()\r\n\r\n\r\ndef display_thread(stop_at_frame=None):\r\n    co = 0\r\n    goback = False\r\n    cv2.waitKey(0)\r\n    cv2.destroyAllWindows()\r\n    while True:\r\n        try:\r\n            keys = list(procresults.results.keys())\r\n            for prore in keys:\r\n                try:\r\n                    cv2.imshow(str(prore), procresults.results[prore][-1]) # this is how you have to access the results\r\n                except Exception:\r\n                    pass\r\n                if cv2.waitKey(1) & 0xFF == ord(\"q\"):\r\n                    cv2.waitKey(0)\r\n                    goback = True\r\n                    break\r\n                if stop_at_frame:\r\n                    co = co + 1\r\n                    if co > stop_at_frame:\r\n                        cv2.destroyAllWindows()\r\n                        goback = True\r\n                    break\r\n            if goback:\r\n                break\r\n        except Exception as e:\r\n            print(e)\r\n            continue\r\n\r\n    cv2.destroyAllWindows()\r\n    procresults.stopfunction()\r\n\r\n\r\ndef kill_active_threads():\r\n    for th in activethreads:\r\n        if th.is_alive():\r\n            th.kill()\r\n\r\n\r\ndef run_parallel(dictlist):\r\n    runasync(dictlist)\r\n    kill_active_threads()\r\n\r\n\r\nif __name__ == \"__main__\": # don't forget that when using multiprocessing!!\r\n\t\r\n\t# call the function that is doing something with the screenshots (in this case just showing) \r\n\t# as a thread before you run runasync. \r\n    start_display_thread()\r\n\t\r\n\t\r\n    dict0 = dict(\r\n        function=\"capture_one_screen_ddagrab\",\r\n        monitor_index=0,\r\n        frames=25,\r\n        draw_mouse=True,\r\n    )\r\n\r\n    dict1 = dict(\r\n        function=\"capture_one_screen_ddagrab\",\r\n        monitor_index=1,\r\n        frames=25,\r\n        draw_mouse=True,\r\n    )\r\n    run_parallel([dict0, dict1])\r\n\r\n\r\n```\r\n### More examples with multiprocessing\r\n\r\n[Check out the result - Video - Capturing 3 Notepad Windows at the same time ](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/multicapture/capturing_3_notepad_windows.mp4)\r\n\r\n[Check out the result - Video - Capturing 3 areas simultaneously ](https://github.com/hansalemaos/ffmpeg_screenshot_pipe/raw/main/examples/multicapture/capture_3_boxes.mp4)\r\n\r\n```python\r\nkill_active_threads()  # killing the function start_display_thread\r\ndict2 = dict(\r\n\tfunction=\"capture_box_ddagrab\",\r\n\trectangle=(100, 100, 500, 500),\r\n\tframes=30,\r\n\tdraw_mouse=True,\r\n)\r\ndict3 = dict(\r\n\tfunction=\"capture_box_ddagrab\",\r\n\trectangle=(500, 500, 1000, 1000),\r\n\tframes=30,\r\n\tdraw_mouse=True,\r\n)\r\ndict4 = dict(\r\n\tfunction=\"capture_box_ddagrab\",\r\n\trectangle=(2011, 900, 3400, 1070),\r\n\tframes=30,\r\n\tdraw_mouse=True,\r\n)\r\n\r\ndict5 = dict(\r\n\tfunction=\"capture_window_ddagrab\",\r\n\tsearchdict={\r\n\t\t\"hwnd\": 328832,\r\n\t\t\"status\": \"visible\",\r\n\t\t\"path_re\": \".*notepad.exe.*\",\r\n\t},\r\n\tframes=30,\r\n\tdraw_mouse=True,\r\n\tallowed_screens=(0,),\r\n\treturn_copy=True,\r\n)\r\n\r\n# \"capturing_3_notepad_windows.mp4\"\r\ndict6 = dict(\r\n\tfunction=\"capture_window_ddagrab\",\r\n\tsearchdict={\r\n\t\t\"hwnd\": 591080,\r\n\t\t\"status\": \"visible\",\r\n\t\t\"path_re\": \".*notepad.exe.*\",\r\n\t},\r\n\tframes=30,\r\n\tdraw_mouse=True,\r\n\tallowed_screens=(0,),\r\n\treturn_copy=True,\r\n)\r\ndict7 = dict(\r\n\tfunction=\"capture_window_ddagrab\",\r\n\tsearchdict={\r\n\t\t\"hwnd\": 67488,\r\n\t\t\"status\": \"visible\",\r\n\t\t\"path_re\": \".*notepad.exe.*\",\r\n\t},\r\n\tframes=30,\r\n\tdraw_mouse=True,\r\n\tallowed_screens=(0,),\r\n\treturn_copy=True,\r\n)\r\n```\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Capture Screenshots with Unparalleled Speed and Versatile Features - GDIgrab, DDAgrab, Ctypes, Multiprocessing, GPU, Mouse Capture...",
    "version": "0.10",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/ffmpeg_screenshot_pipe"
    },
    "split_keywords": [
        "screenshots",
        "mss",
        "fast",
        "win32",
        "ffmpeg",
        "gdigrab",
        "ddagrab"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d26d494c65a60dc91cc075af0f6a7e057b20dc1dfe6f3f9c5dd16c7744c1fd69",
                "md5": "fcaba6d2f7f538ebd65c33f6b4638e82",
                "sha256": "c9995dd0dd028c3fc766eef6198770bd97516613effa9fc4a2ea8b78af2076f1"
            },
            "downloads": -1,
            "filename": "ffmpeg_screenshot_pipe-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fcaba6d2f7f538ebd65c33f6b4638e82",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 29030991,
            "upload_time": "2023-05-22T00:31:55",
            "upload_time_iso_8601": "2023-05-22T00:31:55.257291Z",
            "url": "https://files.pythonhosted.org/packages/d2/6d/494c65a60dc91cc075af0f6a7e057b20dc1dfe6f3f9c5dd16c7744c1fd69/ffmpeg_screenshot_pipe-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "392636edc2ab7b5ec5ad1a232e925664434cd6f95bf2f17e79d3903976c39b6e",
                "md5": "e8e70416e5b7e45b51752475ae13b4e8",
                "sha256": "94353065abd5821b61788ac70c9f610cfc3394a49f0f152598211de55f26d855"
            },
            "downloads": -1,
            "filename": "ffmpeg_screenshot_pipe-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "e8e70416e5b7e45b51752475ae13b4e8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 28926500,
            "upload_time": "2023-05-22T00:32:12",
            "upload_time_iso_8601": "2023-05-22T00:32:12.707853Z",
            "url": "https://files.pythonhosted.org/packages/39/26/36edc2ab7b5ec5ad1a232e925664434cd6f95bf2f17e79d3903976c39b6e/ffmpeg_screenshot_pipe-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-22 00:32:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "ffmpeg_screenshot_pipe",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "ffmpeg-screenshot-pipe"
}
        
Elapsed time: 0.40855s