Thank you for your interest in contributing to PySceneDetect.
PySceneDetect is used in production media pipelines at scale. Even small changes can have subtle implications across different systems (Windows, macOS, Linux), package variants (scenedetect, scenedetect-headless, Windows MSI/portable builds, Docker), interactions with external tools (ffmpeg, mkvmerge), and the various underlying video backends (opencv, pyav, moviepy). Video files themselves introduce even more complexity in certain areas.
To be respectful of reviewers time and effort, we hold contributions to a high engineering quality bar. These guidelines are meant to help focus efforts to changes that will be both accepted and maintainable in the long-term.
Use your judgment on where and how to discuss a change before writing any code:
- Small, unambiguous bug fixes (an already-confirmed issue with a clear root cause and test coverage) can go straight to a pull request.
- Discuss in an issue or on Discord first before opening a PR when you want to:
- Add features or extend existing ones, including detectors.
- Modify any public Python API, user-facing CLI options, config file schema, or output format additions.
- Change default behaviours, outputs, or decoding logic.
- Packaging, dependency, or platform-specific changes.
- Larger refactors or cleanup sweeps.
- Bug fixes where you are not confident what the root cause is or how it may interact across different platforms and input types.
Before opening a new issue, search for existing issues (open and closed) to avoid creating duplicates. If you plan to work on an existing issue, leave a short comment outlining your approach first so it can be discussed, and is not duplicating effort or conflicting with ongoing development direction. Unsolicited large or unapproved pull requests will be closed without review.
You are welcome to use AI tools (LLMs, coding assistants, or agents) to help research, draft, or test contributions. However, we require that a human stays genuinely in the loop, takes full ownership of the submission, and understands the implications of every change or proposal.
- Same Quality Bar: Any and all contributions, AI-assisted or not, must meet the standards for correctness, scope, maintainability, and cross-platform/backend functionality and performance.
- Full Comprehension and Review: You must read, understand, and be able to explain the reasoning and logic behind everything you touch in your PR. You must personally review and test your changes before submitting them for review. Do not offload verification of your change onto maintainers.
- No Fully Autonomous PRs: PRs generated by pasting an error log into an agent without attempting to understand the issue will not be accepted. Please file a bug report first for the issue.
- Applies beyond code: This policy applies to all assets in the repository, including issues. Do not submit unverified AI-generated bug reports, walls of generated prose, or responses directly from an agent. The only exception is when using AI tools to help translate or improve your own writing (for example, if English is not your first language). These tools are great for helping make the world more accessible to each other, but the voice being spoken should be yours, the contributor, in all discourse.
- Disclosure: If AI tools or assistance play a significant role in the production of a PR, state in the PR description how it was used, and what you did to verify the result. You must ensure in good faith that the change is correct to the best of your knowledge and ability, and that you have considered the quality bar set out in this document.
If you hit a bug and an AI tool helped you find a working fix or workaround, please do not open a PR unless you are confident in your understanding of why the bug occurs, and why your proposed solution is correct. It is crucial to consider how the fix interacts with other platforms, distributions, or video backends. Relying on existing test coverage and infrastructure to catch issues is not an acceptable replacement for good software engineering.
If you are unsure, the best thing you can do is to open a bug report with clear reproduction steps and your findings for discussion. You are more than welcome to include a candidate fix that you have tested yourself, even if you do not fully understand it, as long as it is in an issue and not a pull request. Well documented bug reports with a reproducible test cases are far more valuable to the project than PRs. PySceneDetect does not have any kind of telemetry and respects user privacy, and issue reports provide valuable insights into real world usage of the software.
Limit non-functional changes to:
- Fixes for broken CLI commands, invalid flags or config keys, broken links, or incorrect code examples.
- Corrections where a typo or wording error genuinely harms understanding or misleads users.
- Minor typo fixes bundled into a substantive PR that already touches the same files, or noted in an existing issue.
Please avoid opening standalone pull requests that only fix minor spelling, grammar, punctuation, or whitespace issues that do not affect comprehension or functionality. Purely cosmetic formatting or refactoring churn is also not accepted without prior discussion. Standalone trivial PRs may be closed without merging at the maintainers discretion.
Report bugs and request features on the PySceneDetect issue tracker or discuss it on the PySceneDetect Discord server. When reporting a bug, please include:
- The output of
scenedetect version(OS, Python version, installed backends, and how PySceneDetect was installed). - The exact CLI command or minimal Python script that reproduces the issue.
- A debug log when applicable (add
-v debug -l BUG_REPORT.txtto the beginning of yourscenedetectcommand and attachBUG_REPORT.txt). - Relevant sample media or links if the issue depends on a specific video/container.
Following the corresponding issue template will assist in ensuring you have provided all necessary information.
Create a virtual environment and install PySceneDetect in editable mode with development dependencies:
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
pip install ruff pyrightThe test suite uses sample videos from the resources branch. Fetch them into tests/resources/ (this directory is gitignored):
git fetch --depth=1 https://github.com/Breakthrough/PySceneDetect.git resources
git restore --source=FETCH_HEAD tests/resourcesThe full test suite also uses ffmpeg and mkvmerge. If ffmpeg is not on your PATH, the copy bundled with imageio-ffmpeg (installed via .[dev]) is used automatically. If mkvmerge is not installed, its test is skipped.
Before opening or updating a PR, run the checks locally:
# Unit tests (Python 3.10+)
python -m pytest -vv
# Linting and formatting (configured in pyproject.toml, line length 100)
ruff check
ruff format --check
# Type checking (configured in pyproject.toml, targeting Python 3.10)
pyrightAdditional guidelines:
- Tests: Add or update unit tests covering bug fixes and new behavior. If your change touches video decoding, seeking, splitting, or platform-specific paths, verify it across the relevant backends (
opencv,pyav,moviepy) and note what you tested in the PR description. - Types and docstrings: Public APIs should include type hints and NumPy-style docstrings.
- CLI and reference documentation: If you modify CLI options or help text, regenerate the CLI documentation and commit the updated files:
To build the Sphinx documentation locally with warnings treated as errors:
python docs/generate_cli_docs.py
pip install -e ".[docs,pyav,moviepy]" sphinx-build -W --keep-going -b html docs docs/_build/html - Target branch and naming: Target
mainunless asked to target areleases/<X.Y.Z>maintenance branch. Descriptive branch prefixes are encouraged:feature/<name>,issue/<num>-<desc>,fix/<name>,docs/<name>, orwebsite/<name>. - Changelog: Maintainers generally update
website/pages/changelog.mdon merge to avoid conflicts, so you do not need to edit it unless requested.
PySceneDetect is released under the BSD 3-Clause License; see LICENSE and THIRD-PARTY.md for details.
By submitting a pull request, you agree that your contribution is licensed to PySceneDetect (Copyright (C) 2014 Brandon Castellano) and its users, and is distributed under the BSD 3-Clause License terms set out in LICENSE.
Please ensure that, to the best of your knowledge, your contribution does not incorporate code copied or derived from sources under GPL or other incompatible licenses. This applies to any and all code regardless of how it was produced.