### Basic x264 Command Example Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/x264_help.txt A fundamental example of how to invoke the x264 encoder with input and output files, and basic VBV settings. This serves as a starting point for most encoding tasks. ```bash x264 --vbv-bufsize 2000 --bitrate 1000 -o ``` -------------------------------- ### SVT-AV1 Lookahead and Key Frame Example (30fps) Source: https://github.com/rust-av/av1an/blob/master/site/src/Encoders/svt-av1.md Example settings for lookahead and key frames for a 30fps video. This configuration uses the maximum lookahead of 120 and sets keyint to 300, resulting in a 10-second GOP length for optimized compression. ```bash --lookahead 120 --keyint 300 ``` -------------------------------- ### Install VapourSynth Plugins with vsrepo.py Source: https://github.com/rust-av/av1an/blob/master/README.md This command installs specified VapourSynth plugins (lsmas, ffms2, bs, vszip, julek) using the `vsrepo.py` script. Ensure you are in your VapourSynth installation directory and have a command prompt or PowerShell window open. ```shell python3 vsrepo.py install lsmas ffms2 bs vszip julek ``` -------------------------------- ### SVT-AV1 Variable Bit Rate (VBR) Example Source: https://github.com/rust-av/av1an/blob/master/site/src/Encoders/svt-av1.md Shows how to configure Variable Bit Rate (VBR) encoding. This requires specifying a target bit rate (--tbr). The example sets VBR with a target bit rate of 2000 kbps, preset 4, 10-bit input depth, and VQ tuning. ```bash av1an ... --passes 2 -v " --rc 1 --tbr 2000 --preset 4 --input-depth 10 --tune 0" ... ``` -------------------------------- ### x264 Basic Syntax and Example Usage Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/x264_help.txt Demonstrates the fundamental command-line syntax for x264, including input and output file specification. It also provides examples for common encoding modes such as constant quality, two-pass encoding, lossless compression, and PSNR optimization. ```bash x264 [options] -o outfile infile ``` ```bash # Constant quality mode: x264 --crf 24 -o ``` ```bash # Two-pass with a bitrate of 1000kbps: x264 --pass 1 --bitrate 1000 -o x264 --pass 2 --bitrate 1000 -o ``` ```bash # Lossless: x264 --qp 0 -o ``` ```bash # Maximum PSNR at the cost of speed and visual quality: x264 --preset placebo --tune psnr -o ``` ```bash # Constant bitrate at 1000kbps with a 2 second-buffer: x264 --vbv-bufsize 2000 --bitrate 1000 -o ``` -------------------------------- ### Av1an Installation using Cargo Source: https://github.com/rust-av/av1an/blob/master/README.md This command installs the Av1an tool using the Cargo package manager. Cargo is the Rust build system and package manager, and this command fetches and installs the latest stable version of Av1an directly from crates.io. ```sh cargo install av1an ``` -------------------------------- ### Aomenc: Target Bitrate Encoding Example Source: https://github.com/rust-av/av1an/blob/master/site/src/Encoders/aomenc.md Example of configuring Aomenc for target bitrate encoding using VBR (Variable Bitrate). This setup includes specifying the target bitrate, CPU usage, and thread count. For optimal efficiency with VBR, two-pass encoding is recommended. ```bash --end-usage=vbr --target-bitrate=1000 --cpu-used=4 --threads=64 ``` -------------------------------- ### Example Command Line for Good Quality in av1an Source: https://github.com/rust-av/av1an/blob/master/site/src/Encoders/aomenc.md This example command line prioritizes encoding quality using settings like --end-usage=q, --cq-level=22, and includes options for CPU usage, threading, bit-depth, frame lag, and keyframe settings for optimal results. ```bash --end-usage=q --cq-level=22 --cpu-used=4 --threads=8 --bit-depth=10 --lag-in-frames=35 --enable-fwd-kf=1 --enable-qm=1 --enable-chroma-deltaq=1 --quant-b-adapt=1 --mv-cost-upd-freq=2 ``` -------------------------------- ### SVT-AV1 Lookahead and Key Frame Example (24fps) Source: https://github.com/rust-av/av1an/blob/master/site/src/Encoders/svt-av1.md Example settings for lookahead and key frames suitable for a 24fps video. It sets lookahead to the maximum of 120 and keyint to 240, providing a 10-second GOP length for better compression efficiency. ```bash --lookahead 120 --keyint 240 ``` -------------------------------- ### Rust: Av1anContext Initialization with av1an-core Source: https://context7.com/rust-av/av1an/llms.txt Provides a Rust code example demonstrating how to initialize the `Av1anContext` for programmatic video encoding using the `av1an-core` library. It covers setting up input parameters, encoding arguments, and performing basic validation and encoding. ```rust use av1an_core::{Av1anContext, EncodeArgs, Input, Encoder, ChunkMethod}; use std::path::PathBuf; fn main() -> anyhow::Result<()> { // Configure encoding arguments let input = Input::new( PathBuf::from("input.mkv"), vec![], // vspipe_args "./temp", // temporary_directory ChunkMethod::LSMASH, None, // scene_detection_downscale_height None, // scene_detection_pixel_format None, // scene_detection_scaler false, // is_proxy )?; let mut encode_args = EncodeArgs { input, proxy: None, temp: "./temp".to_string(), output_file: "output.mkv".to_string(), encoder: Encoder::aom, video_params: vec![ "--cpu-used=4".to_string(), "--end-usage=q".to_string(), "--cq-level=30".to_string(), ], workers: 0, // Auto-detect passes: 2, // ... other parameters with defaults }; // Validate configuration encode_args.validate()?; // Create context and encode let ctx = Av1anContext::new(encode_args)?; ctx.encode_file()?; Ok(()) } ``` -------------------------------- ### av1an Cropping and Resizing Source: https://github.com/rust-av/av1an/blob/master/site/src/Features/TargetQuality.md Demonstrates how to apply cropping filters for both FFmpeg and VMAF, and how to specify the VMAF resolution accordingly. It also includes an example of using a Vapoursynth script for cropping and resizing, offering advanced customization. ```bash --ffmpeg "-vf crop=3840:1900:0:0" --vmaf-filter "crop=3840:1900:0:0" --vmaf-res "3840x1900" ``` ```bash -i 4k_crop.vpy --vmaf-res "3840x1600" --target-quality 90 -o test.mkv ``` ```bash -i 4k_crop.vpy --probe-res "1920x800" --target-quality 3 --target-metric butteraugli-3 -o test.mkv ``` -------------------------------- ### Command-line Encoding with Different Encoders in av1an Source: https://context7.com/rust-av/av1an/llms.txt Demonstrates how to use av1an to encode video using various encoders such as rav1e (AV1), x264 (H.264), x265 (H.265), and vpx (VP9). Each example shows basic command structure with encoder-specific parameters. ```bash av1an \ --encoder rav1e \ -v "--speed 6 --quantizer 80" \ -i input.mkv \ -o output.mkv ``` ```bash av1an \ --encoder x264 \ -v "--preset medium --crf 23" \ -i input.mkv \ -o output.mkv ``` ```bash av1an \ --encoder x265 \ -v "--preset medium --crf 28" \ --concat mkvmerge \ -i input.mkv \ -o output.mkv ``` ```bash av1an \ --encoder vpx \ -v "--cpu-used=2 --end-usage=q --cq-level=32" \ -i input.mkv \ -o output.mkv ``` -------------------------------- ### SVT-AV1 Film Grain Example Source: https://github.com/rust-av/av1an/blob/master/site/src/Encoders/svt-av1.md Example of applying synthesized film grain with denoising disabled. This command enables film grain synthesis with a strength of 10 and explicitly turns off the internal denoiser, allowing external filters to be used if desired. ```bash ... --film-grain 10 --film-grain-denoise 0 ... ``` -------------------------------- ### Av1an Installation on Arch Linux Source: https://github.com/rust-av/av1an/blob/master/README.md This command installs Av1an on Arch Linux and its derivatives (like Manjaro) using the pacman package manager. It ensures that Av1an and its necessary dependencies are installed from the official Arch repositories. ```sh pacman -S av1an ``` -------------------------------- ### SVT-AV1 Preset Configuration Source: https://github.com/rust-av/av1an/blob/master/site/src/Encoders/svt-av1.md Sets the encoding speed and optimization level using the --preset option. Higher preset numbers (e.g., 13) are faster but less optimized, while lower numbers (e.g., 0) are slower but offer better compression. Preset 4 is a common starting point for enthusiasts. ```bash --preset 4 ``` -------------------------------- ### Install Linux Dependencies Source: https://github.com/rust-av/av1an/blob/master/site/src/compiling.md Installs essential development dependencies for compiling Av1an on Arch Linux using pacman. This includes Rust, NASM, clang/LLVM, FFmpeg, and VapourSynth. ```sh pacman -S --needed rust nasm clang ffmpeg vapoursynth ``` -------------------------------- ### Aomenc: Tile Configuration for Playback Improvement Source: https://github.com/rust-av/av1an/blob/master/site/src/Encoders/aomenc.md Example of configuring Aomenc tiles to potentially improve playback on older devices or for high framerates. It suggests specific settings for tile columns and rows based on resolution and framerate. ```bash --tile-columns=2 --tile-rows=1 ``` ```bash --tile-columns=3 --tile-rows=2 ``` -------------------------------- ### Example Command Line for Fast Speed in av1an Source: https://github.com/rust-av/av1an/blob/master/site/src/Encoders/aomenc.md This command line focuses on achieving fast encoding speeds by using higher --cpu-used and --threads values, along with specific tile settings and an 8-bit bit-depth. Quality settings like --cq-level are still maintained. ```bash --end-usage=q --cq-level=22 --cpu-used=6 --threads=64 --tile-columns=2 --tile-rows=1 --bit-depth=8 ``` -------------------------------- ### Basic Av1an Video Encoding Source: https://github.com/rust-av/av1an/blob/master/README.md This command demonstrates the basic usage of Av1an to encode a video file. It takes an input file and specifies an output file, using default encoding parameters. This is the simplest way to start using Av1an for video conversion. ```sh av1an -i input.mkv -o output.mkv ``` -------------------------------- ### Aomenc: Constant Quality Encoding Example Source: https://github.com/rust-av/av1an/blob/master/site/src/Encoders/aomenc.md Example of configuring Aomenc for constant quality encoding. It utilizes the 'q' rate control mode with a specified CQ level, CPU usage, and thread count. This mode is recommended for the highest quality rate control. ```bash --end-usage=q --cq-level=30 --cpu-used=4 --threads=64 ``` -------------------------------- ### Basic Video Encoding with SVT-AV1 Source: https://context7.com/rust-av/av1an/llms.txt Encodes a video file using default settings with the SVT-AV1 encoder. It automatically detects scenes, parallelizes encoding across available CPU cores, and produces an AV1 video output. This is the simplest way to start encoding with Av1an. ```bash # Simple encode with default parameters (SVT-AV1, yuv420p10le, automatic workers) av1an -i input.mkv -o output.mkv # Expected output: # - Automatic scene detection using av-scenechange # - Parallel encoding across detected CPU cores # - Output: output.mkv with AV1 video codec ``` -------------------------------- ### Basic av1an Encoding with Target Quality Source: https://github.com/rust-av/av1an/blob/master/site/src/Features/TargetQuality.md Demonstrates basic av1an usage for encoding a file with a specified target quality using the default SVT-AV1 encoder. It shows how to set the target quality and provides an example with additional parameters like VMAF model path and probing. ```bash av1an -i file --target-quality 90 ``` ```bash av1an -i file --target-quality 95 --vmaf_path "vmaf_v.0.6.3.pkl" --probes 6 ``` -------------------------------- ### SVT-AV1 Constant Rate Factor (CRF) Example Source: https://github.com/rust-av/av1an/blob/master/site/src/Encoders/svt-av1.md Demonstrates setting Constant Rate Factor (CRF) for constant quality encoding. The --crf value ranges from 1-63, where lower numbers mean less compression and higher quality. This example uses CRF 24, preset 4, 10-bit input depth, and VQ tuning. ```bash av1an ... -v " --rc 0 --crf 24 --preset 4 --input-depth 10 --tune 0" ... ``` -------------------------------- ### Encoder Selection and Configuration (Bash) Source: https://context7.com/rust-av/av1an/llms.txt Allows selecting and configuring different video encoders with their specific parameters. Examples include AOM (libaom-av1) for highest quality/slowest speed, and SVT-AV1 for a balance of speed and quality. Encoder-specific parameters are passed via the '-v' flag. ```bash # AOM (libaom-av1) - Highest quality, slowest av1an \ --encoder aom \ -v "--cpu-used=4 --end-usage=q --cq-level=28 --threads=4" \ -i input.mkv \ -o output.mkv # SVT-AV1 - Balanced speed/quality av1an \ --encoder svt-av1 \ -v "--preset 6 --crf 30" \ -i input.mkv \ -o output.mkv ``` -------------------------------- ### Advanced Av1an Encoding with VapourSynth and Custom Parameters Source: https://github.com/rust-av/av1an/blob/master/README.md This example showcases advanced Av1an usage, incorporating a VapourSynth script for pre-processing and applying custom encoder and audio parameters. It specifies target quality, logging, and detailed encoder settings, offering fine-grained control over the encoding process. ```sh av1an -i input.vpy -v "--cpu-used=3 --end-usage=q --cq-level=30 --threads=8" -w 10 --target-quality 95 -a "-c:a libopus -ac 2 -b:a 192k" -l my_log -o output.mkv ``` -------------------------------- ### Zone-Based Encoding Configuration (Bash) Source: https://context7.com/rust-av/av1an/llms.txt Enables applying different encoding settings to specific frame ranges (zones) within a video. A 'zones.txt' file defines start and end frames, encoder, and specific parameters for each zone. The format is 'start_frame end_frame encoder [reset] video_params'. ```bash # Create zones file (zones.txt): # 0 500 aom --cq-level=28 # 500 1500 rav1e reset -s 4 -q 35 # 1500 -1 aom --cq-level=30 --photon-noise 4 # Encode with zones av1an \ -i input.mkv \ --zones zones.txt \ --encoder aom \ -v "--cq-level=32" \ -o output.mkv # Zone format: start_frame end_frame encoder [reset] video_params # - start_frame: First frame of zone (inclusive) # - end_frame: Last frame of zone (exclusive, -1 = last frame) # - encoder: Encoder to use for this zone # - reset: Ignore global --video-params, use only zone params # - video_params: Encoder-specific parameters ``` -------------------------------- ### Set Target Quality with Weighted XPSNR Score Source: https://github.com/rust-av/av1an/blob/master/site/src/Cli/target_quality.md This example demonstrates setting a target quality using the weighted XPSNR metric. The required FFmpeg or VapourSynth plugins depend on the probing rate. ```bash > av1an -i input.mkv -o output.mkv --target-metric xpsnr-weighted --target-quality 40 ``` -------------------------------- ### Set Target Quality with SSIMULACRA2 Score Source: https://github.com/rust-av/av1an/blob/master/site/src/Cli/target_quality.md This example shows how to target a specific quality score using the SSIMULACRA2 metric. This requires the appropriate VapourSynth plugins and chunk method configuration. ```bash > av1an -i input.mkv -o output.mkv --target-metric ssimulacra2 --target-quality 80 ``` -------------------------------- ### FFmpeg Video Filter Example - Crop Source: https://github.com/rust-av/av1an/blob/master/site/src/Cli/encoding.md Demonstrates how to use the FFmpeg video filter option to crop a video. The '-f' flag followed by '-vf crop=...' applies the cropping. ```bash av1an -i input.mkv -o output.mkv -f "-vf crop=100:100:100:100" ``` -------------------------------- ### Set Target Quality with Butteraugli 3-Norm Score Source: https://github.com/rust-av/av1an/blob/master/site/src/Cli/target_quality.md This example illustrates targeting a quality score using the Butteraugli 3-Norm metric. It requires specific VapourSynth plugins and chunk method settings. ```bash > av1an -i input.mkv -o output.mkv --target-metric butteraugli-3 --target-quality 2 ``` -------------------------------- ### SVT-AV1 Lookahead and Key Frame Settings Source: https://github.com/rust-av/av1an/blob/master/site/src/Encoders/svt-av1.md Configures lookahead and key frame intervals for optimization. --lookahead increases the number of future frames analyzed (max 120), improving compression effectiveness at the cost of RAM. --keyint sets the maximum interval between key frames (GOP length), recommended at 10 seconds. ```bash --lookahead --keyint ``` -------------------------------- ### Set Target Quality with VMAF Score Source: https://github.com/rust-av/av1an/blob/master/site/src/Cli/target_quality.md This example demonstrates how to set a specific target quality score using the VMAF metric in av1an. VMAF is the default metric if none is specified. ```bash > av1an -i input.mkv -o output.mkv --target-quality 95 ``` -------------------------------- ### SVT-AV1 Input Depth Configuration Source: https://github.com/rust-av/av1an/blob/master/site/src/Encoders/svt-av1.md Sets the bit depth for input processing. Using --input-depth 10 is generally recommended for improved compression efficiency and potential artifact correction, even with 8-bit sources. 8-bit input may be preferred if encode/decode speed is paramount over quality. ```bash --input-depth 10 ``` -------------------------------- ### FFmpeg Video Filter Example - Scale Source: https://github.com/rust-av/av1an/blob/master/site/src/Cli/encoding.md Illustrates the use of the FFmpeg video filter option to scale a video to a specific resolution. The '-f' flag followed by '-vf scale=...' applies the scaling. ```bash av1an -i input.mkv -o output.mkv -f "-vf scale=1920:1080" ``` -------------------------------- ### Audio Encoding with FFmpeg Options Source: https://github.com/rust-av/av1an/blob/master/site/src/Cli/encoding.md Specifies FFmpeg audio encoding parameters. Accepts any valid FFmpeg audio options. Defaults to `-c:a copy` if not provided. Example shows encoding with libopus or a mix of libopus and aac. ```bash > av1an -i input.mkv -o output.mkv -a "-c:a libopus -b:a 128k" ``` ```bash > av1an -i input.mkv -o output.mkv --audio-params "-c:a:0 libopus -b:a:0 128k -c:a:1 aac -ac:a:1 1 -b:a:1 24k" ``` -------------------------------- ### Run AV1AN Docker Image with Custom Directory (Linux) Source: https://github.com/rust-av/av1an/blob/master/site/src/docker.md This example demonstrates running the AV1AN Docker image on Linux while specifying a custom directory for video files. It replaces the default current working directory mount with a specific path, ensuring the container can access and write to the designated location. The --user flag is crucial for maintaining correct file permissions. ```bash docker run --privileged -v "/c/Users/masterofzen/Videos":/videos --user $(id -u):$(id -g) -it --rm masterofzen/av1an:master -i S01E01.mkv {options} ``` -------------------------------- ### Use Zones File for Custom Encoding - av1an Source: https://github.com/rust-av/av1an/blob/master/site/src/Cli/encoding.md Applies custom encoder settings for specific segments of the video using a zones file. The zones file specifies start and end frames, along with encoder parameters, allowing for fine-grained control over encoding quality and complexity. ```bash av1an -i input.mkv -o output.mkv --zones zones.txt av1an -i input.mkv -o output.mkv --zones C:\custom\configuration\zones.txt ``` -------------------------------- ### SVT-AV1 Tune Setting (VQ vs. PSNR) Source: https://github.com/rust-av/av1an/blob/master/site/src/Encoders/svt-av1.md Configures the tuning objective for the encoder. --tune 0 selects VQ (subjective quality), aiming for perceptually pleasing results, often appearing sharper. --tune 1 selects PSNR (objective measurement). VQ is generally recommended for visual quality. ```bash --tune 0 --tune 1 ``` -------------------------------- ### Print Help Information for av1an Source: https://github.com/rust-av/av1an/blob/master/site/src/Cli/general.md Display help information for the av1an command-line interface, listing all available options and their descriptions. ```bash > av1an -h > av1an --help ``` -------------------------------- ### Build Av1an on Windows Source: https://github.com/rust-av/av1an/blob/master/site/src/compiling.md Clones the Av1an repository and builds the release version using Cargo in a Windows command prompt or PowerShell. The resulting executable will be in the 'target\release\' folder. ```powershell git clone https://github.com/master-of-zen/Av1an # Navigate into the cloned directory cd Av1an # Build the release version cargo build --release ``` -------------------------------- ### Basic SvtAv1EncApp Usage Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/svt_av1_help.txt The basic command structure for SvtAv1EncApp involves specifying options, an output filename, and an input filename. This forms the foundation for all encoding tasks. ```bash SvtAv1EncApp -b dst_filename -i src_filename ``` -------------------------------- ### Build AV1AN Docker Image Manually Source: https://github.com/rust-av/av1an/blob/master/site/src/docker.md This command builds the AV1AN Docker image locally. It should be executed from the root directory of the AV1AN repository. The dependencies will be automatically installed during the build process. ```sh docker build -t "av1an" . ``` -------------------------------- ### av1an Encoding with Different Encoders and Metrics Source: https://github.com/rust-av/av1an/blob/master/site/src/Features/TargetQuality.md Illustrates using av1an with alternative encoders like rav1e and x264, specifying different target metrics (SSIMULACRA2, Butteraugli-3, XPSNR), and adjusting probing parameters. This allows for flexible encoding strategies based on desired output quality and performance. ```bash av1an -i file --encoder rav1e --target-metric ssimulacra2 --target-quality 90 --probing-rate 2 ``` ```bash av1an -i file --encoder svt-av1 --video-params "--preset 2 --enable-variance-boost 1" --target-metric butteraugli-3 --target-quality 2 --probe-slow --probing-rate 3 ``` ```bash av1an -i file --encoder x264 --video-params "--preset placebo --tune film" --target-metric xpsnr --target-quality 45 --probe-slow --probing-speed medium ``` -------------------------------- ### x264 Preset: superfast Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/x264_help.txt The 'superfast' preset offers a balance between speed and quality, faster than 'veryfast' but with slightly more compression efficiency. It uses settings like --ref 1 and reduced --subme. ```bash x264 --preset superfast -o ``` -------------------------------- ### Target Quality Encoding with Butteraugli-3 in av1an Source: https://github.com/rust-av/av1an/blob/master/site/src/Cli/target_quality.md Targets encoding quality using the Butteraugli 3-Norm metric. Scores start at 0 (best) and increase with lower quality. This metric offers another way to evaluate perceptual differences. ```bash > av1an -i input.mkv -o output.mkv --target-metric butteraugli-3 --target-quality 1.5 ``` -------------------------------- ### Chunk Method Selection for Frame Piping Source: https://context7.com/rust-av/av1an/llms.txt Allows selection of different methods for piping frames to the encoder, impacting speed and accuracy. Supported methods include lsmash, bestsource, hybrid, and select, each with different performance characteristics and dependencies. ```bash # Using LSMASH (VapourSynth plugin) for accurate, fast chunking av1an \ -i input.mkv \ --chunk-method lsmash \ -o output.mkv # Using bestsource (requires slow indexing once, most accurate) av1an \ -i input.mp4 \ --chunk-method bestsource \ -o output.mkv # Using hybrid method (FFmpeg-based, requires intermediate files) av1an \ -i input.mkv \ --chunk-method hybrid \ -o output.mkv # Chunk methods comparison: # lsmash/ffms2/bestsource: VapourSynth-based, no intermediate files, accurate # dgdecnv: GPU-accelerated (NVIDIA), very fast, supports AVC/HEVC/MPEG-2/VC1 # hybrid: FFmpeg-based, intermediate files, seeks to keyframes # select: FFmpeg-based, no intermediate files, extremely slow (decodes from frame 0) ``` -------------------------------- ### Print Version Information for av1an Source: https://github.com/rust-av/av1an/blob/master/site/src/Cli/general.md Display the current version information for the av1an encoder. ```bash > av1an -V > av1an --version ``` -------------------------------- ### Rust: Target Quality Configuration with av1an-core Source: https://context7.com/rust-av/av1an/llms.txt Shows a Rust function that configures target quality settings for video encoding using `av1an-core`. It includes options for target VMAF range, metrics (VMAF, SSIMULACRA2, etc.), interpolation methods, and resolution settings. ```rust use av1an_core::{TargetQuality, TargetMetric, InterpolationMethod}; fn configure_target_quality() -> TargetQuality { TargetQuality { target: Some((92.0, 95.0)), // VMAF range metric: TargetMetric::VMAF, probes: 4, min_q: 20, max_q: 50, interp_method: Some(( InterpolationMethod::Natural, InterpolationMethod::Pchip, )), vmaf_res: "1920x1080".to_string(), probe_res: Some((1920, 1080)), vmaf_threads: 8, probing_rate: 1, // Use every frame // ... other configuration } } // Available metrics: // - TargetMetric::VMAF (default, requires FFmpeg with libvmaf) // - TargetMetric::SSIMULACRA2 (requires VapourSynth plugin) // - TargetMetric::ButteraugliINF (requires VapourSynth plugin) // - TargetMetric::Butteraugli3 (requires VapourSynth plugin) // - TargetMetric::XPSNR (requires FFmpeg with libxpsnr) // - TargetMetric::XPSNRWeighted (weighted XPSNR calculation) ``` -------------------------------- ### Advanced Encoding with Custom Parameters (AOM) Source: https://context7.com/rust-av/av1an/llms.txt Demonstrates advanced encoding using the AOM encoder with custom parameters, a specified number of workers, target VMAF quality, and custom audio encoding settings. This allows for fine-grained control over the encoding process. ```bash # AOM encoder with custom parameters, 10 workers, target VMAF 95, opus audio av1an \ -i input.vpy \ -v "--cpu-used=3 --end-usage=q --cq-level=30 --threads=8" \ -w 10 \ --target-quality 95 \ -a "-c:a libopus -ac 2 -b:a 192k" \ -l my_log \ -o output.mkv # Parameters explained: # -v: Video encoder parameters (aomenc syntax) # -w: Number of parallel workers # --target-quality: Target VMAF score (overrides --cq-level during encoding) # -a: Audio encoding parameters (FFmpeg syntax) # -l: Log file location ``` -------------------------------- ### Build Av1an on Linux Source: https://github.com/rust-av/av1an/blob/master/site/src/compiling.md Clones the Av1an repository and builds the release version using Cargo. The resulting executable will be located in the 'target/release/' directory. ```sh git clone https://github.com/master-of-zen/Av1an && cd Av1an cargo build --release ``` -------------------------------- ### SVT-AV1 Film Grain Synthesis Source: https://github.com/rust-av/av1an/blob/master/site/src/Encoders/svt-av1.md Enables and controls the synthesis of film grain. The --film-grain option takes a value from 1-50 to adjust the strength of the effect. --film-grain-denoise 0 disables the encoder's denoising stage, which is recommended to preserve detail when synthesizing grain. ```bash --film-grain --film-grain-denoise ``` -------------------------------- ### x264 Preset: placebo Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/x264_help.txt The 'placebo' preset aims for the absolute highest quality and compression, often at the expense of extremely long encoding times. It uses aggressive settings like --bframes 16 and --me tesa, making it impractical for most use cases. ```bash x264 --preset placebo -o ``` -------------------------------- ### AV1 Frame Type and GOP Configuration Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/x264_help.txt This section details options for controlling frame types and Group of Pictures (GOP) structure in AV1 encoding. Parameters like `--keyint` (maximum GOP size), `--min-keyint` (minimum GOP size), `--scenecut`, and `--bframes` allow fine-tuning of I-frame placement and B-frame usage. Options for adaptive B-frame decision and B-pyramid are also included. ```bash -I, --keyint Maximum GOP size [250] -i, --min-keyint Minimum GOP size [auto] --no-scenecut Disable adaptive I-frame decision --scenecut How aggressively to insert extra I-frames [40] --intra-refresh Use Periodic Intra Refresh instead of IDR frames -b, --bframes Number of B-frames between I and P [3] --b-adapt Adaptive B-frame decision method [1] Higher values may lower threading efficiency. - 0: Disabled - 1: Fast - 2: Optimal (slow with high --bframes) --b-bias Influences how often B-frames are used [0] --b-pyramid Keep some B-frames as references [normal] - none: Disabled - strict: Strictly hierarchical pyramid - normal: Non-strict (not Blu-ray compatible) --open-gop Use recovery points to close GOPs Only available with b-frames ``` -------------------------------- ### x264 Presets and Tuning Options Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/x264_help.txt Details the use of presets and tuning options in x264 to quickly configure encoding speed and quality. Presets range from ultrafast to placebo, affecting encoding time and compression efficiency, while tuning options optimize for specific content types or scenarios. ```bash # Example using a preset and tuning: x264 --preset medium --tune film -o ``` -------------------------------- ### SVT-AV1 Rate Control Options Source: https://github.com/rust-av/av1an/blob/master/site/src/Encoders/svt-av1.md Selects the rate control strategy for video encoding. Options include Constant Rate Factor (CRF), Variable Bit Rate (VBR), and Constant Bit Rate (CBR). CRF is common for constant quality, VBR requires a target bit rate, and CBR maintains a fixed bit rate. ```bash --rc 0 --crf --rc 1 --tbr --rc 2 ``` -------------------------------- ### av1an Scaling Options Source: https://github.com/rust-av/av1an/blob/master/site/src/Features/TargetQuality.md Shows how to control the resolution for VMAF calculations and other metric probes using av1an. This is useful for ensuring accurate quality assessments at different output resolutions. ```bash --vmaf-res 3840x2160 ``` ```bash --probe-res 1280x720 ``` -------------------------------- ### Scene Detection Configuration Source: https://context7.com/rust-av/av1an/llms.txt Configures how video chunks are created through scene detection. Options include specifying the scene detection method, minimum and maximum scene lengths, downscaling for faster analysis, and pixel format. It also supports generating a scenes file without encoding or resuming an encode with an existing scenes file. ```bash # Custom scene detection with minimum scene length and maximum scene length av1an \ -i input.mkv \ --split-method av-scenechange \ --sc-method standard \ --min-scene-len 48 \ --extra-split 240 \ --sc-downscale-height 720 \ --sc-pix-format yuv420p \ -o output.mkv # Scene detection options: # --split-method: av-scenechange (automatic) or none (disable) # --sc-method: standard (accurate) or fast (speed priority) # --min-scene-len: Minimum frames per scene (default: 24) # --extra-split: Maximum frames per scene (adds splits if exceeded) # --sc-downscale-height: Downscale for faster detection # --sc-pix-format: Pixel format for scene analysis # Scene-only mode (generate scenes file without encoding) av1an \ -i input.mkv \ --scenes scenes.json \ --sc-only # Resume with existing scenes file av1an \ -i input.mkv \ --scenes scenes.json \ --resume \ -o output.mkv ``` -------------------------------- ### av1an Pixel Format Configuration Source: https://context7.com/rust-av/av1an/llms.txt Shows how to specify input and output pixel formats for av1an encoding, including 10-bit 4:2:0, 10-bit 4:4:4, 8-bit 4:2:0, and scene detection with specific pixel formats. This affects quality and file size. ```bash # 10-bit 4:2:0 output (default for most workflows) av1an \ -i input.mkv \ --pix-format yuv420p10le \ -o output.mkv ``` ```bash # 10-bit 4:4:4 output (high quality, larger file size) av1an \ -i input.mkv \ --pix-format yuv444p10le \ -o output.mkv ``` ```bash # 8-bit 4:2:0 output (compatibility mode) av1an \ -i input.mkv \ --pix-format yuv420p \ -o output.mkv ``` ```bash # Scene detection with specific pixel format av1an \ -i input.mkv \ --sc-pix-format yuv420p \ --pix-format yuv420p10le \ -o output.mkv ``` -------------------------------- ### Configuring Probe Resolution in av1an Source: https://github.com/rust-av/av1an/blob/master/site/src/Cli/target_quality.md Specifies the resolution for Target Quality probe calculations. The format is 'widthxheight'. If not set, the input video's resolution is used. This allows for optimizing probe analysis on specific resolutions. ```bash # Example: Set probe resolution to 1280x720 > av1an ... --probe-res 1280x720 ``` -------------------------------- ### VapourSynth Script Encoding (Bash) Source: https://context7.com/rust-av/av1an/llms.txt Allows using VapourSynth scripts for pre-processing and filtering before encoding. The '-i' flag points to the VPY script, and '--vspipe-args' passes custom arguments to the script. The '--chunk-method lsmash' is specified for handling chunks. ```bash # Encode VapourSynth script directly av1an \ -i script.vpy \ --vspipe-args "message=test" "value=42" \ --chunk-method lsmash \ -o output.mkv # VapourSynth script example (script.vpy): # import vapoursynth as vs # core = vs.core # clip = core.lsmas.LWLibavSource("input.mkv") # clip = core.resize.Spline36(clip, 1920, 1080) # clip.set_output() # Parameters passed via --vspipe-args are available in script: # message = sys.argv[1] # "test" # value = int(sys.argv[2]) # 42 ``` -------------------------------- ### AV1 Encoding Tuning Presets Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/x264_help.txt This snippet demonstrates different tuning presets for AV1 encoding, such as still image, PSNR, SSIM, fast decode, and zero latency. Each preset adjusts various encoding parameters like psy-rd, aq-strength, deblock, and cabac to optimize for specific use cases. These options are used to configure the encoder's behavior. ```bash --psy-rd :0.25 --qcomp 0.8 - stillimage (psy tuning): --aq-strength 1.2 --deblock -3:-3 --psy-rd 2.0:0.7 - psnr (psy tuning): --aq-mode 0 --no-psy - ssim (psy tuning): --aq-mode 2 --no-psy - fastdecode: --no-cabac --no-deblock --no-weightb --weightp 0 - zerolatency: --bframes 0 --force-cfr --no-mbtree --sync-lookahead 0 --sliced-threads --rc-lookahead 0 ``` -------------------------------- ### Concatenation Method Selection (Bash) Source: https://context7.com/rust-av/av1an/llms.txt Allows choosing how encoded chunks are concatenated into the final output file. Options include 'mkvmerge' (recommended for reliability), 'ffmpeg' (supports WebM output), and 'ivf' (experimental, video-only). Requirements vary per method. ```bash # Using mkvmerge (recommended, most reliable) av1an \ -i input.mkv \ --concat mkvmerge \ --encoder aom \ -o output.mkv # Using FFmpeg (supports WebM output) av1an \ -i input.mkv \ --concat ffmpeg \ --encoder aom \ -o output.webm # Using IVF (experimental, video-only, no audio) av1an \ -i input.mkv \ --concat ivf \ --encoder aom \ -o output.ivf # Concatenation method requirements: # mkvmerge: Required for x265, recommended for all encoders # ffmpeg: Can output WebM, but may have audio seeking issues # ivf: Only VP8/VP9/AV1, no audio support ``` -------------------------------- ### VMAF Plotting Configuration (Bash) Source: https://context7.com/rust-av/av1an/llms.txt Enables VMAF (Video Multimethod Assessment Fusion) plotting to visualize quality consistency across encoded videos. The '--vmaf' flag activates plotting, '--vmaf-res' sets the resolution, '--vmaf-threads' specifies parallel threads, and '--vmaf-filter' applies FFmpeg filters before calculation. An SVG file with per-frame quality scores is generated in the output directory. ```bash # Encode and generate VMAF plot av1an \ -i input.mkv \ --vmaf \ --vmaf-res 1920x1080 \ --vmaf-threads 8 \ --vmaf-filter "crop=1920:800:0:140" \ -o output.mkv # VMAF options: # --vmaf: Enable VMAF plotting (creates SVG in output directory) # --vmaf-res: Resolution for VMAF calculation # --vmaf-threads: Parallel threads for VMAF # --vmaf-filter: FFmpeg filter applied before VMAF calculation # --vmaf-path: Path to custom VMAF model file # Output: output.mkv_vmaf.svg with per-frame quality scores ``` -------------------------------- ### x264 Preset: medium Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/x264_help.txt The 'medium' preset is the default and offers a balanced approach to encoding speed and compression efficiency. It uses a standard set of settings that provide good quality without excessively long encoding times. ```bash x264 --preset medium -o ``` -------------------------------- ### Two-Pass VBR Encoding with SvtAv1EncApp Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/svt_av1_help.txt Demonstrates a two-pass Variable Bitrate (VBR) encoding process using SvtAv1EncApp. This method requires a statistics file to optimize encoding quality across passes. ```bash SvtAv1EncApp <--stats svtav1_2pass.log> --rc 1 --tbr 1000 --pass 1 -b dst_filename -i src_filename SvtAv1EncApp <--stats svtav1_2pass.log> --rc 1 --tbr 1000 --pass 2 -b dst_filename -i src_filename ``` -------------------------------- ### x264 Preset: slower Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/x264_help.txt The 'slower' preset further enhances compression efficiency by increasing --b-adapt, --me, --partitions, --rc-lookahead, --ref, and --subme. This preset is for achieving high quality with longer encoding durations. ```bash x264 --preset slower -o ``` -------------------------------- ### Combined Two-Pass VBR Encoding with SvtAv1EncApp Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/svt_av1_help.txt A more concise way to perform two-pass VBR encoding by combining the passes into a single command using the `--passes 2` option. This simplifies the command-line execution. ```bash SvtAv1EncApp <--stats svtav1_2pass.log> --passes 2 --rc 1 --tbr 1000 -b dst_filename -i src_filename ``` -------------------------------- ### x264 Preset: veryfast Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/x264_help.txt The 'veryfast' preset provides a good compromise between encoding speed and quality. It enables slightly more advanced features than 'superfast', such as --rc-lookahead 10 and --subme 2. ```bash x264 --preset veryfast -o ``` -------------------------------- ### Content Tuning in av1an Source: https://github.com/rust-av/av1an/blob/master/site/src/Encoders/aomenc.md The --tune-content flag allows optimization of encoding parameters based on the type of content. 'default' is suitable for most content, while 'screen' is specifically tuned for screen recordings to improve compression efficiency. ```bash --tune-content=default ``` -------------------------------- ### x264 Preset: faster Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/x264_help.txt The 'faster' preset further improves encoding quality over 'veryfast' by increasing lookahead and reference frames. It's suitable for scenarios where a good balance of speed and compression is needed. ```bash x264 --preset faster -o ``` -------------------------------- ### Run AV1AN Docker Image (Linux) Source: https://github.com/rust-av/av1an/blob/master/site/src/docker.md This command executes the AV1AN Docker image on Linux to encode a video file. It mounts the current directory to '/videos' inside the container, uses the 'master' tag, and specifies the input file. The --privileged flag is necessary for certain operations within the container, and --user ensures proper file permissions. ```bash docker run --privileged -v "$(pwd):/videos" --user $(id -u):$(id -g) -it --rm masterofzen/av1an:master -i S01E01.mkv {options} ``` -------------------------------- ### x264 Preset: ultrafast Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/x264_help.txt The 'ultrafast' preset significantly speeds up encoding by disabling many quality-enhancing features. It's suitable when encoding speed is the highest priority, sacrificing compression efficiency and quality. ```bash x264 --preset ultrafast -o ``` -------------------------------- ### x264 Preset: fast Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/x264_help.txt The 'fast' preset offers better compression efficiency than 'faster' by increasing the --rc-lookahead value. It's a good option for general-purpose encoding where moderate encoding times are acceptable. ```bash x264 --preset fast -o ``` -------------------------------- ### Resume and Progress Management (Bash) Source: https://context7.com/rust-av/av1an/llms.txt Enables resuming interrupted encodes without losing progress. The '--temp' flag specifies a directory for temporary files, '--keep' preserves this directory after encoding, and '--resume' continues from the last completed chunk. Progress is tracked in 'chunks.json' and 'done.json' within the temp directory. ```bash # Initial encode (interrupted) av1an \ -i input.mkv \ --temp ./temp_encode \ --keep \ -o output.mkv # Resume from interruption av1an \ -i input.mkv \ --temp ./temp_encode \ --resume \ -o output.mkv # Progress tracking: # - Chunk queue saved to temp/chunks.json # - Completed chunks tracked in temp/done.json # - --keep: Preserve temp directory after encoding # - --resume: Continue from last completed chunk ``` -------------------------------- ### Run AV1AN Docker Image (Windows) Source: https://github.com/rust-av/av1an/blob/master/site/src/docker.md This command runs the AV1AN Docker image on Windows for video encoding. It maps the current host directory to '/videos' within the container and uses the 'master' tag for the latest commit. The --privileged flag is included for enhanced container access. ```powershell docker run --privileged -v "${PWD}:/videos" -it --rm masterofzen/av1an:master -i S01E01.mkv {options} ``` -------------------------------- ### Selecting Probing Statistic Method in av1an Source: https://github.com/rust-av/av1an/blob/master/site/src/Cli/target_quality.md Determines the statistical method used to calculate the target quality from probe results. Options include 'auto', 'mean', 'median', 'harmonic', 'root-mean-square', 'percentile', 'standard-deviation', 'mode', 'minimum', and 'maximum'. The default is 'auto'. ```bash # Example: Use median for statistics > av1an ... --probing-stat median # Example: Use percentile with a value of 75 > av1an ... --probing-stat percentile=75.0 # Example: Use standard deviation with a value of 5 > av1an ... --probing-stat standard-deviation=5.0 ``` -------------------------------- ### x264 Tuning: animation Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/x264_help.txt The 'animation' tuning preset is tailored for animated content, adjusting b-frames, deblocking, psy-rd, and aq-strength. It helps maintain the sharp details and consistent colors typical of animation. ```bash x264 --tune animation -o ``` -------------------------------- ### x264 Profile Settings Source: https://github.com/rust-av/av1an/blob/master/av1an-core/tests/x264_help.txt Demonstrates forcing specific H.264 profiles to limit encoding features. Each profile has associated settings that are overridden, such as --no-8x8dct, --bframes, and --no-cabac. Limitations like 'No lossless' are also noted. ```bash # Example for 'baseline' profile: x264 --profile baseline --no-8x8dct --bframes 0 --no-cabac --cqm flat --weightp 0 -o # Example for 'high10' profile: x264 --profile high10 -o # Example for 'high444' profile: x264 --profile high444 -o ```