
PySceneDetect
CLI自动检测视频里的镜头切换,按场景把长视频切成片段,并导出切点列表和每段缩略图,适合拉片、整理素材、找剪辑点。本地运行,需 Python 3.10+,切分视频还需 FFmpeg 或 mkvmerge。
Video Cut Detection and Analysis Tool
Latest Release: v0.7.2 (October 11, 2026)
Website: scenedetect.com
Quickstart Example: scenedetect.com/cli/
Documentation: scenedetect.com/docs/
Discord: https://discord.gg/H83HbJngk7
Quick Install:
pip install scenedetect --upgrade
Requires ffmpeg/mkvmerge for video splitting support. Windows builds (MSI installer/portable ZIP) can be found on the download page. A Docker image with all dependencies included is available as ghcr.io/breakthrough/pyscenedetect.
Quick Start (Command Line):
Split input video on each fast cut using ffmpeg:
scenedetect -i video.mp4 split-video
Save some frames from each cut:
scenedetect -i video.mp4 save-images
Skip the first 10 seconds of the input video:
scenedetect -i video.mp4 time -s 10s
More examples can be found throughout the documentation.
Quick Start (Docker):
The same commands work without installing anything using the official Docker image, which includes all dependencies (ffmpeg/mkvmerge included). Mount the folder containing your videos and use it for input/output paths:
docker run --rm -v "$(pwd):/files" ghcr.io/breakthrough/pyscenedetect -i /files/video.mp4 split-video -o /files
Quick Start (Python API):
To get started, there is a high level function in the library that performs content-aware scene detection on a video (try it from a Python prompt):
from scenedetect import detect, ContentDetector
scene_list = detect("my_video.mp4", ContentDetector())
scene_list will now be a list containing the start/end times of all scenes found in the video. There also exists a two-pass version AdaptiveDetector which handles fast camera movement better, and ThresholdDetector for handling fade out/fade in events.
Try calling print(scene_list), or iterating over each scene:
from scenedetect import detect, ContentDetector
scene_list = detect("my_video.mp4", ContentDetector())
for i, scene in enumerate(scene_list):
print(
" Scene %2d: Start %s / Frame %d, End %s / Frame %d"
% (
i + 1,
scene[0].get_timecode(),
scene[0].frame_num,
scene[1].get_timecode(),
scene[1].frame_num,
)
)
We can also split the video into each scene if ffmpeg is installed (mkvmerge is also supported):
from scenedetect import detect, ContentDetector, split_video_ffmpeg
scene_list = detect("my_video.mp4", ContentDetector())
split_video_ffmpeg("my_video.mp4", scene_list)
For more advanced usage, the API is highly configurable, and can easily integrate with any pipeline. This includes using different detection algorithms, splitting the input video, and much more. The following example shows how to implement a function similar to the above, but using the scenedetect API:
from scenedetect import open_video, SceneManager, split_video_ffmpeg
from scenedetect.detectors import ContentDetector
from scenedetect.video_splitter import split_video_ffmpeg
def split_video_into_scenes(video_path, threshold=27.0):
# Open our video, create a scene manager, and add a detector.
video = open_video(video_path)
scene_manager = SceneManager()
scene_manager.add_detector(ContentDetector(threshold=threshold))
scene_manager.detect_scenes(video, show_progress=True)
scene_list = scene_manager.get_scene_list()
split_video_ffmpeg(video_path, scene_list, show_progress=True)
See the documentation for more examples.
Benchmark:
We evaluate the performance of different detectors in terms of accuracy and processing speed. See www.scenedetect.com/benchmarks for results, or the benchmark report for details on the datasets and methodology.
Reference
- Documentation (covers application and Python API)
- CLI Example
- Config File
Help & Contributing
Please submit any bugs/issues or feature requests to the Issue Tracker. Before submission, ensure you search through existing issues (both open and closed) to avoid creating duplicate entries. Pull requests are welcome and encouraged. PySceneDetect is released under the BSD 3-Clause license, and submitted code should be compliant.
For help or other issues, you can join the official PySceneDetect Discord Server, submit an issue/bug report here on Github, or contact me via my website.
Development Setup
Create a virtual environment and install the project in editable mode with the development dependencies:
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
The tests use videos from the resources branch. Fetch them into tests/resources/ (this folder is ignored by git, so nothing gets staged):
git fetch --depth=1 https://github.com/Breakthrough/PySceneDetect.git resources
git restore --source=FETCH_HEAD tests/resources
Then run pytest. The full test suite also needs ffmpeg and mkvmerge. If ffmpeg is not on your PATH, the copy bundled with imageio-ffmpeg (installed by [dev]) is used instead. Install mkvmerge separately, otherwise its test is skipped.
A development install does not include the scenedetect command, so use python -m scenedetect instead:
python -m scenedetect -i video.mp4 detect-content list-scenes
Code Signing
This program uses free code signing provided by SignPath.io, and a free code signing certificate by the SignPath Foundation
License
BSD-3-Clause; see LICENSE and THIRD-PARTY.md for details.
Copyright (C) 2014 Brandon Castellano. All rights reserved.
相關資源

Video2X
CLI基于机器学习的视频超分与补帧工具,用 Real-ESRGAN、Real-CUGAN、RIFE 等模型把低清老视频放大到高清或提高帧率;video2x 命令一次处理一个视频,可脚本批量调用。需要支持 Vulkan 的显卡,提供 Windows 安装包、Linux 软件包与 Docker 镜像,无 macOS 原生版。
k4yt3x/video2x22.6k
BackgroundRemover
CLI用 AI 一条命令去除图片和视频的背景:支持整个文件夹批处理、人像专用模型、边缘精修和换纯色底,视频可输出透明底 MOV 或叠加到新背景上,适合处理商品图、证件照和短视频素材。模型在本地运行,需先安装 PyTorch 与 ffmpeg,首次运行会自动下载模型。
nadermx/backgroundremover8.2k
FFmpeg
CLI音视频转码、剪辑、拼接、抽帧与推流的命令行工具集,含 ffmpeg、ffprobe、ffplay,是 agent 处理媒体文件的基础依赖。GitHub 仓库为官方镜像。
FFmpeg/FFmpeg66.5k
F5-TTS
CLI开源零样本语音合成,提供 f5-tts_infer-cli 命令行,给几秒参考录音就能用相同音色朗读中英文,适合给课件、视频配音。需要 Python、PyTorch 和 FFmpeg,最好有 GPU;预训练模型仅限非商业使用,克隆他人声音须经本人同意。
SWivid/F5-TTS15.5k
Adobe (Codex)
PluginAdobe 官方 Codex 插件,收录于 OpenAI 官方插件市场。用对话批量修图、人像精修、套用 Express 模板做社媒图、把横版视频改成竖版短视频,并检索 Creative Cloud 素材;可先以访客身份试用,登录 Adobe 账号功能更全。
openai/plugins7.8k
MFLUX
CLI在 Mac 上本地运行 FLUX、Qwen Image、Z-Image 等开源生图模型的命令行工具:文生图、参考图改图、局部重绘与高清放大,海报配图、课件插图等素材不出本机。需要 Apple Silicon Mac 与 uv,首次运行会自动下载模型,耗时较长;商用前请确认所选模型的许可。
mflux-community/mflux2.6k