pub struct CliOpts {Show 42 fields
pub input: PathBuf,
pub output_file: Option<PathBuf>,
pub temp: Option<PathBuf>,
pub quiet: bool,
pub verbose: bool,
pub log_file: Option<String>,
pub log_level: LevelFilter,
pub resume: bool,
pub keep: bool,
pub force: bool,
pub overwrite: bool,
pub max_tries: usize,
pub workers: usize,
pub set_thread_affinity: Option<usize>,
pub scenes: Option<PathBuf>,
pub split_method: SplitMethod,
pub sc_method: ScenecutMethod,
pub sc_pix_format: Option<Pixel>,
pub sc_downscale_height: Option<usize>,
pub extra_split: usize,
pub min_scene_len: usize,
pub encoder: Encoder,
pub video_params: Option<String>,
pub passes: Option<u8>,
pub audio_params: Option<String>,
pub ffmpeg_filter_args: Option<String>,
pub chunk_method: Option<ChunkMethod>,
pub chunk_order: ChunkOrdering,
pub photon_noise: Option<u8>,
pub concat: ConcatMethod,
pub pix_format: Pixel,
pub vmaf: bool,
pub vmaf_path: Option<PathBuf>,
pub vmaf_res: String,
pub vmaf_threads: Option<usize>,
pub vmaf_filter: Option<String>,
pub target_quality: Option<f64>,
pub probes: u32,
pub probing_rate: u32,
pub probe_slow: bool,
pub min_q: Option<u32>,
pub max_q: Option<u32>,
}Expand description
Cross-platform command-line AV1 / VP9 / HEVC / H264 encoding framework with per-scene quality encoding
Fields
input: PathBufInput file to encode
Can be a video or vapoursynth (.py, .vpy) script.
output_file: Option<PathBuf>Video output file
temp: Option<PathBuf>Temporary directory to use
If not specified, the temporary directory name is a hash of the input file name.
quiet: boolDisable printing progress to the terminal
verbose: boolPrint extra progress info and stats to terminal
log_file: Option<String>Log file location [default:
log_level: LevelFilterSet log level for log file (does not affect command-line log level)
error: Designates very serious errors.
warn: Designates hazardous situations.
info: Designates useful information.
debug: Designates lower priority information. Includes rav1e scenechange decision info.
trace: Designates very low priority, often extremely verbose, information.
resume: boolResume previous session from temporary directory
keep: boolDo not delete the temporary folder after encoding has finished
force: boolDo not check if the encoder arguments specified by -v/–video-params are valid
overwrite: boolOverwrite output file without confirmation
max_tries: usizeMaximum number of chunk restarts for an encode
workers: usizeNumber of workers to spawn [0 = automatic]
set_thread_affinity: Option<usize>Pin each worker to a specific set of threads of this size (disabled by default)
This is currently only supported on Linux and Windows, and does nothing on unsupported platforms. Leaving this option unspecified allows the OS to schedule all processes spawned.
scenes: Option<PathBuf>File location for scenes
split_method: SplitMethodMethod used to determine chunk boundaries
“av-scenechange” uses an algorithm to analyze which frames of the video are the start of new scenes, while “none” disables scene detection entirely (and only relies on -x/–extra-split to add extra scenecuts).
sc_method: ScenecutMethodScene detection algorithm to use for av-scenechange
Standard: Most accurate, still reasonably fast. Uses a cost-based algorithm to determine keyframes.
Fast: Very fast, but less accurate. Determines keyframes based on the raw difference between pixels.
sc_pix_format: Option<Pixel>Perform scene detection with this pixel format
sc_downscale_height: Option<usize>Optional downscaling for scene detection
Specify as the desired maximum height to scale to (e.g. “720” to downscale to 720p — this will leave lower resolution content untouched). Downscaling improves scene detection speed but lowers accuracy, especially when scaling to very low resolutions.
By default, no downscaling is performed.
extra_split: usizeMaximum scene length
When a scenecut is found whose distance to the previous scenecut is greater than the value specified by this option, one or more extra splits (scenecuts) are added. Set this option to 0 to disable adding extra splits.
min_scene_len: usizeMinimum number of frames for a scenecut
encoder: EncoderVideo encoder to use
video_params: Option<String>Parameters for video encoder
These parameters are for the encoder binary directly, so the ffmpeg syntax cannot be used.
For example, CRF is specified in ffmpeg via “-crf
passes: Option<u8>Number of encoder passes
Since aom and vpx benefit from two-pass mode even with constant quality mode (unlike other encoders in which two-pass mode is used for more accurate VBR rate control), two-pass mode is used by default for these encoders.
When using aom or vpx with RT mode (–rt), one-pass mode is always used regardless of the value specified by this flag (as RT mode in aom and vpx only supports one-pass encoding).
audio_params: Option<String>Audio encoding parameters (ffmpeg syntax)
If not specified, “-c:a copy” is used.
Do not use ffmpeg’s -map syntax with this option. Instead, use the colon syntax with each parameter you specify.
Subtitles are always copied by default.
Example to encode all audio tracks with libopus at 128k:
-a=“-c:a libopus -b:a 128k”
Example to encode the first audio track with libopus at 128k, and the second audio track with aac at 24k, where only the second track is downmixed to a single channel:
-a=“-c:a:0 libopus -b:a:0 128k -c:a:1 aac -ac:a:1 1 -b:a:1 24k”
ffmpeg_filter_args: Option<String>FFmpeg filter options
chunk_method: Option<ChunkMethod>Method used for piping exact ranges of frames to the encoder
Methods that require an external vapoursynth plugin:
lsmash - Generally the best and most accurate method. Does not require intermediate files. Errors generally only occur if the input file itself is broken (for example, if the video bitstream is invalid in some way, video players usually try to recover from the errors as much as possible even if it results in visible artifacts, while lsmash will instead throw an error). Requires the lsmashsource vapoursynth plugin to be installed.
ffms2 - Accurate and does not require intermediate files. Can sometimes have bizarre bugs that are not present in lsmash (that can cause artifacts in the piped output). Slightly faster than lsmash for y4m input. Requires the ffms2 vapoursynth plugin to be installed.
Methods that only require ffmpeg:
hybrid - Uses a combination of segment and select. Usually accurate but requires intermediate files (which can be large). Avoids decoding irrelevant frames by seeking to the first keyframe before the requested frame and decoding only a (usually very small) number of irrelevant frames until relevant frames are decoded and piped to the encoder.
select - Extremely slow, but accurate. Does not require intermediate files. Decodes from the first frame to the requested frame, without skipping irrelevant frames (causing quadratic decoding complexity).
segment - Create chunks based on keyframes in the source. Not frame exact, as it can only split on keyframes in the source. Requires intermediate files (which can be large).
Default: lsmash (if available), otherwise ffms2 (if available), otherwise hybrid.
chunk_order: ChunkOrderingThe order in which av1an will encode chunks
Available methods:
long-to-short - The longest chunks will be encoded first. This method results in the smallest amount of time with idle cores, as the encode will not be waiting on a very long chunk to finish at the end of the encode after all other chunks have finished.
short-to-long - The shortest chunks will be encoded first.
sequential - The chunks will be encoded in the order they appear in the video.
random - The chunks will be encoded in a random order. This will provide a more accurate estimated filesize sooner in the encode.
photon_noise: Option<u8>Generates a photon noise table and applies it using grain synthesis [strength: 0-64] (disabled by default)
Photon noise tables are more visually pleasing than the film grain generated by aomenc, and provide a consistent level of grain regardless of the level of grain in the source. Strength values correlate to ISO values, e.g. 1 = ISO 100, and 64 = ISO 6400. This option currently only supports aomenc.
An encoder’s grain synthesis will still work without using this option, by specifying the correct parameter to the encoder. However, the two should not be used together, and specifying this option will disable aomenc’s internal grain synthesis.
concat: ConcatMethodDetermines method used for concatenating encoded chunks and audio into output file
ffmpeg - Uses ffmpeg for concatenation. Unfortunately, ffmpeg sometimes produces files with partially broken audio seeking, so mkvmerge should generally be preferred if available. ffmpeg concatenation also produces broken files with the –enable-keyframe-filtering=2 option in aomenc, so it is disabled if that option is used. However, ffmpeg can mux into formats other than matroska (.mkv), such as WebM. To output WebM, use a .webm extension in the output file.
mkvmerge - Generally the best concatenation method (as it does not have either of the aforementioned issues that ffmpeg has), but can only produce matroska (.mkv) files. Requires mkvmerge to be installed.
ivf - Experimental concatenation method implemented in av1an itself to concatenate to an ivf file (which only supports VP8, VP9, and AV1, and does not support audio).
pix_format: PixelFFmpeg pixel format
vmaf: boolPlot an SVG of the VMAF for the encode
This option is independent of –target-quality, i.e. it can be used with or without it. The SVG plot is created in the same directory as the output file.
vmaf_path: Option<PathBuf>Path to VMAF model (used by –vmaf and –target-quality)
If not specified, ffmpeg’s default is used.
vmaf_res: StringResolution used for VMAF calculation
vmaf_threads: Option<usize>Number of threads to use for VMAF calculation
vmaf_filter: Option<String>Filter applied to source at VMAF calcualation
This option should be specified if the source is cropped, for example.
target_quality: Option<f64>Target a VMAF score for encoding (disabled by default)
For each chunk, target quality uses an algorithm to find the quantizer/crf needed to achieve a certain VMAF score. Target quality mode is much slower than normal encoding, but can improve the consistency of quality in some cases.
The VMAF score range is 0-100 (where 0 is the worst quality, and 100 is the best). Floating-point values are allowed.
probes: u32Maximum number of probes allowed for target quality
probing_rate: u32Framerate for probes, 1 - original
probe_slow: boolUse encoding settings for probes specified by –video-params rather than faster, less accurate settings
Note that this always performs encoding in one-pass mode, regardless of –passes.
min_q: Option<u32>Lower bound for target quality Q-search early exit
If min_q is tested and the probe’s VMAF score is lower than target_quality, the Q-search early exits and min_q is used for the chunk.
If not specified, the default value is used (chosen per encoder).
max_q: Option<u32>Upper bound for target quality Q-search early exit
If max_q is tested and the probe’s VMAF score is higher than target_quality, the Q-search early exits and max_q is used for the chunk.
If not specified, the default value is used (chosen per encoder).
Trait Implementations
Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Assign values from ArgMatches to self.
fn parse_from<I, T>(itr: I) -> Self where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn parse_from<I, T>(itr: I) -> Self where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Parse from iterator, exit on error
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Parse from iterator, return Err on error.
fn update_from<I, T>(&mut self, itr: I) where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn update_from<I, T>(&mut self, itr: I) where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Update from iterator, exit on error
fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Update from iterator, return Err on error.
StructOpt::clap is replaced with IntoApp::into_app (derived as part of Parser)
Deprecated, StructOpt::clap replaced with IntoApp::into_app (derive as part of
Parser) Read more
StructOpt::from_clap is replaced with FromArgMatches::from_arg_matches (derived as part of Parser)
Deprecated, StructOpt::from_clap replaced with FromArgMatches::from_arg_matches (derive as part of
Parser) Read more
StructOpt::from_args is replaced with Parser::parse (note the change in derives)
Deprecated, StructOpt::from_args replaced with Parser::parse (note the change in derives)
StructOpt::from_args_safe is replaced with Parser::try_parse (note the change in derives)
Deprecated, StructOpt::from_args_safe replaced with Parser::try_parse (note the change in derives)
StructOpt::from_iter is replaced with Parser::parse_from (note the change in derives)
Deprecated, StructOpt::from_iter replaced with Parser::parse_from (note the change in derives)
fn from_iter_safe<I, T>(itr: I) -> Result<Self, Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn from_iter_safe<I, T>(itr: I) -> Result<Self, Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
StructOpt::from_iter_safe is replaced with Parser::try_parse_from (note the change in derives)
Deprecated, StructOpt::from_iter_safe replaced with Parser::try_parse_from (note the
change in derives) Read more