{"id":23288261,"url":"https://github.com/gruvw/pireplay","last_synced_at":"2025-06-23T12:36:53.955Z","repository":{"id":243657880,"uuid":"813042530","full_name":"gruvw/pireplay","owner":"gruvw","description":"Capture and instantly replay the last moments by using a web application controlling a Raspberry Pi with a camera.","archived":false,"fork":false,"pushed_at":"2025-05-26T14:36:08.000Z","size":3738,"stargazers_count":1,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-19T02:15:52.879Z","etag":null,"topics":["camera","cli","python3","raspberry-pi","rpi"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pireplay","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gruvw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"docs/roadmap.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-06-10T11:42:25.000Z","updated_at":"2025-05-26T14:36:11.000Z","dependencies_parsed_at":"2024-11-16T01:41:12.408Z","dependency_job_id":"8c81cd7f-0016-42e9-91aa-6d7feed84c66","html_url":"https://github.com/gruvw/pireplay","commit_stats":null,"previous_names":["gruvw/pi-replay"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/gruvw/pireplay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gruvw%2Fpireplay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gruvw%2Fpireplay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gruvw%2Fpireplay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gruvw%2Fpireplay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gruvw","download_url":"https://codeload.github.com/gruvw/pireplay/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gruvw%2Fpireplay/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261480616,"owners_count":23164946,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["camera","cli","python3","raspberry-pi","rpi"],"created_at":"2024-12-20T03:15:44.696Z","updated_at":"2025-06-23T12:36:48.941Z","avatar_url":"https://github.com/gruvw.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PiReplay\n\n\u003ca href=\"https://github.com/gruvw/pireplay/releases/latest\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/gruvw/pireplay?style=for-the-badge\u0026color=04cc04\" alt=\"Latest Release Badge\" /\u003e\u003c/a\u003e\n\nCapture a video and instantly replay the last moments from your phone or computer.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"350\" src=\"./docs/images/pictures/pireplay/PiReplay-front.jpg\"\u003e\n\u003c/p\u003e\n\nPiReplay is a device that allows you to instantly record and replay the past 5 to 60 seconds of real-life events directly from your phone or computer.\nThis has unlimited applications but is primarily useful when analyzing key moments in sports, capturing trick shots, reviewing gameplay, or simply reliving funny moments.\nYou simply press a button and instantly get a video of the last few seconds that just happened - live replay, IRL.\n\nThe device comes in two variants:\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cimg height=\"300\" src=\"./docs/images/pictures/pireplay/PiReplay-tripod.jpg\"\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003cimg height=\"300\" src=\"./docs/images/pictures/pireplay_mini/PiReplay_mini-tripod.jpg\"\u003e\u003c/td\u003e\n  \u003c/tr\u003e \n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003ePiReplay\u003c/br\u003e~100x75x45mm\u003c/td\u003e\n    \u003ctd align=\"center\"\u003ePiReplay Mini\u003c/br\u003e~80x40x25mm\u003c/td\u003e\n  \u003c/tr\u003e \n\u003c/table\u003e\n\nYou can capture replays from a locally hosted web application `pireplay.local`, which controls a [Raspberry Pi](https://www.raspberrypi.com) with a camera.\n\nTake a look at the project's [roadmap](docs/roadmap.md) to see upcoming features (along with all the work accomplished).\n\n**Note** - Check out the `pireplay` [Python](https://www.python.org) package (CLI) on PyPI: \u003chttps://pypi.org/project/pireplay\u003e (managed using [Poetry](https://python-poetry.org/)).\n\n## User Guide\n\n1. Make sure you stand close to a running PiReplay device.\n2. Using your phone or computer, connect to the PiReplay Wi-Fi network, usually named `PiReplay-XXXX` (the default password is `pireplay42`).\n3. Open a web browser and navigate to the following URL `http://pireplay.local` or `http://10.42.0.1` (you might need to accept security warning).\n4. Congratulations, you can now use the Web interface to capture, watch and download live replays!\n\nFeatures:\n\n- Press the **CAPTURE** button to save an instant replay save (you might need to wait a few seconds after pressing the button for the page to reload, avoid double pressing the CAPTURE button).\n- Browse and watch past replays.\n- Download replays directly to your phone or computer for saving and sharing them.\n- Access the settings page to change the replay duration and camera resolution.\n- Snapshot picture in the settings page for camera positioning.\n- Vertical/horizontal videos support\n- RESTful API to interoperate with other components of your digital system.\n\n**Warning** - There are currently no security feature built in the PiReplay software. You should consider that anyone accessing the PiReplay's network could be accessing replays and remotely operate the device.\n\nThis project is **not** (out of scope features or non-goals):\n\n- A live webcam feed.\n- A continuous video camera for long videos.\n- A video editor, editing must be done externally after downloading the replay.\n- A multi-camera synchronization system, only one camera per device is supported.\n- A home security video recording system.\n- A motion triggered or AI-based capture system, you must manually trigger replays.\n\n### User Interface\n\nWeb user interface from a phone:\n\n\u003cimg width=\"300\" src=\"./docs/images/UI/home.jpg\"\u003e \u003cimg width=\"300\" src=\"./docs/images/UI/settings.jpg\"\u003e \n\n## Project Structure\n\nA brief overview of the project's structure for quick reference:\n\n- [`cad`](./cad/): for 3D models files, 3D printing (case)\n- [`src`](./src/): the source code of the Python `pireplay` package\n\n## Do It Yourself\n\nFollow these instructions (tutorial) for setting up a fully functional **PiReplay** device.\n\n**PiReplay vs. PiReplay Mini**\n\nThe PiReplay Mini (~4 times smaller) was introduced into the project as a fun and compact alternative for space-constrained applications.\nHowever, it uses a smaller, resource limited microcomputer, making it not the best choice to perform high resolution video processing.\nTherefore, I recommend building the standard version of the PiReplay if space isn't a concern.\n\n### Requirements\n\n- Raspberry Pi board (recommended board: `Raspberry Pi 5 4GB` for PiReplay, or `Raspberry Pi Zero 2 W` for PiReplay Mini)\n- Cooling system (optional, better for the `Raspberry Pi 5`: Raspberry Pi Active Cooler for Pi 5)\n- Micro SD card (at least 64 GB)\n- Raspberry Pi Camera module 3 (regular 75° sensor)\n- CSI Camera FPC connector cable to Raspberry Pi (select the correct one depending on you Raspberry Pi board)\n- Raspberry Pi power supply (Micro USB/USB type C), ensuring sufficient voltage\n- PiReplay box (see below), 3D printer\n- A 1/4\"-20 UNC nut (optional, for mounting on a camera tripod)\n\n### PiReplay box\n\nYou can 3D print the corresponding enclosure for the PiReplay device.\n\n**Note** - Check out the project on Thingiverse: \u003chttps://www.thingiverse.com/thing:7048794\u003e.\n\n#### PiReplay\n\nFor the standard variant of the PiReplay (using the `Raspberry Pi 5`), choose one of the following base options:\n\n- With a standard tripod camera mount (1/4\"-20 UNC): [`./cad/pireplay/PiReplay-base_camera_mount.stl`](./cad/pireplay/PiReplay-base_camera_mount.stl)\n- With rail screw mounts: [`./cad/pireplay/PiReplay-base_screw_mount.stl`](./cad/pireplay/PiReplay-base_screw_mount.stl)\n\nThe top cover piece is common for both:\n\n- For horizontal videos: [`./cad/pireplay/PiReplay-cover.stl`](./cad/pireplay/PiReplay-cover.stl).\n- For vertical videos: [`./cad/pireplay/PiReplay-cover-vertical.stl`](./cad/pireplay/PiReplay-cover-vertical.stl).\n\n\u003cimg width=\"230\" src=\"./docs/images/cad/PiReplay-box.png\"\u003e\n\n**Note** - This print is specifically designed to clip and assemble together, with no additional screws or glue needed. The Raspberry Pi board clips into place, the camera \u0026 nut slide into place (held by friction), and the cover snaps onto the base like a buckle clip.\n\n\u003cimg height=\"230\" src=\"./docs/images/pictures/pireplay/PiReplay-inside.jpg\"\u003e \u003cimg height=\"230\" src=\"./docs/images/pictures/pireplay/PiReplay-flat.jpg\"\u003e\n\n#### PiReplay Mini\n\nFor the PiReplay Mini, you need to print the base and the cover:\n\n- Base: [`./cad/pireplay_mini/PiReplay_mini-base.stl`](./cad/pireplay_mini/PiReplay_mini-base.stl)\n- Cover for horizontal videos: [`./cad/pireplay_mini/PiReplay_mini-cover.stl`](./cad/pireplay_mini/PiReplay_mini-cover.stl)\n- Cover for vertical videos: [`./cad/pireplay_mini/PiReplay_mini-cover-vertical.stl`](./cad/pireplay_mini/PiReplay_mini-cover-vertical.stl)\n\n\u003cimg width=\"230\" src=\"./docs/images/cad/PiReplay_mini-box.png\"\u003e\n\n**Note** - The Mini version is designed for minimal space usage. You may need glue to secure the parts and keep the case closed.\n\n\u003cimg height=\"230\" src=\"./docs/images/pictures/pireplay_mini/PiReplay_mini-inside.jpg\"\u003e \u003cimg height=\"230\" src=\"./docs/images/pictures/pireplay_mini/PiReplay_mini-flat.jpg\"\u003e\n\n### Quick Raspberry Pi Basic Setup\n\nInstall and configure Raspberry Pi OS for PiReplay on the board:\n\n1. Download and install the Raspberry Pi OS Imager: \u003chttps://www.raspberrypi.com/software/\u003e\n2. Connect the SD card to your computer and flash the OS on the card using Raspberry Pi OS Imager\n    1. _Raspberry Pi Device_: select your correct device (`Raspberry Pi 5`, `Raspberry Pi Zero 2 W`, ...)\n    2. _Operating System_:  Raspberry Pi OS (other) \u003e `Raspberry Pi OS Lite (64-bit)`\n    3. _Storage_: Select SD card\n    4. _Next_ \u003e Edit Settings (additional configuration)\n        - General \u003e Set hostname: `pireplay.local`\n        - General \u003e Set username and **password**: `pireplay` (use a secure password)\n        - General \u003e Configure wireless LAN: use your current Wi-Fi network credentials (only for setup purposes, we will use a Wi-Fi Hotspot configuration later).\n        - Services \u003e Enable SSH (using password authentication)\n    5. Flash the SD card and wait till it completes\n3. Insert the SD card inside the Raspberry Pi and power it using the micro USB cable (wait a few seconds)\n4. Connect to your Raspberry Pi using an SSH client (on the same Wi-Fi network credentials used in the configuration)\n    - You can connect using [Putty](https://www.putty.org/), or simply running `ssh` from your terminal\n    - Connect using `pireplay@pireplay.local` as the host (use port 22)\n    - Enter the password you specified in Pi OS Imager during configuration\n\nYou are now connected via SSH to your newly setup Raspberry Pi for PiReplay.\n\n### PiReplay Software Setup\n\nAfter connecting to the Raspberry Pi via SSH, you can install and configure the `pireplay` software to run on it.\n\n```bash\n# Update/upgrade packages\nsudo apt update\nsudo apt upgrade -y\n\n# Install requirements\nsudo apt install -y python3-picamera2 --no-install-recommends\nsudo apt install -y ffmpeg python3-pip\n\n# Install PiReplay\nsudo pip install pireplay --break-system-packages # or build/install from source\n\n# Launch PiReplay automatically on reboot\n(crontab -l 2\u003e/dev/null; echo \"@reboot sudo pireplay run\") | crontab -\n\nsudo reboot\n```\n\nCongratulations! Your PiReplay device is now fully functional.\n\n#### Build from source (optional)\n\nIf you prefer to build and install the PiReplay package from source (on the Raspberry Pi), use the following:\n\n```bash\nsudo apt install -y git\ngit clone --depth 1 https://github.com/gruvw/pireplay\ncd pireplay/src\npoetry build\nsudo pip install dist/pireplay-X.X.X.tar.gz --break-system-packages\n```\n\n**Note** - Requires [Poetry](https://python-poetry.org/).\n\n### Configuration\n\nYou can configure some options of the `pireplay` program by providing a [YAML](https://yaml.org/) configuration file to the CLI: `pireplay run --config /path/to/config.yaml`.\n\nCheck the documented default config file as an example: [`./src/pireplay/default_config.yaml`](./src/pireplay/default_config.yaml).\n\n**Note** - Vertical video rotation (when using the vertical camera attachement cover variant) must be explicitly set in the config file.\n\nThe PiReplay CLI saves the previous config (and UI set) parameters that were last used and will keep them on the next launch and across reboots (if not overwritten by passed config).\nIt might induce confusion as removing a line from your config file won't yield the same result as when it was not present in the first place.\nIf you want the default value of a config option, please refer to the [`./src/pireplay/default_config.yaml`](default_config.yaml) file.\n\n### API\n\nIf you wish to integrate PiReplay into a larger system (like streaming, robotics, ...), there is an API to access its functionality from other programs or scripts.\n\nMain endpoints:\n\n- `/capture` (POST): triggers a replay capture, sends the raw replay URL in the `Raw-Replay` response (redirect) header.\n- `/raw-replay/\u003creplay_name\u003e.mp4` (GET): access video file of a given replay.\n- `/snapshot` (POST): triggers an instantaneous snapshot picture, sends raw snapshot URL in `Raw-Snapshot` response (redirect) header.\n- `/raw-snapshot.jpg` (GET): the jpg picture of the instantaneous snapshot.\n- `/settings/capture-time` (POST, form data `index` set to the index of capture time options, see configuration file): changes the replay duration.\n- `/delete-replay` (POST, form data `replay` set to `\u003creplay_name\u003e`): deletes a given replay.\n- `/delete-all-replays` (POST): deletes every replay.\n\n### Troubleshooting\n\nIf you encounter network issues on your device, you might want to use SSH over USB to fix them.\nFollow this tutorial to enable SSH over USB: \u003chttps://gist.github.com/gruvw/97da6d772d5248d8178822b03f6975fd\u003e.\n\n## Contributions\n\nFeel free to contribute by submitting pull requests, whether to add new features, improve existing functionality, or fix bugs :)\n\nBefore opening a new PR, please open an issue to discuss it beforehand (check for existing issues first).\n\n## Powered by\n\nThis project would not be possible without the wonderful technologies below:\n\n* [Python](https://www.python.org/)\n* [Flask](https://github.com/pallets/flask/)\n* [Raspberry Pi](https://www.raspberrypi.com/)\n* [picamera2](https://github.com/raspberrypi/picamera2)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgruvw%2Fpireplay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgruvw%2Fpireplay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgruvw%2Fpireplay/lists"}