Skip to content
rust-avPublic

About

Cross-platform command-line AV1 / VP9 / HEVC / H264 encoding framework with per scene quality encoding

Topics

Resources

Security policy

Stars

2.0k stars

Watchers

34 watching

Forks

Repository files navigation

Av1an

Demonstration of the California Condor TUI

Discord server CI tests

Buy Me A Coffee

Av1an is a video encoding Rust library and command-line tool designed to be as fast as possible, easy to use, and extremely extensible. It supports a wide variety of encoders and tools to produce high quality videos.

Branch changes and legacy Av1an

The default branch is main. main now includes the Condor rewrite of Av1an, whose executable is av1an. The v0 branch contains the latest stable release of legacy Av1an.

Features

  • Support for Windows, Linux, and MacOS
  • Docker builds (published legacy Av1an images may not contain Condor)
  • Hyper-scalable video encoding
  • Cancel and resume at any time without losing progress
  • Real-time progress feedback
  • Terminal User Interface (TUI)
  • Modular architecture for custom workflows

Video Filtering

Av1an is built with FFMS2 for simple decoding but also supports VapourSynth for advanced filtering and analysis.

  • Decode the input video with either the FFMS2, BestSource, L-SMASH-Works, or DGDecNV VapourSynth plugin
  • Pass a VapourSynth Python script (.vpy or .py) as the input
  • Apply custom variables to the VapourSynth script
  • Output a specific track/index from the VapourSynth script
  • Apply additional VapourSynth filters such as Trim, Crop, Resize, and Splice

Video Encoding

Av1an supports the following encoder executables:

  • aomenc - Alliance for Open Media reference AV1 encoder
  • SvtAv1EncApp - Scalable Video Technology for AV1 AV1 encoder
  • rav1e - Rust AV1 encoder
  • avmenc - Alliance for Open Media AOM Video Model reference AV2 encoder
  • vpxenc - WebM VP8/VP9 encoder
  • x264 - x264 H.264 encoder
  • x265 - x265 H.265 encoder
  • vvenc - Fraunhofer Versatile Video Encoder H.266 encoder
  • FFmpeg - FFmpeg

Video Analysis

Av1an can analyze video properties and qualities to improve encoded video quality by:

  • Splitting the video into contiguous scenes
  • Scaling Photon Noise ISO based on the level of noise/grain in each scene
  • Finding the most efficient quantizer for each scene for a given quality target
  • Choosing the appropriate encoding speed for each scene

Getting Started

Installation

The CLI's Cargo package is california-condor; its executable is av1an. As of 2026-11-13, this package is unpublished on crates.io, and the checked upstream releases do not provide Condor ZIPs. Use a checkout of main containing this workspace; v0 contains legacy Av1an. After installing the build prerequisites, run from the repository root:

cargo install --locked --path california-condor --bin av1an

Windows: this copies only av1an.exe, not its required DLLs. Follow the Windows runtime/build instructions instead of using this command alone.

See Installation for package availability, future release bundles and runtime dependencies, and Docker for upstream image policy and local Condor builds.

Usage

California Condor CLI

The Av1an CLI, California Condor, uses a single JSON configuration file to manage the entire encoding process. Each step can also be executed individually with its own command. You can use --help on each command for details on how to use them (e.g. av1an --help, av1an detect-scenes --help, av1an target-quality --help). For a complete guide on using California Condor, see the California Condor README and guide. For a quick start, see the example below.

Encode a 1080p 10-bit AV1 video with Film Grain Synthesis using rav1e. Use FFMS2 to decode the input. Downscale the scene detection input to 540p to detect scenes faster. Target a SSIMULACRA 2 quality score of 85 quickly. Use mkvmerge to concatenate the output video.

av1an \
    --temp "./deletemelater" \
    --logs "./deletemelater/condor.log" \
    --config-file "./deletemelater/config.json" \
    --input "bird takeoff.mp4" \
    --output "bird takeoff.mkv" \
    --decoder "vs-ffms2" \
    --filters "resize:scaler=bilinear;width=1920;height=1080;format=yuv420p10le" \
    --scd-filters "resize:scaler=bilinear;width=540;height=960;" \
    --encoder "rav1e" \
    --params "--speed 4" \
    --photon-noise 800 \
    --target-metric "ssimulacra2" \
    --target 85 \
    --target-profile "fast" \
    --concat "mkvmerge"

Andean Condor Library

The Av1an library, Andean Condor, consists of the following components: Input, Output, Encoder, Scene, and Sequence. These components are managed with a single Condor instance. See the library example and local dependency setup; andean-condor is not yet published on crates.io.

Library cancellation

The ordinary library methods accept cancellation directly. For a standalone input open without cancellation controls:

use andean_condor::core::input::Input;
use andean_condor::utils::cancellation::Cancellation;

let input = Input::ensure_indexed(&input_model, |_| {}, &Cancellation::default())?;

For a job, keep one token from Input::ensure_indexed through AndeanCondor::process_all (or process_one). Clone it for each stage and share a clone with the application's stop controls:

use andean_condor::core::{AndeanCondor, input::Input};
use andean_condor::utils::cancellation::Cancellation;

let cancellation = Cancellation::default();
let controls = cancellation.clone(); // Move this clone into the stop handler.

let input = Input::ensure_indexed(&input_model, |_| {}, &cancellation)?;
// Build the pipeline with this input, then run its stages with the same token.
let warnings = pipeline.process_all(progress_tx, cancellation)?;

Call controls.request()? for each stop request. The first request stops admitting new work but lets admitted scenes finish all passes. A second request stops feeds, kills owned child processes, and wakes workers so they can be joined. Errors retain a typed Cancelled::Forced cause.

For manual passes, call cancellation.admit()? once per scene and pass that view to filter setup and every encode_pass_with_stream or encode_pass_with_input call. Reuse the same pass statistics where needed. Keep the original token to admit the next scene.

Native decoder/plugin calls already in progress must finish; arbitrary hung foreign calls cannot be interrupted safely. Unix children use private process groups; Windows uses suspended creation and kill-on-close Job Objects (native Windows acceptance remains pending). Deliberately escaping a managed group/job is not supported. These library APIs do not register signals or change the CLI's keyboard, terminal-exit, or exit-code behavior.

Unix hosts must not externally reap managed children or enable SIGCHLD=SIG_IGN / SA_NOCLDWAIT while their guards are active. Auto-reap dispositions are rejected before spawn; detected lost ownership is reported without signaling stale IDs. This check cannot protect against concurrent external waiters. Use piped or null stdin for managed children: inherited terminal input may stop a background group.

Rust API migration

This is a breaking change for library callers. CLI syntax and saved jobs are unchanged.

  • Drop the _cancel suffix from calls and keep the token argument. Calls that previously took no token now need one. Convert a legacy Arc<AtomicBool> to Cancellation once per job; the flag itself can only request graceful stop. Unlike the old FFMS2 indexing flag, graceful cancellation lets admitted indexing finish; use a forced request to interrupt it.
  • Implement Sequence::initialize with &Cancellation and Sequence::execute with Cancellation. Check the token before admitting work, and return Cancelled::Forced after forced cleanup rather than reporting success. Use the token directly in new sequences: Cancellation::legacy_flag is deprecated and cannot distinguish graceful from forced cancellation. Implement AndeanCondor::{process_one, process_all} with Cancellation by value.
  • Pass ParallelEncoderOptions to ParallelEncoder::encode_tasks, Benchmarker::benchmark_workers, and TargetQuality::probe_pass. The default is three total attempts with frame-count validation. Zone encoding takes the validation flag directly and still runs only once. ZonePlan::try_build returns anyhow::Result; downcast to ZoneIneligible to inspect an eligibility failure separately from a probe error or cancellation.
  • Encoder::{supports_capability, container} now return Result: a missing executable or forced interruption is distinct from an unsupported capability or container. parameters_with_output takes None for the old output-derived stats base or Some(path) for an explicit base.
  • Pass cancellation to California Condor's entry_point, run_* functions, and configuration/initialization helpers. Only the executable entry point installs OS signal handlers. Pass Cancellation to Zoner::run and &Interrupt to TuiApp::handle_ctrl_c, which returns Result<()>. Use Configuration::save for atomic config saves.
  • Call metrics::vmaf::score_probed_frames with submission and final-score callbacks (use |_| {} if you do not need submission progress). Use metrics::vship::score_probed_frames for Vship. Use Admission methods for provenance, EncoderBase for extension and progress parsing queries, and PhotonNoise::hash_name for the grain table hash.
  • Use Default for VmafConfig and VshipConfig, and select a VMAF model file with .with_model(VmafModel::Path(path)). Pass both colors to FmetricsScorer::new and the reset flag to VshipScorer::submit_pair_raw. Find version and availability probes at the metric crate root.

Developing

See Developing and Contributing for a guide on developing Av1an and preparing for a Pull Request.

About

Cross-platform command-line AV1 / VP9 / HEVC / H264 encoding framework with per scene quality encoding

Topics

Resources

Security policy

Stars

2.0k stars

Watchers

34 watching

Forks

Releases

Packages

Used by

Contributors

Languages