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:
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
# Save results to a file
# Use faster but less accurate detection mode
# Set minimum distance between scenecuts to 24 frames
# Read from stdin
|
Library Usage
av-scenechange can also be used as a Rust library:
use ;
let mut decoder = // ... initialize your decoder
let options = DetectionOptions ;
let results = detect_scene_changes?;
Compiling
Prerequisites
- Rust: Minimum version 1.86
- NASM: Required for optimized assembly code (can be disabled with
--no-default-features)
Installing NASM
Ubuntu/Debian:
Fedora/RHEL:
macOS:
Windows: Download from nasm.us or use package managers like chocolatey or scoop.
Building from Source
# Clone the repository
# Build with default features (includes optimized assembly)
# Build without assembly optimizations (no NASM required)
# Build with additional features
Install from Crates.io
# Install the latest version (automatically uses release optimizations)
# Install with ffmpeg, ffms2, and vapoursynth input support
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