Git Product home page Git Product logo

cavif's Introduction

cavif

Sorry, this repository is no longer maintained due to the retirement of the main maintainer. After some time, this repository will be archived.

Ther source is currently maitained on avif-community by the maintaier. It's not a official community of AVIF codec. We take no resposibility the name of the community.

This repository will be removed after 2023-01-31 to resolve the confusing situation.

Status
Linux Build on Linux
Linux(.deb) Build debian packages
macOS Build on macOS
Windows Build on Windows

Description (en)

avif encoder, using libaom directly.

avif (AV1 Image File Format) is a still picture format uses a keyframe of AV1.

The most significant mission of this project is "Make it enable to tune libaom's all encoding options to optimize quality/size ratio as nice as possible human beings can".

Description (ja)

AVIF(AV1 Image File Format)は、動画フォーマットであるAV1のキーフレームを流用して圧縮する静止画フォーマットです。

cavifは、ラッパーを介さず libaom を直接叩くavifのエンコーディング・コマンドです。このプロジェクトの唯一にして最大の使命は、 libaomの静止画に関する全エンコードオプションを仔細に操作できるようにして、現生人類が現時点で達成可能な最高の圧縮効率を実現する手段を提供すること です。

日本語の詳しいドキュメントはこちら

How to build

Pre-requirements

cmake >= 3.13

If your system cmake is lower than 3.13, please install the latest version:

To install:

latest version of meson and ninja

meson and ninja are required to build libvmaf.

Please see: https://mesonbuild.com/Quick-guide.html

Or another method: You can use python's venv to install. See our CI about details.

Build steps

# cloning this repository with dependencies.
git clone --recurse-submodules --recursive https://github.com/link-u/cavif

cd cavif

# Apply workarounds
bash scripts/apply-patches.sh

# Build dependencies not managed by CMake.
bash scripts/build-deps.sh

# Make build directory
mkdir build && cd build

# If your system gcc is 8.0 or higher:
cmake -G 'Ninja' ..

# If not, please install gcc-8 (or higher) and tell them to CMake.
CXX=g++-8 CC=gcc-8 cmake -G 'Ninja' ..

# build and get cavif binary!
ninja

Usage

basic usage

cavif -i <input.png> -o <output.avif>

Example avif files are available in AOMediaCodec/av1-avif or link-u/avif-sample-images.

(Currently, detailed documentation is only in Japanese)

basic usage (alpha)

You have to encode alpha plane separately(Of course, it's to achieve best image quality!).

cavif -i <input.png> -o <output-alpha.avif> --encode-target alpha --monochrome
cavif -i <input.png> -o <output.avif> --encode-target image --attach-alpha <output-alpha.avif>

SYNOPSIS

[2022/03/26 11:57:21 INFO ] cavif
[2022/03/26 11:57:21 INFO ] libaom ver: 3.3.0
[2022/03/26 11:57:21 INFO ] libpng ver:1.6.38.git
SYNOPSIS
        cavif -i <input.png> -o <output.avif> [--attach-alpha <input-alpha.avif>] [--attach-depth
              <input-depth.avif>] [--encode-target [image|alpha]] [--show-result] [--rotation
              [0|90|180|270]] [--mirror [vertical|horizontal]] [--crop-size <width,height>]
              [--crop-offset <horizontalOffset,verticalOffset>] [--full-still-picture-header]
              [--color-primaries (<Value defined in
              H.273>|bt709|sRGB|sYCC|unspecified|bt470m|bt470bg|bt601|ntsc|smpte240m|generic-film|bt2020|bt2100|smpte428|xyz|smpte431|smpte432|22)]
              [--transfer-characteristics (<Value defined in
              H.273>|bt709|unspecified|bt470m|bt470bg|bt601|ntsc|smpte240m|linear|log100|log100sqrt10|iec61966|bt1361|sRGB|sYCC|bt2020|bt2020-10bit|bt2020-12bit|smpte2084|bt2100pq|smpte428|bt2100hlg|arib-b67)]
              [--matrix-coefficients (<Value defined in
              H.273>|bt709|sRGB|unspecified|us-fcc|bt470bg|sYCC|bt601|ntsc|smpte240m|bt2020)]
              [--horizontal-scale-mode [1/1|1/2|3/5|4/5|1/4|3/4|1/8]] [--vertical-scale-mode
              [1/1|1/2|3/5|4/5|1/4|3/4|1/8]] [--resize-mode [none|fixed|random]]
              [--resize-denominator_ <[8-16], default=8>] [--superres-mode
              [none|fixed|random|qthresh|auto]] [--superres-denominator_ <[8-16], default=8>]
              [--superres-qthresh <[0-63], default=63 (Do not apply superres filter)>]
              [--render-width <<render-width>>] [--render-height <<render-height>>] [--profile
              <0=base(default), 1=high, 2=professional>] [--pix-fmt [yuv420|yuv422|yuv444]]
              [--bit-depth [8|10|12]] [--disable-full-color-range] [--enable-full-color-range]
              [--encoder-usage [good|realtime]] [--threads <Num of threads to use (default=num of
              logical cores)>] [--enable-row-mt] [--disable-row-mt] [--cpu-used <0-9, default=1.
              Higher means slower encoding and better quality>] [--rate-control [cbr|q|cq]]
              [--bit-rate <kilo-bits per frame(default=0)>] [--crf <0-63(default=10)>] [--qmin
              <0-63(default=0)>] [--qmax <0-63(default=63)>] [--adaptive-quantization
              [none|variance|complexity|cyclic]] [--enable-adaptive-quantization-b]
              [--disable-adaptive-quantization-b] [--delta-q [none|objective|perceptual]]
              [--delta-q-strength] [--enable-chroma-delta-q] [--disable-chroma-delta-q]
              [--enable-loop-filter] [--disable-loop-filter] [--enable-delta-lf]
              [--disable-delta-lf] [--use-qm] [--qm-min <0-15 (default: 5)>] [--qm-max <0-15
              (default: 9)>] [--qm-min-y <0-15 (default: 10)>] [--qm-min-u <0-15 (default: 11)>]
              [--qm-min-v <0-15 (default: 12)>] [--tune
              [ssim|psnr|vmaf-with-preprocessing|vmaf-without-preprocessing|vmaf-max-gain|vmaf-neg-max-gain]]
              [--content-type [default|screen|film]] [--vmaf-model-path <<path-to-vmaf-model-file>>]
              [--lossless] [--monochrome] [--sharpness <0-7>] [--disable-cdef] [--enable-cdef]
              [--disable-loop-restoration] [--enable-loop-restoration] [--superblock-size
              [dynamic|128|64]] [--tile-rows <0-6>] [--tile-columns <0-6>]
              [--keyframe-temporal-filter [disable|without-overlay|with-overlay]]
              [--enable-rect-partitions] [--disable-rect-partitions] [--enable-ab-partitions]
              [--disable-ab-partitions] [--disable-1to4-partitions] [--enable-1to4-partitions]
              [--enable-intra-edge-filter] [--disable-intra-edge-filter] [--min-partition-size
              [4|8|16|32|64|128]] [--max-partition-size [4|8|16|32|64|128]] [--enable-tx64]
              [--disable-tx64] [--enable-flip-idtx] [--disable-flip-idtx] [--enable-rect-tx]
              [--disable-rect-tx] [--use-dct-only] [--use-default-tx-only] [--use-reduced-tx-set]
              [--enable-filter-intra] [--disable-filter-intra] [--enable-smooth-intra]
              [--disable-smooth-intra] [--enable-paeth-intra] [--disable-paeth-intra]
              [--enable-chroma-from-luma] [--disable-chroma-from-luma] [--enable-superres]
              [--disable-superres] [--enable-palette] [--disable-palette] [--enable-intrabc]
              [--disable-intrabc] [--enable-angle-delta] [--disable-angle-delta]
              [--enable-diagonal-intra] [--disable-diagonal-intra] [--enable-directional-intra]
              [--disable-directional-intra] [--enable-tx-size-search] [--disable-tx-size-search]

        cavif -h

OPTIONS
        -i, --input Filename to input
        -o, --output
                    Filename to output

        --attach-alpha
                    Attach alpha plane

        --attach-depth
                    Attach depth plane

        --encode-target
                    Encode target

        image       Encode image planes (default)
        alpha       Encode an alpha plane
        --show-result
                    Show encoding result

        --rotation  Set rotation meta data(irot). Counter-clockwise.
        --mirror    Set mirror meta data(imir).
        --crop-size Set crop size.
        --crop-offset
                    Set crop offset.

        --full-still-picture-header
                    Force to output full picture header

        --color-primaries
                    Set color primaries information value.

        <Value defined in H.273>
                    See https://www.itu.int/rec/T-REC-H.273-201612-I/en

        bt709       Rec. ITU-R BT.709-6
        sRGB        IEC 61966-2-1 sRGB or sYCC
        sYCC        IEC 61966-2-1 sRGB or sYCC
        unspecified Image characteristics are unknown or are determined by the application.
        bt470m      Rec. ITU-R BT.470-6 System M (historical)
        bt470bg     Rec. ITU-R BT.470-6 System B, G (historical)
        bt601       Rec. ITU-R BT.601-7 625
        ntsc        Rec. ITU-R BT.1700-0 NTSC
        smpte240m   SMPTE ST 240 (1999)
        generic-film
                    Generic film (colour filters using Illuminant C)

        bt2020      Rec. ITU-R BT.2020-2
        bt2100      Rec. ITU-R BT.2100-0
        smpte428    SMPTE ST 428-1
        xyz         (CIE 1931 XYZ as in ISO 11664-1)
        smpte431    SMPTE RP 431-2 (2011)
        smpte432    SMPTE EG 432-1 (2010)
        22          No corresponding industry specification identified
        --transfer-characteristics
                    Set transfer characteristics information value.

        <Value defined in H.273>
                    See https://www.itu.int/rec/T-REC-H.273-201612-I/en

        bt709       Rec. ITU-R BT.709-6
        unspecified Image characteristics are unknown or are determined by the application.
        bt470m      Rec. ITU-R BT.470-6 System M (historical)
        bt470bg     Rec. ITU-R BT.470-6 System B, G (historical)
        bt601       Rec. ITU-R BT.1700-0 NTSC
        ntsc        Rec. ITU-R BT.1700-0 NTSC
        smpte240m   SMPTE 240M (1999) (historical)
        linear      Linear transfer characteristics
        log100      Logarithmic transfer characteristic (100:1 range)
        log100sqrt10
                    Logarithmic transfer characteristic (100 * Sqrt( 10 ) : 1 range)

        iec61966    IEC 61966-2-4
        bt1361      Rec. ITU-R BT.1361-0 extended colour gamut system (historical)
        sRGB        IEC 61966-2-1 sRGB or sYCC
        sYCC        IEC 61966-2-1 sRGB or sYCC
        bt2020      Rec. ITU-R BT.2020-2 (10-bit system)
        bt2020-10bit
                    Rec. ITU-R BT.2020-2 (10-bit system)

        bt2020-12bit
                    Rec. ITU-R BT.2020-2 (12-bit system)

        smpte2084   SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
        bt2100pq    Rec. ITU-R BT.2100-0 perceptual quantization (PQ) system
        smpte428    SMPTE ST 428-1
        bt2100hlg   Rec. ITU-R BT.2100-0 hybrid log-gamma (HLG) system
        arib-b67    ARIB STD-B67
        --matrix-coefficients
                    Set matrix coefficients information value.

        <Value defined in H.273>
                    See https://www.itu.int/rec/T-REC-H.273-201612-I/en

        bt709       Rec. ITU-R BT.709-6 (default)
        sRGB        IEC 61966-2-1 sRGB or sYCC (default)
        unspecified Image characteristics are unknown or are determined by the application
        us-fcc      United States Federal Communications Commission (2003)
        bt470bg     Rec. ITU-R BT.470-6 System B, G (historical)
        sYCC        IEC 61966-2-1 sRGB or sYCC
        bt601       Rec. ITU-R BT.601-7 625
        ntsc        Rec. ITU-R BT.1700-0 NTSC
        smpte240m   SMPTE 240M
        bt2020      Rec. ITU-R BT.2020-2 (non-constant luminance)
        --horizontal-scale-mode
                    Set horizontal scale mode

        1/1         Do not scale (default)
        1/2         Scale to 1/2
        3/5         Scale to 3/5
        4/5         Scale to 4/5
        1/4         Scale to 1/4
        3/4         Scale to 3/4
        1/8         Scale to 1/8
        --vertical-scale-mode
                    Set vertical scale mode

        1/1         Do not scale (default)
        1/2         Scale to 1/2
        3/5         Scale to 3/5
        4/5         Scale to 4/5
        1/4         Scale to 1/4
        3/4         Scale to 3/4
        1/8         Scale to 1/8
        --resize-mode
                    Set resize mode

        none        Do not resize
        fixed       Resize image using a denominator_ given by `--resize-denominator_` arg
        random      Resize image randomly!
        --resize-denominator_
                    Set resize denominator_.

        --superres-mode
                    Set superres mode

        none        Do not use superres mode
        fixed       Apply superres filter to image using a denominator_ given by
                    `--superres-denominator_` arg

        random      Apply superres filter to image with a random denominator_!
        qthresh     Apply or do not apply superres filter to image based on the q index
        auto        Apply or do not apply superres filter to image automatically
        --superres-denominator_
                    Set superres resize denominator_.

        --superres-qthresh
                    Set q level threshold for superres.

        --render-width
                    Set render width explicitly

        --render-height
                    Set render height explicitly

        --profile   AV1 Profile(0=base, 1=high, 2=professional)
        --pix-fmt   Pixel format of output image
        yuv420      YUV420 format (default)
        yuv422      YUV422 format
        yuv444      YUV444 format (recommended for lossless images)
        --bit-depth Bit depth of output image
        8           8bits per color, 24bits per pixel (default)
        10          10bits per color, 30bits per pixel
        12          12bits per color, 36bits per pixel
        --disable-full-color-range
                    Use limited YUV color range (default)

        --enable-full-color-range
                    Use full YUV color range

        --encoder-usage
                    Encoder usage

        good        Good Quality mode (default)
        realtime    Real time encoding mode
        --enable-row-mt
                    Enable row based multi-threading of encoder

        --disable-row-mt
                    Disable row based multi-threading of encoder (default)

        --cpu-used  Quality/Speed ratio modifier
        --rate-control
                    Rate control method

        cbr         Constant Bit Rate mode. Please also set `--bit-rate` arg.
        q           Constant Quality (default)
        cq          Constrained Quality
        --bit-rate  Bit rate of output image.
        --crf       CQ Level in CQ rate control mode
        --qmin      Minimum (Best Quality) Quantizer
        --qmax      Maximum (Worst Quality) Quantizer
        --adaptive-quantization
                    Set adaptive-quantization mode

        none        none(default)
        variance    variance based
        complexity  complexity based
        cyclic      Cyclic refresh
        --enable-adaptive-quantization-b
                    use adaptive quantize_b

        --disable-adaptive-quantization-b
                    use traditional adaptive quantization (default)

        --delta-q   a mode of delta q mode feature, that allows modulating q per superblock
        none        disable deltaQ
        objective   Use modulation to maximize objective quality
        perceptual  Use modulation to maximize perceptual quality
        --delta-q-strength
                    strength of deltaQ [0..1000] (default = 100)

        --enable-chroma-delta-q
                    enable delta quantization in chroma

        --disable-chroma-delta-q
                    disable delta quantization in chroma

        --enable-loop-filter
                    enable loop filter (default)

        --disable-loop-filter
                    disable loop filter

        --enable-delta-lf
                    enable delta loop filter

        --disable-delta-lf
                    disable delta loop filter (default)

        --use-qm    Use QMatrix
        --qm-min    Min quant matrix flatness
        --qm-max    Max quant matrix flatness
        --qm-min-y  Min quant matrix flatness for Y
        --qm-min-u  Min quant matrix flatness for U
        --qm-min-v  Min quant matrix flatness for V
        --tune      Quality metric to tune
        ssim        SSIM(structural similarity)
        psnr        PSNR(peak signal-to-noise ratio)
        vmaf-with-preprocessing
                    vmaf-with-preprocessing

        vmaf-without-preprocessing
                    vmaf-without-preprocessing

        vmaf-max-gain
                    vmaf-max-gain

        vmaf-neg-max-gain
                    vmaf-neg-max-gain

        --content-type
                    Content type

        default     Regular video content (default)
        screen      Screen capture content
        film        Film content
        --vmaf-model-path
                    VMAF model file path to tuning image quality

        --lossless  Enable lossless encoding
        --monochrome
                    Encode to monochrome image

        --sharpness Sharpening output
        --disable-cdef
                    Disable Constrained Directional Enhancement Filter (default)

        --enable-cdef
                    Enable Constrained Directional Enhancement Filter

        --disable-loop-restoration
                    Disable Loop Restoration Filter (default)

        --enable-loop-restoration
                    Enable Loop Restoration Filter

        --superblock-size
                    Superblock size.

        dynamic     encoder determines the size automatically.
        128         use 128x128 superblock.
        64          use 64x64 superblock.
        --tile-rows Number of tile rows
        --tile-columns
                    Number of tile columns

        --keyframe-temporal-filter
                    Enable temporal filtering on key frame

        --enable-rect-partitions
                    enable rectangular partitions (default)

        --disable-rect-partitions
                    disable rectangular partitions

        --enable-ab-partitions
                    enable ab partitions (default)

        --disable-ab-partitions
                    disable ab partitions

        --disable-1to4-partitions
                    enable 1to4 partitions (default)

        --enable-1to4-partitions
                    disable 1to4 partitions

        --enable-intra-edge-filter
                    enable intra edge filter (default)

        --disable-intra-edge-filter
                    disable intra edge filter

        --min-partition-size
                    min partition size

        --max-partition-size
                    max partition size

        --enable-tx64
                    enable 64-length transforms (default)

        --disable-tx64
                    disable 64-length transforms

        --enable-flip-idtx
                    enable flip and identity transforms (default)

        --disable-flip-idtx
                    disable flip and identity transforms

        --enable-rect-tx
                    enable rectangular transforms (default)

        --disable-rect-tx
                    disable rectangular transforms

        --use-dct-only
                    Use DCT tx onlyq

        --use-default-tx-only
                    use default tx type only

        --use-reduced-tx-set
                    use reduced tx set, transforms w/o flip (4) + Identity (1).

        --enable-filter-intra
                    enable (default)

        --disable-filter-intra
                    disable 

        --enable-smooth-intra
                    enable (default)

        --disable-smooth-intra
                    disable 

        --enable-paeth-intra
                    enable (default)

        --disable-paeth-intra
                    disable 

        --enable-chroma-from-luma
                    enable (default)

        --disable-chroma-from-luma
                    disable 

        --enable-superres
                    enable frame superresolution (default)

        --disable-superres
                    disable frame superresolution

        --enable-palette
                    enable palette mode

        --disable-palette
                    disable palette mode (default)

        --enable-intrabc
                    enable intra block copy mode (default)

        --disable-intrabc
                    disable intra block copy mode

        --enable-angle-delta
                    enable intra angle delta (default)

        --disable-angle-delta
                    disable intra angle delta

        --enable-diagonal-intra
                    enable usage of D45 to D203 intra modes (default)

        --disable-diagonal-intra
                    disable usage of D45 to D203 intra modes

        --enable-directional-intra
                    turn on directional intra mode (default)

        --disable-directional-intra
                    turn off directional intra mode

        --enable-tx-size-search
                    turn on transform size search (default). Transforms always have the largest
                    possible size

        --disable-tx-size-search
                    turn off transform size search. Search for the best transform size for each
                    block

        -h, --help  Show help and exit.

TODO

  • Thumbnail
  • Improve default configs
  • Add more and more command-line flags.

Related repositories

cavif's People

Contributors

da2x avatar dependabot-preview[bot] avatar dependabot[bot] avatar g2g2g2g avatar kotaro-shibata avatar ledyba-z avatar ryou-kawabata avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cavif's Issues

won't build on macos

vmaf fails during build/install...

Overall it seems to be a bad idea to force the user to download and compile all of these libraries (libpng, libaom, libvmaf) when package managers do this well and the entire concept of libraries is that you don't need to download them into your project.

So please consider letting users manage the dependencies and install them as an option if they are not present.

macOS Release Builds

I'm having issues building on macOS 10.15.6. Is there anyway you can supply a macOS build for each release? Thank you!

タイル分割が出来ていない

link-u/davif#2

以前の問題として、タイル分割ができていない。たぶんまた特定のパラメータを適切にセットしないと有効にならない(のでソース読まないといけないやつ)

--enable-full-color-rangeを有効にしたときはYUVの範囲をフルレンジで変換してほしい

現状ではリミテッドレンジで変換されているようでAVIF用Susieプラグインのifavifで画像を読み込むとYC伸長されていないコントラストの低い絵になってしまいました
またlibavifでavifをy4mに変換してAviUtlに読み込ませた際のヒストグラムの範囲がリミテッドレンジになっていることも確認しました

Misfunction When Converting from Png Files

2
This is my original png file.

1.zip
3
This is what i got with

cavif -i 2.png --cpu-used 0 --enable-cdef --crf 10 --threads 4 --rate-control q --enable-full-color-range -o 1.avif

This is the output text i got.

[2020/07/03 18:54:37 INFO ] cavif
[2020/07/03 18:54:37 INFO ] libaom ver: 1.0.0-errata1-avif-414-g0cfdca944
[2020/07/03 18:54:38 INFO ] Encoding: 2.png -> 1.avif
[2020/07/03 18:54:56 INFO ]  Encoded: 2.png -> 1.avif in 17.99 [sec]

Any ideas?
Cavif is probably the most balanced CLI tool, i really hope to get this settled.

jpeg Support?

Hi There
is there jpeg Support for the Input image?

Upgrade deps

libaom

Blocked by https://bugs.chromium.org/p/aomedia/issues/detail?id=2913

libaom reports assertion error in yuv422:

cavif  --enable-full-color-range -i hato.png -o hato.profile2.8bpc.yuv422.monochrome.avif --tune psnr --profile 2 --bit-depth 8 --pix-fmt yuv422 --monochrome --cpu-used 0 --rate-control q --crf 18
cavif: /github/workspace/external/libaom/av1/encoder/partition_search.c:1172: encode_b: Assertion `x->cb_offset[PLANE_TYPE_UV] < ((1 << num_pels_log2_lookup[cpi->common.seq_params.sb_size]) >> (subsampling_x + subsampling_y))' failed.
make: *** [hato.profile2.8bpc.yuv422.monochrome.avif] Aborted (core dumped)
Makefile:242: recipe for target 'hato.profile2.8bpc.yuv422.monochrome.avif' failed

It seems this assertion related to the issue.

Curiously, this assertion failure is reported only when built by Github Actions's Linux. Windows version does not report it.

vmaf

libaom does not support vmaf v2.0.0

Alpha masks become transparent a little bit.

How to reproduce

Please download our sample images.

Then, encode a file with alpha plane:

cavif -i ../avif-sample-images/plum-blossom-small.png -o alpha.avif --encode-target alpha --profile 0 --bit-depth 8 --pix-fmt yuv420 --cpu-used 0 --lossless --monochrome
cavif -i ../avif-sample-images/plum-blossom-small.png -o plum-blossom.avif --tune psnr --encode-target image --attach-alpha alpha.avif --profile 0 --bit-depth 8 --pix-fmt yuv420 --cpu-used 0 --rate-control q --crf 18

Expected result

Something like:

plum-blossom-small

Actual result we get

Screenshot from 2022-04-15 14-36-17

Can you see checkerboard pattern on the plum blossom?

Brightness (colors) of AVIF file depends on viewer application

There is something strange going on here! I don't know whether the problem lies in cavif, but maybe someone can shed some light on this:

The problem is that the brightness of the AVIF files seem to change depending on what viewer you use for them.
I will sketch out the scenario that I have. I have converted a sample image via https://convertio.co (We'll call it 'internet' in the scenarios as source) as test image to compare against cavif. This is what happens:

Viewer: Firefox

Original: Normal
Cavif: Too bright
Internet: Normal

Viewer: nomacs or xnviewmp

Original: Normal
Cavif: Normal
Internet: Too bright

I think that in either the AVIF container something is wrong, or in the decoder that is used. Before I convert a ton of images to AVIF, I would like to know what is causing this. I don't want to convert everything and then discover that the colors are messed up in some places. If it's a decoder issue, then which decoder is wrong here? Firefox or nomacs? Given that the internet file and cavif file both look different depending on the application that is used.

For your convenience, I attached the demo images to this post. They are royalty free and taken from https://www.pexels.com/nl-nl/foto/dier-schattig-boerderij-gras-4321311/, so yes, this is perfectly legal. (I had to zip them because GitHub doesn't 'support' AVIF files.)
Demo files: cavif-image-brightness-sample.zip

I've used a couple of different commands to convert the image to AVIF with Cavif, but they all yield the same result. Here is one of the commands that I've used: cavif --rate-control q --crf 10 --row-mt --tile-rows 2 --tile-columns 2 --color-primaries bt2020 --transfer-characteristics bt2020 --enable-full-color-range -i original.png -o out.avif

If you do not enable BT.2020, it seems you can lose colors sometimes. I therefore always enable it.

[Question] Recommendation for Quality Matching

When I convert from PNG to AVIF, I'd like to matched the perceived quality of the source image. I've played around with various options, but couldn't find the best settings. Is there a recommended way to do this?

--delta-qのドキュメントが間違えている

日本語のドキュメントは
--delta-q [none, objective, perceptual]
になっているが、英語版が正しく、none→offですね。

ただし、
--adaptive-quantization
はnoneなので、実装をこちらに合わせるも良きかなと思います。

--tuneでdaala-distとcdef-distが有効にならない

daala-distとcdef-distの実装自体はたしかに存在する。しかし、呼ばれていない。

有効にするには、

https://aomedia.googlesource.com/aom/+/refs/tags/v1.0.0-errata1-avif/build/cmake/aom_config_defaults.cmake#115

set_aom_config_var(CONFIG_DIST_8X8 0 "AV1 experiment flag.")

というコンパイルフラグを有効にしないといけない。

まず、これを利用者側で変更する方法がわからない。それを調査する。

さらに、ここを無理やり1に書換えてビルドしたものの、

[2020/01/29 02:20:07 INFO ] cavif
[2020/01/29 02:20:07 INFO ] libaom ver: 1.0.0-errata1-avif
[2020/01/29 02:20:08 INFO ] Encoding: hato.png -> test.avif
cavif: /home/psi/umi/src/github.com/link-u/cavif/external/libaom/av1/encoder/rdopt.c:3425: search_txk_type: Assertion `block_mse_q8 != UINT_MAX' failed.

となって動かない。

masterブランチでなら有効になっているのかどうかをチェックし、もし大丈夫そうなら、自動テスト環境を整えた上で、masterブランチに引き上げる。

Wrong error message about color type

switch(colorType) {
case PNG_COLOR_TYPE_GRAY:
pixelOrder = avif::img::PixelOrder::Mono;
break;
case PNG_COLOR_TYPE_RGB:
case PNG_COLOR_TYPE_PALETTE:
pixelOrder = avif::img::PixelOrder::RGB;
break;
case PNG_COLOR_TYPE_GRAY_ALPHA:
pixelOrder = avif::img::PixelOrder::MonoA;
break;
case PNG_COLOR_TYPE_RGB_ALPHA:
pixelOrder = avif::img::PixelOrder::RGBA;
break;
default:
throw std::logic_error(fmt::format("Unknown bit depth: {}", bitDepth));
}

This code checks about color type, not bit-depth.

初期化の方法について

このコマンドを打ったところ
cavif -i /mnt/c/linux_home/avif-test/png/1.png -o /mnt/c/linux_home/avif-test/avif/1-000.avif --crf 55

[2020/01/26 21:16:44 FATAL] failed to encode a frame: Image size must match encoder init configuration size

こう怒られてしまうのですが、どうやって初期化すればよろしいでしょうか?

[question] How to get the best quality?

I want to convert old jpg's to this format. After some testing I came to this command
cavif -i 1.png --rate-control q --crf 10 --row-mt --tile-rows 2 --tile-columns 2 --threads 4 -o 1.avif
CRF mode as written in many guides is stands for the most recommended mode. Is it right to this case? When value is 10 I can't spot any difference between original, but size decreased significantly 7,16 MB -> 519 KB. The program is eating 10 GB RAM, is this how it should be? Also, how to disable alpha channel? In photo proprieties I can see color depth is 32 bit, but original was 24.

depth encoding

Hi!
In console help I see I can attach depth.avif to my final.avif.
--attach-depth
Attach depth plane

But how should I create depth.avif if there is no such option? I need to encode depth map from png to 12-bit avif file.
Thanks!

Build Errors

Hi. I've experienced a few build errors. Perhaps someone could help me out.
This first was this one. Per the installation instructions:

git clone --recurse-submodules --recursive [email protected]:link-u/cavif.git
Cloning into 'cavif'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The fix was to use this:

git clone --recurse-submodules --recursive https://github.com/link-u/cavif.git

After installing the required version of CMake and starting the build, I got this error:

Performing configure step for 'vmaf_repo'
env: ‘meson’: No such file or directory

It looks like VMAF requires Meson which is not in the build instructions.

I installed pip3, installed Meson, then added it to the PATH

apt install python3-pi
pip3 install meson
PATH=$PATH:~/.local/bin/

CMake completed successfully.

I had an error during Make.

Performing configure step for 'lcms_repo'
/bin/sh: 1: /home/pppadmin/cavif/external/Little-CMS/configure: not found

Little-CMS is required, so I cloned it into the directory "/cavif/external/"

git clone https://github.com/mm2/Little-CMS.git

I ran Make again and had this error:

/cavif/external/libavif-container/src/avif/util/File.cpp:5:10: fatal error: filesystem: No such file or directory
 #include <filesystem>
          ^~~~~~~~~~~~

The fix I found was to edit File.cpp
Replace

#include <filesystem>

with

#include <experimental/filesystem>

With that change, I also had to replace:

std::filesystem

with

std::experimental::filesystem

I made the same change for "/cavif/src/img/PNGReader.cpp".
Now I'm stuck on multiple occurrences of this error:

/cavif/src/AVIFBuilder.cpp: In member function ‘void AVIFBuilder::linkAuxImages(uint32_t, uint32_t)’:
/cavif/src/AVIFBuilder.cpp:183:5: sorry, unimplemented: non-trivial designated initializers not supported

I'm excited to try out this utility because it sounds like exactly what I'm looking for. I appreciate the work you all have put into it. Thanks again.

Build error on Centos 8

Cannot build on Centos 8 (4.18.0-240.10.1.el8_3.x86_64)

  • gcc version 8.3.1
  • cmake version 3.18.4
CMake Error at external/libaom/CMakeLists.txt:438 (message):
  VMAF library not found.

How can this be fixed?

Support rav1e

Really like this CLI encoder, but libaom is a bit slow. Using rav1e if available could significantly speed up encoding.

Is there a way to target a file size?

For instance I want to do a comparison between avif and webp 2. With webp if can target, for instance 244kb and cwebp will work until it achieves 244kb or smaller. Is this possible with cavif?

Impossible to build on Windows

Cavif is the first avif encoder which properly does the job for me. I noticed that you've updated libaom, so I wanted to update my cavif version. You did not build a release for that one yet, so I wanted to compile it myself. That is however impossible to do.

Your build instructions list this as the first command: git clone --recurse-submodules --recursive [email protected]:link-u/cavif.git
Which doesn't work, since the access to that URL is denied. If you remove the account from that command, it will at least get into the cloning, but it still doesn't work properly.

Command output:

$ git clone --recurse-submodules --recursive https://github.com/link-u/cavif.git
Cloning into 'cavif'...
remote: Enumerating objects: 32, done.
remote: Counting objects: 100% (32/32), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 1252 (delta 12), reused 22 (delta 8), pack-reused 1220
Receiving objects: 100% (1252/1252), 207.61 KiB | 543.00 KiB/s, done.
Resolving deltas: 100% (751/751), done.
Submodule 'external/clipp' ([email protected]:muellan/clipp.git) registered for path 'external/clipp'
Submodule 'external/libaom' (https://aomedia.googlesource.com/aom) registered for path 'external/libaom'
Submodule 'external/libavif-container' ([email protected]:link-u/libavif-container.git) registered for path 'external/libavif-container'
Submodule 'external/libpng' (git://git.code.sf.net/p/libpng/code) registered for path 'external/libpng'
Submodule 'external/vmaf' ([email protected]:Netflix/vmaf.git) registered for path 'external/vmaf'
Submodule 'external/zlib' ([email protected]:madler/zlib.git) registered for path 'external/zlib'
Cloning into '/cygdrive/u/Desktop/cavif/external/clipp'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:muellan/clipp.git' into submodule path '/cygdrive/u/Desktop/cavif/external/clipp' failed
Failed to clone 'external/clipp'. Retry scheduled
Cloning into '/cygdrive/u/Desktop/cavif/external/libaom'...
remote: Sending approximately 257.12 MiB ...
remote: Counting objects: 6, done
remote: Total 219654 (delta 174323), reused 219654 (delta 174323)
Receiving objects: 100% (219654/219654), 257.12 MiB | 2.64 MiB/s, done.
Resolving deltas: 100% (174323/174323), done.
Cloning into '/cygdrive/u/Desktop/cavif/external/libavif-container'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:link-u/libavif-container.git' into submodule path '/cygdrive/u/Desktop/cavif/external/libavif-container' failed
Failed to clone 'external/libavif-container'. Retry scheduled
Cloning into '/cygdrive/u/Desktop/cavif/external/libpng'...
remote: Enumerating objects: 107016, done.
remote: Counting objects: 100% (107016/107016), done.
remote: Compressing objects: 100% (13936/13936), done.
remote: Total 107016 (delta 97488), reused 101700 (delta 92844)
Receiving objects: 100% (107016/107016), 23.26 MiB | 1.24 MiB/s, done.
Resolving deltas: 100% (97488/97488), done.
Cloning into '/cygdrive/u/Desktop/cavif/external/vmaf'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:Netflix/vmaf.git' into submodule path '/cygdrive/u/Desktop/cavif/external/vmaf' failed
Failed to clone 'external/vmaf'. Retry scheduled
Cloning into '/cygdrive/u/Desktop/cavif/external/zlib'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:madler/zlib.git' into submodule path '/cygdrive/u/Desktop/cavif/external/zlib' failed
Failed to clone 'external/zlib'. Retry scheduled
Cloning into '/cygdrive/u/Desktop/cavif/external/clipp'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:muellan/clipp.git' into submodule path '/cygdrive/u/Desktop/cavif/external/clipp' failed
Failed to clone 'external/clipp' a second time, aborting

And then as expected, trying to compile the code with CMake also fails:

-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.18363.
-- The C compiler identification is MSVC 19.26.28806.0
-- The CXX compiler identification is MSVC 19.26.28806.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSV
C/14.26.28801/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSV
C/14.26.28801/bin/Hostx64/x64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/M
SVC/14.26.28801/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/M
SVC/14.26.28801/bin/Hostx64/x64/cl.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is MSVC
-- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801
/bin/Hostx64/x64/cl.exe
CMake Error at CMakeLists.txt:15 (add_subdirectory):
  The source directory

    U:/Desktop/cavif/external/libavif-container

  does not contain a CMakeLists.txt file.


CMake Error at CMakeLists.txt:20 (add_subdirectory):
  The source directory

    U:/Desktop/cavif/external/zlib

  does not contain a CMakeLists.txt file.


CMake Error at CMakeLists.txt:31 (add_subdirectory):
  The source directory

    U:/Desktop/cavif/external/libpng

  does not contain a CMakeLists.txt file.


CMake Error at CMakeLists.txt:33 (target_include_directories):
  Cannot specify include directories for target "png_static" which is not
  built by this project.


CMake Error at CMakeLists.txt:35 (target_link_directories):
  Cannot specify link directories for target "png_static" which is not built
  by this project.


CMake Error at CMakeLists.txt:36 (target_include_directories):
  Cannot specify include directories for target "png_static" which is not
  built by this project.


CMake Error at CMakeLists.txt:37 (target_link_libraries):
  Cannot specify link libraries for target "png_static" which is not built by
  this project.

You may have noticed that I am doing this via Cygwin with MSVC, instead of a regular Windows command prompt. I can tell you that it doesn't make a difference: they both fail with the same errors.

Probably these files CMake is complaining about do not exist because the cloning failed. How can this be fixed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.