36 releases (22 breaking)
Uses new Rust 2024
| 0.23.0 | Feb 23, 2026 |
|---|---|
| 0.22.1 | Jan 30, 2026 |
| 0.20.0 | Dec 27, 2025 |
| 0.18.0 | Oct 30, 2025 |
| 0.1.0 | Nov 27, 2019 |
#17 in Video
2,193,161 downloads per month
Used in 246 crates
(3 directly)
3.5MB
89K
SLoC
av-scenechange
Scenechange detection tool based on rav1e's scene detection code. It is focused around detecting scenechange points that will be optimal for an encoder to place keyframes. It may not be the best tool if your use case is to generate scene changes as a human would interpret them--for that there are other tools such as SCXvid and WWXD.
Usage
Command Line
The basic usage of av-scenechange is:
av-scenechange input.y4m
This will output the scenechange detection results as JSON to stdout.
Options
-o, --output <FILE>: Write results to a file instead of stdout-s, --speed <LEVEL>: Set detection speed (0 = best quality, 1 = fastest mode, default: 0)--no-flash-detection: Disable detection of short scene flashes--min-scenecut <FRAMES>: Set minimum interval between consecutive scenecuts--max-scenecut <FRAMES>: Set maximum interval between consecutive scenecuts (forces a scenecut)
Examples
# Basic usage with Y4M input
av-scenechange video.y4m
# Save results to a file
av-scenechange input.y4m -o results.json
# Use faster but less accurate detection mode
av-scenechange input.y4m --speed 1
# Set minimum distance between scenecuts to 24 frames
av-scenechange input.y4m --min-scenecut 24
# Read from stdin
cat input.y4m | av-scenechange -
Library Usage
av-scenechange can also be used as a Rust library:
use av_scenechange::{detect_scene_changes, DetectionOptions, SceneDetectionSpeed};
let mut decoder = // ... initialize your decoder
let options = DetectionOptions {
analysis_speed: SceneDetectionSpeed::Standard,
detect_flashes: true,
min_scenecut_distance: Some(24),
max_scenecut_distance: Some(250),
..DetectionOptions::default()
};
let results = detect_scene_changes(&mut decoder, options, None, None)?;
Compiling
Prerequisites
- Rust: Minimum version 1.86
- NASM: Required for optimized assembly code (can be disabled with
--no-default-features)
Installing NASM
Ubuntu/Debian:
sudo apt install nasm
Fedora/RHEL:
sudo dnf install nasm
macOS:
brew install nasm
Windows: Download from nasm.us or use package managers like chocolatey or scoop.
Building from Source
# Clone the repository
git clone https://github.com/rust-av/av-scenechange.git
cd av-scenechange
# Build with default features (includes optimized assembly)
cargo build --release
# Build without assembly optimizations (no NASM required)
cargo build --release --no-default-features --features binary
# Build with additional features
cargo build --release --features ffmpeg # FFmpeg input support
cargo build --release --features vapoursynth # VapourSynth input support
Install from Crates.io
# Install the latest version (automatically uses release optimizations)
cargo install av-scenechange
# Install with ffmpeg, ffms2, and vapoursynth input support
cargo install av-scenechange --features ffmpeg,ffms2,vapoursynth
This will install the binary to ~/.cargo/bin/av-scenechange.
Available Features
binary(default): Enables command-line interfaceasm(default): Enables optimized assembly code (requires NASM)serialize: Enables JSON serialization supportffms2: Adds FFMS2 decoder supportffmpeg: Adds FFmpeg decoder supportvapoursynth: Adds VapourSynth decoder supportdevel: Development features (logging, console output)tracing: Chrome tracing support for performance profiling
Dependencies
~2.1–7.5MB
~122K SLoC