0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Mac】コマンドで画像をAVIFに変換する方法

Last updated at Posted at 2024-09-12

libavifをインストール

Homebrewを使用してlibavifをインストールします。

brew install libavif

avifencコマンドを使用して画像を変換

avifenc input.png output.avif

スクリーンショット 2024-09-13 15.53.44.png

avifencコマンドで使用できるオプションの詳細は以下のとおりです。

$ avifenc --help
Syntax: avifenc [options] input.[jpg|jpeg|png|y4m] output.avif
Standard options:
    -h,--help                         : Show syntax help (this page)
    -V,--version                      : Show the version number

Basic options:
    -q,--qcolor Q                     : Set quality for color (0-100, where 100 is lossless)
    --qalpha Q                        : Set quality for alpha (0-100, where 100 is lossless)
    -s,--speed S                      : Encoder speed (0-10, slowest-fastest, 'default' or 'd' for codec internal defaults. default speed: 6)

Advanced options:
    -j,--jobs J                       : Number of jobs (worker threads). Use "all" to potentially use as many cores as possible (default: all)
    --no-overwrite                    : Never overwrite existing output file
    -o,--output FILENAME              : Instead of using the last filename given as output, use this filename
    -l,--lossless                     : Set all defaults to encode losslessly, and emit warnings when settings/input don't allow for it
    -d,--depth D                      : Output depth [8,10,12]. (JPEG/PNG only; For y4m or stdin, depth is retained)
    -y,--yuv FORMAT                   : Output format [default=auto, 444, 422, 420, 400]. Ignored for y4m or stdin (y4m format is retained)
                                        For JPEG, auto honors the JPEG's internal format, if possible. For grayscale PNG, auto defaults to 400. For all other cases, auto defaults to 444
    -p,--premultiply                  : Premultiply color by the alpha channel and signal this in the AVIF
    --sharpyuv                        : Use sharp RGB to YUV420 conversion (if supported). Ignored for y4m or if output is not 420.
    --stdin                           : Read y4m frames from stdin instead of files; no input filenames allowed, must set before offering output filename
    --cicp,--nclx P/T/M               : Set CICP values (nclx colr box) (3 raw numbers, use -r to set range flag)
                                        P = color primaries
                                        T = transfer characteristics
                                        M = matrix coefficients
                                        (use 2 for any you wish to leave unspecified)
    -r,--range RANGE                  : YUV range [limited or l, full or f]. (JPEG/PNG only, default: full; For y4m or stdin, range is retained)
    --target-size S                   : Set target file size in bytes (up to 7 times slower)
    --progressive                     : EXPERIMENTAL: Auto set parameters to encode a simple layered image supporting progressive rendering from a single input frame.
    --layered                         : EXPERIMENTAL: Encode a layered AVIF. Each input is encoded as one layer and at most 4 layers can be encoded.
    -g,--grid MxN                     : Encode a single-image grid AVIF with M cols & N rows. Either supply MxN identical W/H/D images, or a single
                                        image that can be evenly split into the MxN grid and follow AVIF grid image restrictions. The grid will adopt
                                        the color profile of the first image supplied.
    -c,--codec C                      : codec to use (choose from versions list below)
    --exif FILENAME                   : Provide an Exif metadata payload to be associated with the primary item (implies --ignore-exif)
    --xmp FILENAME                    : Provide an XMP metadata payload to be associated with the primary item (implies --ignore-xmp)
    --icc FILENAME                    : Provide an ICC profile payload to be associated with the primary item (implies --ignore-icc)
    --timescale,--fps V               : Set the timescale to V. If all frames are 1 timescale in length, this is equivalent to frames per second (Default: 30)
                                        If neither duration nor timescale are set, avifenc will attempt to use the framerate stored in a y4m header, if present.
    -k,--keyframe INTERVAL            : Set the maximum keyframe interval (any set of INTERVAL consecutive frames will have at least one keyframe). Set to 0 to disable (default).
    --ignore-exif                     : If the input file contains embedded Exif metadata, ignore it (no-op if absent)
    --ignore-xmp                      : If the input file contains embedded XMP metadata, ignore it (no-op if absent)
    --ignore-profile,--ignore-icc     : If the input file contains an embedded color profile, ignore it (no-op if absent)
    --pasp H,V                        : Add pasp property (aspect ratio). H=horizontal spacing, V=vertical spacing
    --crop CROPX,CROPY,CROPW,CROPH    : Add clap property (clean aperture), but calculated from a crop rectangle
    --clap WN,WD,HN,HD,HON,HOD,VON,VOD: Add clap property (clean aperture). Width, Height, HOffset, VOffset (in num/denom pairs)
    --irot ANGLE                      : Add irot property (rotation). [0-3], makes (90 * ANGLE) degree rotation anti-clockwise
    --imir AXIS                       : Add imir property (mirroring). 0=top-to-bottom, 1=left-to-right
    --clli MaxCLL,MaxPALL             : Add clli property (content light level information).
    --repetition-count N or infinite  : Number of times an animated image sequence will be repeated. Use 'infinite' for infinite repetitions (Default: infinite)
    --                                : Signals the end of options. Everything after this is interpreted as file names.

  The following options can optionally have a :u (or :update) suffix like `-q:u Q`, to apply only to input files appearing after the option:
    -q,--qcolor Q                     : Set quality for color (0-100, where 100 is lossless)
    --qalpha Q                        : Set quality for alpha (0-100, where 100 is lossless)
    --tilerowslog2 R                  : Set log2 of number of tile rows (0-6, default: 0)
    --tilecolslog2 C                  : Set log2 of number of tile columns (0-6, default: 0)
    --autotiling                      : Set --tilerowslog2 and --tilecolslog2 automatically
    --min QP                          : Set min quantizer for color (0-63, where 0 is lossless)
    --max QP                          : Set max quantizer for color (0-63, where 0 is lossless)
    --minalpha QP                     : Set min quantizer for alpha (0-63, where 0 is lossless)
    --maxalpha QP                     : Set max quantizer for alpha (0-63, where 0 is lossless)
    --scaling-mode N[/D]              : EXPERIMENTAL: Set frame (layer) scaling mode as given fraction. If omitted, D default to 1. (Default: 1/1)
    --duration D                      : Set frame durations (in timescales) to D; default 1. This option always apply to following inputs with or without suffix.
    -a,--advanced KEY[=VALUE]         : Pass an advanced, codec-specific key/value string pair directly to the codec. avifenc will warn on any not used by the codec.

aom-specific advanced options:
    1. <key>=<value> applies to both the color (YUV) planes and the alpha plane (if present).
    2. color:<key>=<value> or c:<key>=<value> applies only to the color (YUV) planes.
    3. alpha:<key>=<value> or a:<key>=<value> applies only to the alpha plane (if present).
       Since the alpha plane is encoded as a monochrome image, the options that refer to the chroma planes,
       such as enable-chroma-deltaq=B, should not be used with the alpha plane. In addition, the film grain
       options are unlikely to make sense for the alpha plane.

    When used with libaom 3.0.0 or later, any key-value pairs supported by the aom_codec_set_option() function
    can be used. When used with libaom 2.0.x or older, the following key-value pairs can be used:

    aq-mode=M                         : Adaptive quantization mode (0: off (default), 1: variance, 2: complexity, 3: cyclic refresh)
    cq-level=Q                        : Constant/Constrained Quality level (0-63, end-usage must be set to cq or q)
    enable-chroma-deltaq=B            : Enable delta quantization in chroma planes (0: disable (default), 1: enable)
    end-usage=MODE                    : Rate control mode (vbr, cbr, cq, or q)
    sharpness=S                       : Bias towards block sharpness in rate-distortion optimization of transform coefficients (0-7, default: 0)
    tune=METRIC                       : Tune the encoder for distortion metric (psnr or ssim, default: psnr)
    film-grain-test=TEST              : Film grain test vectors (0: none (default), 1: test-1  2: test-2, ... 16: test-16)
    film-grain-table=FILENAME         : Path to file containing film grain parameters

Version: 1.1.1 (aom [enc/dec]:3.10.0)
libyuv : unavailable
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?