https://github.com/rayanalysis/panda3d-screenrecorder
An easy screen recorder that works with panda3d, and offers instant replay functionality.
https://github.com/rayanalysis/panda3d-screenrecorder
Last synced: 6 months ago
JSON representation
An easy screen recorder that works with panda3d, and offers instant replay functionality.
- Host: GitHub
- URL: https://github.com/rayanalysis/panda3d-screenrecorder
- Owner: rayanalysis
- License: bsd-3-clause
- Created: 2022-12-23T07:52:10.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-10T04:53:37.000Z (over 1 year ago)
- Last Synced: 2025-02-10T05:28:16.769Z (over 1 year ago)
- Language: Python
- Size: 28.3 KB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# panda3d-screenrecorder
An easy screen recorder that works with panda3d, and offers instant replay functionality.
This screen recorder currently supports the .mp4 format, and is threaded so as to be non-blocking to your game/program logic. The screen recorder saves live image data from your game/program into a Python dictionary which is kept at constant size. This allows instant access to a custom duration of gameplay footage.
You may specify a maximum number of stored frames, and set your framerate target. These values will determine your recording duration. You may also specify a custom resolution via buff_hw=[w,h] .
When RAM_mode=True , panda3d-screenrecorder will attempt to perform the entire conversion in system RAM, which gives a significant performance improvement. See the Usage sample for a listing of all the optional inputs to pandarecord.setup_sg() .
Set max_screens=int(some_int) to limit the amount of RAM committed to the image dictionary (default=5000).
When setting write_threads=int(some_int), keep in mind that anything above write_threads=1 is currently experimental, even if tacitly supported. Better async integration for file writes should come around after the 1.10.13 dev updates are official for async screenshots. This setting has no effect on RAM_mode=True, use_native=False runs.
## Prerequisites
- panda3d-1.10.13 (or higher)
- opencv-python
- numpy
- PIL
## Usage
Press 'p' to initiate the instant replay recording, once `setup_sg(base)` has been called.
```python
import pandarecord # this is the individual local file "pandarecord" containing the program definitions
base = ShowBase()
pandarecord.setup_sg(base) # setup_sg(input_np,output_file='screencap_vid',buff_hw=[720,400],use_clock=False,RAM_mode=True,max_screens=5000,cust_fr=60,use_native=False,write_threads=1,capture_key='p')
```
As of the current version, you will need to create the folder caps/ in your program directory to allow storage of the movie frames.
## TODO
- Updates forthcoming for async writes, and RAM_mode for use_native=True.