Skip to content

Instantly share code, notes, and snippets.

@nico-lab
Last active October 1, 2024 12:03
Show Gist options
  • Save nico-lab/e0c4ddb0af44819c21a8c5b27e739639 to your computer and use it in GitHub Desktop.
Save nico-lab/e0c4ddb0af44819c21a8c5b27e739639 to your computer and use it in GitHub Desktop.
Usage: SvtAv1EncApp <options> <-b dst_filename> -i src_filename
Examples:
Multi-pass encode (VBR):
SvtAv1EncApp <--stats svtav1_2pass.log> --passes 2 --rc 1 --tbr 1000 -b dst_filename -i src_filename
Multi-pass encode (CRF):
SvtAv1EncApp <--stats svtav1_2pass.log> --passes 2 --rc 0 --crf 43 -b dst_filename -i src_filename
Single-pass encode (VBR):
SvtAv1EncApp --passes 1 --rc 1 --tbr 1000 -b dst_filename -i src_filename
Options:
--help Shows the command line options currently available
--version Shows the version of the library that's linked to the library
-i, --input Input raw video (y4m and yuv) file path, use `stdin` or `-` to read from pipe
-b, --output Output compressed (ivf) file path, use `stdout` or `-` to write to pipe
-c, --config Configuration file path
--errlog Error file path, defaults to stderr
-o, --recon Reconstructed yuv file path
--stat-file PSNR / SSIM per picture stat output file path, requires `--enable-stat-report 1`
--progress Verbosity of the output, default is 1 [0: no progress is printed, 2: aomenc style output]
--no-progress Do not print out progress, default is 0 [1: `--progress 0`, 0: `--progress 1`]
--preset Encoder preset, presets < 0 are for debugging. Higher presets means faster encodes, but with a quality tradeoff, default is 10 [-1-13]
--svtav1-params colon separated list of key=value pairs of parameters with keys based on config file options
Encoder Global Options:
-w, --width Frame width in pixels, inferred if y4m, default is 0 [64-16384]
-h, --height Frame height in pixels, inferred if y4m, default is 0 [64-8704]
--forced-max-frame-width Maximum frame width value to force, default is 0 [64-16384]
--forced-max-frame-height Maximum frame height value to force, default is 0 [64-8704]
--n Number of frames to encode. If `n` is larger than the input, the encoder will loop back and continue encoding, default is 0 [0: until EOF, 1-`(2^63)-1`]
--skip Number of frames to skip. Default is 0 [0: don`t skip, 1-`(2^63)-1`]
--frames Number of frames to encode. If `n` is larger than the input, the encoder will loop back and continue encoding, default is 0 [0: until EOF, 1-`(2^63)-1`]
--nb Buffer `n` input frames into memory and use them to encode, default is -1 [-1: no frames buffered, 1-`(2^31)-1`]
--color-format Color format, only yuv420 is supported at this time, default is 1 [0: yuv400, 1: yuv420, 2: yuv422, 3: yuv444]
--profile Bitstream profile, default is 0 [0: main, 1: high, 2: professional]
--level Bitstream level, defined in A.3 of the av1 spec, default is 0 [0: autodetect from input, 2.0-7.3]
--enable-hdr Enable writing of HDR metadata in the bitstream, default is 0 [0-1]
--fps Input video frame rate, integer values only, inferred if y4m, default is 60 [1-240]
--fps-num Input video frame rate numerator, default is 60000 [0-2^32-1]
--fps-denom Input video frame rate denominator, default is 1000 [0-2^32-1]
--input-depth Input video file and output bitstream bit-depth, default is 8 [8, 10]
--inj Inject pictures to the library at defined frame rate, default is 0 [0-1]
--inj-frm-rt Set injector frame rate, only applicable with `--inj 1`, default is 60 [0-240]
--enable-stat-report Calculates and outputs PSNR SSIM metrics at the end of encoding, default is 0 [0-1]
--asm Limit assembly instruction set, only applicable to x86, default is max [c, mmx, sse, sse2, sse3, ssse3, sse4_1, sse4_2, avx, avx2, avx512, max]
--lp Target (best effort) number of logical cores to be used. 0 means all. Refer to Appendix A.1 of the user guide, default is 0 [0, core count of the machine]
--pin Pin the execution to the first --lp cores. Overwritten to 1 when `--ss` is set. Refer to Appendix A.1 of the user guide, default is 0 [0-1]
--ss Specifies which socket to run on, assumes a max of two sockets. Refer to Appendix A.1 of the user guide, default is -1 [-1, 0, -1]
Rate Control Options:
--rc Rate control mode, default is 0 [0: CRF or CQP (if `--aq-mode` is 0), 1: VBR, 2: CBR]
-q, --qp Initial QP level value, default is 35 [1-63]
--crf Constant Rate Factor value, setting this value is equal to `--rc 0 --aq-mode 2 --qp x`, default is 35 [1-63]
--tbr Target Bitrate (kbps), only applicable for VBR and CBR encoding, default is 7000 [1-100000]
--mbr Maximum Bitrate (kbps) only applicable for CRF encoding, default is 0 [1-100000]
--use-q-file Overwrite the encoder default picture based QP assignments and use QP values from `--qp-file`, default is 0 [0-1]
--qpfile Path to a file containing per picture QP value separated by newlines
--max-qp Maximum (highest) quantizer, only applicable for VBR and CBR, default is 63 [1-63]
--min-qp Minimum (lowest) quantizer, only applicable for VBR and CBR, default is 1 [1-63]
--aq-mode Set adaptive QP level, default is 2 [0: off, 1: variance base using AV1 segments, 2: deltaq pred efficiency]
--use-fixed-qindex-offsets Overwrite the encoder default hierarchical layer based QP assignment and use fixed Q index offsets, default is 0 [0-2]
--key-frame-qindex-offset Overwrite the encoder default keyframe Q index assignment, default is 0 [-256-255]
--key-frame-chroma-qindex-offset Overwrite the encoder default chroma keyframe Q index assignment, default is 0 [-256-255]
--qindex-offsets list of luma Q index offsets per hierarchical layer, separated by `,` with each offset in the range of [-256-255], default is `0,0,..,0`
--chroma-qindex-offsets list of chroma Q index offsets per hierarchical layer, separated by `,` with each offset in the range of [-256-255], default is `0,0,..,0`
--luma-y-dc-qindex-offset Luma Y DC Qindex Offset
--chroma-u-dc-qindex-offset Chroma U DC Qindex Offset
--chroma-u-ac-qindex-offset Chroma U AC Qindex Offset
--chroma-v-dc-qindex-offset Chroma V DC Qindex Offset
--chroma-v-ac-qindex-offset Chroma V AC Qindex Offset
--lambda-scale-factors list of scale factor for lambda values used for different frame types defined by SvtAv1FrameUpdateType, separated by `,` with each scale factor as integer. value divided by 128 is the actual scale factor in float, default is `128,128,..,128`
--undershoot-pct Only for VBR and CBR, allowable datarate undershoot (min) target (percentage), default is 25, but can change based on rate control [0-100]
--overshoot-pct Only for VBR and CBR, allowable datarate overshoot (max) target (percentage), default is 25, but can change based on rate control [0-100]
--mbr-overshoot-pct Only for Capped CRF, allowable datarate overshoot (max) target (percentage), default is 50, but can change based on rate control [0-100]
--gop-constraint-rc Enable GoP constraint rc. When enabled, the rate control matches the target rate for each GoP, default is 0 [0-1]
--buf-sz Client buffer size (ms), only applicable for CBR, default is 6000 [0-10000]
--buf-initial-sz Client initial buffer size (ms), only applicable for CBR, default is 4000 [0-10000]
--buf-optimal-sz Client optimal buffer size (ms), only applicable for CBR, default is 5000 [0-10000]
--recode-loop Recode loop level, refer to "Recode loop level table" in the user guide for more info [0: off, 4: preset based]
--minsection-pct GOP min bitrate (expressed as a percentage of the target rate), default is 0 [0-100]
--maxsection-pct GOP max bitrate (expressed as a percentage of the target rate), default is 2000 [0-10000]
--enable-qm Enable quantisation matrices, default is 0 [0-1]
--qm-min Min quant matrix flatness, default is 8 [0-15]
--qm-max Max quant matrix flatness, default is 15 [0-15]
--roi-map-file Enable Region Of Interest and specify a picture based QP Offset map file, default is off
Multi-pass Options:
--pass Multi-pass selection, pass 3 is only available for VBR, default is 0 [0: single pass encode, 1: first pass, 2: second pass, 3: third pass]
--stats Filename for multi-pass encoding, default is "svtav1_2pass.log"
--passes Number of encoding passes, default is preset dependent but generally 1 [1: one pass encode, 2: multi-pass encode]
GOP size and type Options:
--keyint GOP size (frames), default is -2 [-2: ~5 seconds, -1: "infinite" and only applicable for CRF, 0: same as -1]
--irefresh-type Intra refresh type, default is 2 [1: FWD Frame (Open GOP), 2: KEY Frame (Closed GOP)]
--scd Scene change detection control, default is 0 [0-1]
--lookahead Number of frames in the future to look ahead, not including minigop, temporal filtering, and rate control, default is -1 [-1: auto, 0-120]
--hierarchical-levels Set hierarchical levels beyond the base layer, default is <=M12: 5, else: 4 [2: 3 temporal layers, 3: 4 temporal layers, 4: 5 layers, 5: 6 layers]
--pred-struct Set prediction structure, default is 2 [1: low delay frames, 2: random access]
--force-key-frames Force key frames at the comma separated specifiers. `#f` for frames, `#.#s` for seconds
--startup-mg-size Specify another mini-gop configuration for the first mini-gop after the key-frame, default is 0 [0: OFF, 2: 3 temporal layers, 3: 4 temporal layers, 4: 5 temporal layers]
AV1 Specific Options:
--tile-rows Number of tile rows to use, `TileRow == log2(x)`, default changes per resolution but is 1 [0-6]
--tile-columns Number of tile columns to use, `TileCol == log2(x)`, default changes per resolution but is 1 [0-4]
--enable-dlf Deblocking loop filter control, default is 1 [0-1]
--enable-cdef Enable Constrained Directional Enhancement Filter, default is 1 [0-1]
--enable-restoration Enable loop restoration filter, default is 1 [0-1]
--enable-tpl-la Temporal Dependency model control, currently forced on library side, only applicable for CRF/CQP, default is 1 [0-1]
--enable-mfmv Motion Field Motion Vector control, default is -1 [-1: auto, 0-1]
--enable-dg Dynamic GoP control, default is 1 [0-1]
--fast-decode Fast Decoder levels, default is 0 [0-2]
--enable-tf Enable ALT-REF (temporally filtered) frames, default is 1 [0-1]
--enable-overlays Enable the insertion of overlayer pictures which will be used as an additional reference frame for the base layer picture, default is 0 [0-1]
--tune Specifies whether to use PSNR or VQ as the tuning metric [0 = VQ, 1 = PSNR, 2 = SSIM], default is 1 [0-2]
--scm Set screen content detection level, default is 2 [0: off, 1: on, 2: content adaptive]
--rmv Restrict motion vectors from reaching outside the picture boundary, default is 0 [0-1]
--film-grain Enable film grain, default is 0 [0: off, 1-50: level of denoising for film grain]
--film-grain-denoise Apply denoising when film grain is ON, default is 0 [0: no denoising, film grain data is still in frame header, 1: level of denoising is set by the film-grain parameter]
--fgs-table Set the film grain model table path
--superres-mode Enable super-resolution mode, refer to the super-resolution section in the user guide, default is 0 [0: off, 1-3, 4: auto-select mode]
--superres-denom Super-resolution denominator, only applicable for mode == 1, default is 8 [8: no scaling, 9-15, 16: half-scaling]
--superres-kf-denom Super-resolution denominator for key frames, only applicable for mode == 1, default is 8 [8: no scaling, 9-15, 16: half-scaling]
--superres-qthres Super-resolution q-threshold, only applicable for mode == 3, default is 43 [0-63]
--superres-kf-qthres Super-resolution q-threshold for key frames, only applicable for mode == 3, default is 43 [0-63]
--sframe-dist S-Frame interval (frames) (0: OFF[default], > 0: ON)
--sframe-mode S-Frame insertion mode ([1-2], 1: the considered frame will be made into an S-Frame only if it is an altref frame, 2: the next altref frame will be made into an S-Frame[default])
--resize-mode Enable resize mode [0: none, 1: fixed scale, 2: random scale, 3: dynamic scale, 4: random access]
--resize-denom Resize denominator, only applicable for mode == 1 [8-16]
--resize-kf-denom Resize denominator for key frames, only applicable for mode == 1 [8-16]
--frame-resz-events Resize frame events, in a list separated by ',', a reference scaling process starts from the given frame number with new denominators, only applicable for mode == 4
--frame-resz-kf-denoms Resize denominator for key frames in event, in a list separated by ',', only applicable for mode == 4
--frame-resz-denoms Resize denominator in event, in a list separated by ',', only applicable for mode == 4
Color Description Options:
--color-primaries Color primaries, refer to Appendix A.2 of the user guide, default is 2 [0-12, 22]
--transfer-characteristics Transfer characteristics, refer to Appendix A.2 of the user guide, default is 2 [0-22]
--matrix-coefficients Matrix coefficients, refer to Appendix A.2 of the user guide, default is 2 [0-14]
--color-range Color range, default is 0 [0: Studio, 1: Full]
--chroma-sample-position Chroma sample position, default is 'unknown' ['unknown', 'vertical'/'left', 'colocated'/'topleft']
--mastering-display Mastering display metadata in the format of "G(x,y)B(x,y)R(x,y)WP(x,y)L(max,min)", refer to the user guide Appendix A.2
--content-light Set content light level in the format of "max_cll,max_fall", refer to the user guide Appendix A.2
Variance Boost Options:
--enable-variance-boost Enable variance boost, default is 0 [0-1]
--variance-boost-strength Variance boost strength, default is 2 [1-4]
--variance-octile Octile for variance boost, default is 6 [1-8]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment