Coder Social home page Coder Social logo

cavif-rs's Introduction

cavif — PNG/JPEG to AVIF converter

Encoder/converter for AVIF images. Based on rav1e and avif-serialize, which makes it an almost pure-Rust tool (it uses C LCMS2 for color profiles).

Installation

➡️ Download the latest release ⬅️

The pre-built zip includes a portable static executable, with no dependencies, that runs on any Linux distro. It also includes executables for macOS and Windows.

Usage

Run in a terminal (hint: you don't need to type the path, terminals accept file drag'n'drop)

cavif image.png

It makes image.avif. You can adjust quality (it's in 1-100 scale):

cavif --quality 60 image.png

Advanced usage

You can also specify multiple images. Encoding is multi-threaded, so the more, the better!

cavif [OPTIONS] IMAGES...
  • --quality=n — Quality from 1 (worst) to 100 (best), the default value is 80. The numbers are only a rough approximation of JPEG's quality scale. Beware when comparing codecs. There is no lossless compression support, 100 just gives unreasonably bloated files.
  • --speed=n — Encoding speed between 1 (best, but slowest) and 10 (fastest, but a blurry mess), the default value is 4. Speeds 1 and 2 are unbelievably slow, but make files ~3-5% smaller. Speeds 7 and above degrade compression significantly, and are not recommended.
  • --overwrite — Replace files if there's .avif already. By default the existing files are left untouched.
  • -o path — Write images to this path (instead of same-name.avif). If multiple input files are specified, it's interpreted as a directory.
  • --quiet — Don't print anything during conversion.

There are additional options that tweak AVIF color space. The defaults in cavif are chosen to be the best, so use these options only when you know it's necessary:

  • --dirty-alpha — Preserve RGB values of fully transparent pixels (not recommended). By default irrelevant color of transparent pixels is cleared to avoid wasting space.
  • --color=rgb — Encode using RGB instead of YCbCr color space. Makes colors closer to lossless, but makes files larger. Use only if you need to avoid even smallest color shifts.
  • --depth=8 — Encode using 8-bit color depth instead of 10-bit. This results in a slightly worse quality/compression ratio, but is more compatible.

Compatibility

Images work in all modern browsers.

  • Chrome 85+ desktop,
  • Chrome on Android 12,
  • Firefox 91,
  • Safari iOS 16/macOS Ventura.

Known incompatibilities

  • Windows' preview and very old versions of android are reported to show pink line at the right edge. This is probably a bug in an old AVIF decoder they use.
  • Windows' preview doesn't seem to support 10-bit deep images. Use --depth=8 when encoding if this is a problem.

Building

To build it from source you need Rust 1.67 or later, preferably via rustup.

Then run in a terminal:

rustup update
cargo install cavif

cavif-rs's People

Contributors

0xflotus avatar dbquarrel avatar est31 avatar insumanth avatar kornelski avatar nucliweb avatar rkusa avatar szpadel avatar wantehchang 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  avatar  avatar  avatar  avatar  avatar  avatar

cavif-rs's Issues

Saving AVIFs with different names to different directories

Sadly the following is not working, as -o creates a directory and the hashed original filename is taken:

cavif -q 60 -s 6 /app/storage/runtime/imager/temp/2857c3cd15a554c56dda07e564382c37.png -o /app/web/imager/root/3284/person-home_7fdd2710.avif

Is there a way to cavif foo/foo.jpg -o foobar/bar.avif?

ComplianceWarden errors with CAvif encoded images

https://github.com/gpac/ComplianceWarden is a tool to check AVIF images and other media formats against specifications.

With an image encoded by CAvif 1.3.0, it reports the following errors:

+--------------------------------------+
|           avif validation            |
+--------------------------------------+

Specification description: AVIF v1.0.0, 19 February 2019
https://aomediacodec.github.io/av1-avif/

[avif][Rule #7] Error: The values of the AV1CodecConfigurationBox shall match
the Sequence Header OBU in the AV1 Image Item Data:
	AV1CodecConfigurationBox:
		seq_profile=0
		seq_level_idx_0=0
		seq_tier_0=0
		high_bitdepth=0
		twelve_bit=0
		mono_chrome=0
		chroma_subsampling_x=0
		chroma_subsampling_y=0
		chroma_sample_position=0
	Sequence Header OBU in the AV1 Image Item Data:
		seq_profile=1
		seq_level_idx_0=31
		seq_tier_0=0
		high_bitdepth=0
		twelve_bit=0
		mono_chrome=0
		chroma_subsampling_x=0
		chroma_subsampling_y=0
		chroma_sample_position=0

[avif][Rule #9] Error: Transformative property "av1C" shall be marked as essential (item_ID=1)

========================================
[avif] 2 error(s), 0 warning(s).
========================================

===== Involved rules descriptions:

[avif][Rule #7] Section 2.2.1
The values of the fields in the AV1CodecConfigurationBox shall match those of the
Sequence Header OBU in the AV1 Image Item Data.

[avif][Rule #9] Section 2.2.1
AV1 Item Configuration Property [...] shall be marked as essential.

+--------------------------------------+
|           miaf validation            |
+--------------------------------------+

Specification description: MIAF (Multi-Image Application Format)
MPEG-A part 22 - ISO/IEC 23000-22 - w18260 FDIS - Jan 2019

[miaf][Rule #2] Error: compatible_brands list shall contain 'miaf' (not found) and 'mif1' (found)

========================================
[miaf] 1 error(s), 0 warning(s).
========================================

===== Involved rules descriptions:

[miaf][Rule #2] Section 7.2.1.2
The FileTypeBox shall contain, in the compatible_brands list,
the following (in any order): 'mif1' (specified in ISO/IEC 23008-12)
[...]
Files conforming to the general restrictions in clause 7 shall include
the brand 'miaf' in the compatible_brands in the FileTypeBox.

+--------------------------------------+
|           heif validation            |
+--------------------------------------+

Specification description: HEIF - ISO/IEC 23008-12 - 2nd Edition N18310

========================================
[heif] No errors.
========================================

+--------------------------------------+
|          isobmff validation          |
+--------------------------------------+

Specification description: ISO Base Media File Format
MPEG-4 part 12 - ISO/IEC 14496-12 - m17277 (6th+FDAM1+FDAM2+COR1-R4)

[isobmff][Rule #12] Error: 'hdlr box': reserved1 shall be 0 but value is 1383428980

========================================
[isobmff] 1 error(s), 0 warning(s).
========================================

===== Involved rules descriptions:

[isobmff][Rule #12] Section 8.4.3.1
'hdlr box': pre_defined = 0, reserved = 0, 'name' field shall be null-terminated.

The tool's checks are based on AVIF v1.0.0 specifications from February 2019, so I'm not sure if all the errors are valid. However, I think it is good to check these so that possible more strict validation in browsers doesn't prevent CAvif generated images from showing.

Question about quality vs quantizers.

Hi
I can see you have gone to a lot of trouble to map Q to the rav1e quantizers.
This makes it intuitive for people who use cjpeg and cwebp etc.
When they have experimented some they will settle on a value of Q to use for cavif.

But might there be a case to allow access to the quantizers INSTEAD of the Q scale?

Something like this...

-Q, --quality <n>    Quality from 1 (worst) to 100 (best). NB! Not the same scale as JPEG quality [default: 80]
                     This can be used instead of quantizer values.

                     OR

                     These can be used instead of Q.
--min         <n>  : Set min quantizer for color (0-63, where 0 is lossless)
                   
--max         <n>  : Set max quantizer for color (0-63, where 0 is lossless)
                
--minalpha    <n>  : Set min quantizer for alpha (0-63, where 0 is lossless)                    
    
--maxalpha    <n>  : Set max quantizer for alpha (0-63, where 0 is lossless)

[Suggestion] Add before size at the output info

Hi
I just discovered your tool and I started to test all the options and how they impact quality and size. One small thing I really like about your tool is that it gives direct and simple info on how efficient encoding was by showing output size. What would be even more convenient is to add info about input size. Something like this:
some_file.jpg: 100KB -> 50KB (other stuff ;))
The reasoning here is that I often first check how specific combination of parameters impact size and then how it looks. And it's simply easier to check it when I don't have to jump between windows. Especially when I do a batch encoding. :P

Issue installing through cargo [error E0308]

Hi
I'm not sure if it's related to the cavif itself but as it happens during installation so here it goes.
I wanted to install newest version 1.3.1 as I previously was using one compiled next to cargo one. But during installation this happens:

Compiling ravif v0.8.6
error[E0308]: mismatched types
   --> /home/draghmar/.cargo/registry/src/github.com-1ecc6299db9ec823/ravif-0.8.6/src/av1encoder.rs:278:47
    |
278 |         speed_settings.fast_scene_detection = true;
    |                                               ^^^^ expected enum `SceneDetectionSpeed`, found `bool`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `ravif` due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cavif v1.3.1`, intermediate artifacts can be found at `/tmp/cargo-installmAxIvK`

Caused by:
  build failed

I've got this on two different systems but both on ArchLinux if that matters.

browser compatablity

I'm using Firefox Dev 86.0b5 (64-bit), & .avif files show fine without using a flag. Caniuse confirms this, but doesn't mention the alpha issue. Have images to test?

Want me to edit the README when Ff v86 lands?

can we convert PNG with specified sampling format?

First,thank you for this very helpful tool !
In my case, convert the png file to avif ,I found that it will generate a pink stripe at the right edge of the png file.
It is the same situation in AOMediaCodec/libavif when encoding with the " -y 444" option, but not with "-y 420" or "-y 422"
So, i guess it (Chroma Subsampling) is the cause of this little problem.

CLI: cavif -Q 50 test.png
the original image for test:
Tray

after convert like this( a jpeg for just show what it looks like):
image

Thank U!

FireFox 92.0b2 - avif from cavif won't work

So the FF92 branch has dropped and with that official AVIF support (turned on by default) but at the same time they changed something because all the files that were working in 91 doesn't work right now - opening them directly shows info that image had some errors and can't be displayed. Doesn't matter if the source was JPG or PNG with transparency. They were generated with cavif 1.3.0 as this is the last one at cargo. I also tried 1.3.1 but the result was the same.

Edit: For the record - squoosh produces files valid for FF92.

Build failed installing cavif

I have error when install cavif:

  1. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2. cargo install cavif
  3. Error:
   Compiling rav1e v0.3.3
error: failed to run custom build command for `rav1e v0.3.3`

Caused by:
  process didn't exit successfully: `/var/folders/v2/t3z00rwx01z3gmw0z9tbjvmr0000gn/T/cargo-installSXajb4/release/build/rav1e-d8980461473ddf6e/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-cfg=nasm_x86_64

--- stderr
thread 'main' panicked at 'This version of NASM is too old: No such file or directory (os error 2)', /Users/joan.leon/.cargo/registry/src/github.com-1ecc6299db9ec823/nasm-rs-0.1.7/src/lib.rs:301:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

warning: build failed, waiting for other jobs to finish...
error: failed to compile `cavif v0.1.0`, intermediate artifacts can be found at `/var/folders/v2/t3z00rwx01z3gmw0z9tbjvmr0000gn/T/cargo-installSXajb4`

Caused by:
  build failed

Chrome 93.0.4577.63 doesn't seem to like 1.3.0

Seems to work great in 92.0.4515.131. I had images that suddenly stopped working in Chrome maybe a month or two ago, and rebuilding them all with 1.3.0 seemed to fix them, but now with this Chrome update some of my images are not loading anymore. I've attached an example one, confirmed it's definitely being converted with 1.3.0.

Same exact behavior with the previous Chrome breaking things where Chrome gives no errors, just decides not to show anything.

Going to test with 1.3.1 but it doesn't look like that version fixed compatibility issues so I don't think that'll be the fix, maybe the same issue as the latest Firefox version?

converter.zip

[request] Batch encoding of images one at a time

I'm trying to encode many avif images at the same time. Even though cavif supports doing them at the same time the total ram required builds up. Would it be possible to add an argument that allows for batch encoding one image at a time for the sake of using less ram at a given time?

Binrary releases 1.3.0 and 1.3.1 contain version 1.2.0 for windows

I'm having trouble getting firefox to load images from cavif and found issue #33
Thought I'd try the latest released version to see if that helped, but turns out there is an older windows version in the releases .zip file. Both the 1.3.0 and 1.3.1 releases contain version 1.2.0 for windows.

Building with cargo install cavif gives 1.3.0 on windows, and building from source in git gives 1.3.1

Error installing v1.3.1

I'm getting this error when running cargo install cavif:

   Compiling ravif v0.8.6
error[E0308]: mismatched types
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/ravif-0.8.6/src/av1encoder.rs:278:47
    |
278 |         speed_settings.fast_scene_detection = true;
    |                                               ^^^^ expected enum `SceneDetectionSpeed`, found `bool`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `ravif` due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cavif v1.3.1`, intermediate artifacts can be found at `/tmp/cargo-installt89gNt`

speed = 0

Documentation says that the lowest accepted parameter for speed is 1 and this is best quality. Passing in a value of zero works, produces a smaller image file but the processing time is about 10x slower than speed 1.

So, two parts:

  1. docs should reflect that speed = 0 can be passed in
  2. it would be nice if there was a finer level of granularity than an order of magnitude (doubling makes sense), not sure if this is inside the encoder though rather than at the application level so might be out of scope

minor color shifting of large areas

I would assume a large area would not color shift at all (aside from edges perhaps), but unfortunately it does. I can test on what ever test images you want.

Good news: not as bad as Squoosh, which uses their own WASM version of libavif.

Thanks for for your tool! I'll have to try it on Cloudflare Workers sometime ;)

source:
codepen io-2021-02-15

cavif.exe -Q 80 -s 8
codepen io-2021-02-15 avif

How to handle ThreadPoolBuildError when calling cavif command

Hi, I am using a multiprocess script to call cavif command (I am not using option --threads). I found that when I increase the process number, some errors appear like:

thread 'main' panicked at 'The global thread pool has not been initialized.: ThreadPoolBuildError { kind: IOError(Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }) }'
thread 'main' panicked at 'The global thread pool has not been initialized.: ThreadPoolBuildError { kind: IOError(Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }) }'
...

Such error won't appear if I use single-process program or 2~3 multi-processes program.
I have tried both pre-built version and self cargo installed version. Is there a way to prevent this?

Add compatible with HEIF

Add compatible with HEIF decode.
HEIF is the default codec from Apple products, let's allow this big number of imagens to be migrated to AVIF.

You can use libheif-rs or libheif-sys

thread count

cavif takes a number of threads equal to available cores on the host... it would be nice to have a parameter to limit or control the number of threads being launched for fine tuning / resource management on large amounts of bulk processing.

Cannot install `cavif 1.0.0` on Windows 10

Note at the beginning: I have no issues installing cavif 0.6.6.

I cannot upgrade from cavif 0.6.6 to cavif 1.0.0 on Windows 10. NASM is in the path with the most recent version:

PS C:\Users\Nikon the Third> nasm --version
NASM version 2.15.05 compiled on Aug 28 2020

PS C:\Users\Nikon the Third> rustc --version
rustc 1.51.0 (2fd73fabe 2021-03-23)

But when I run cargo install cavif, I get these errors, and the build fails:

...
  C:\Users\Nikon the Third\.cargo\registry\src\github.com-1ecc6299db9ec823\rav1e-0.5.0-alpha\src/x86/sse.asm:472: warning: trailing garbage after macro name ignored [-w+other]
  C:\Users\Nikon the Third\.cargo\registry\src\github.com-1ecc6299db9ec823\rav1e-0.5.0-alpha\src/x86/sse.asm:442: ... from macro `WEIGHTED_SSE' defined here
  thread 'main' panicked at 'NASM build failed. Make sure you have nasm installed. https://nasm.us: "failed to spawn process: The system cannot find the file specified. (os error 2)"', C:\Users\Nikon the Third\.cargo\registry\src\github.com-1ecc6299db9ec823\rav1e-0.5.0-alpha\build.rs:120:6
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I opened one of these .asm files and they look fine. Installing cavif 0.6.6 works fine on the other hand:

PS C:\Users\Nikon the Third> cavif --version
cavif-rs 0.6.6

I installed an Ubuntu VM on the same machine, there cavif could be installed no problems. Any suggestions?

CAvif 1.3.0 creates invalid Avif files for Chrome

After Chrome 92 arrived, many of the AVIF images on my websites started showing corrupt image icon in Chrome 92. Images were created with CAvif 0.6.0.

I updated CAvif to 1.3.0 and re-encoded all images. However, some of the AVIF images are still broken in Chrome 92.

I can provide sample images of original JPEG files and broken AVIF files if needed.

resize images

I have an original JPEG, and a bunch of resized JPEGs at q75 (720px wide, 1080px wide, etc.). I would like to make these into identically sized AVIFs, but it seems to me that I won't get as good results if I turn the lower-quality JPEGs into AVIFs. I would expect the best results would come from resizing the original JPEG and converting those into AVIFs of different sizes, or converting the original to AVIF and then resizing that.

First, is resizing supported in cavif? If not, is this a desirable feature that could be added?

Second, if that is out of scope for cavif, how would you go about doing this on the command line? What tools would you use? Apologies if this is the wrong place to ask.

debug assertion triggers (Segmentation Fault in --release)

I'm using the ravif to encode a sequence of bytes inside a tokio blocking task.
Calling the encode function triggers a debug assertion, which turns into a segfault in release.
The code is the following:

let resized_img = img_full.resize(w, h, image::imageops::FilterType::Lanczos3);
let bytes = resized_img.to_rgba8();
let encoded = ravif::encode_rgba(ravif::Img::new(bytes.as_rgba(), w as _, h as _), &config);

The error I get in debug mode is the following:

thread 'tokio-runtime-worker' panicked at 'assertion failed: img.buf().len() + stride >= stride * img.height() + width.get()', /home/axel/.cargo/registry/src/github.com-1ecc6299db9ec823/imgref-1.9.0/src/iter.rs:185:9

Lossless support?

Forgive my ignorance wrt AVIF, but I believe that AVIF supports a "lossless" mode.

Looking at the README for cavif there doesn't appear to be any mention of a lossless mode. Is --quality 100 lossless, or is proper lossless support not implemented at this time?

Firefox 90 shows error message instead of showing AVIF created with `cavif`

After updating to Firefox 90, a lot of the images created with cavif do not work anymore. Chrome still shows them.
The archive Test.zip contains an image that worked in Firefox 89, but no longer in Firefox 90.

Is this because stricter validation? Is there a way to update the image without having to re-encode them? Or should I open an issue in the Mozilla bugtracker for this?

Decoder "Failed to find a NULL terminator..."

Hi

I have two programs...

~ $ cavif -V
cavif-rs 1.2.0

~ $ avifenc -V
Version: 0.9.1 (dav1d [dec]:185194b, aom [enc/dec]:v3.1.1, rav1e [enc]:0.5.0-alpha (p20210608))

I create two files...

~ $ cavif -o Cortina_CAVIF.avif Cortina.png

~ $ avifenc -c rav1e Cortina.png Cortina_AVIFENC.avif

SAMPLES.zip is attached.

Both of the avif files open OK with Chromium and Firefox browsers.
But I can't decode the one made by cavif.

Please advise...
Is there something wrong with cavif's en-coder
or
Is there something wrong with libavif's de-coder

Look here...

 ~ $ avifdec --info Cortina_CAVIF.avif
ERROR: Failed to decode image: BMFF parsing failed
Diagnostics:
 * Box[hdlr]: Failed to find a NULL terminator when reading a string

~ $ avifdec --info Cortina_AVIFENC.avif
Image decoded: Cortina_AVIFENC.avif
 * Resolution     : 424x283
 * Bit Depth      : 8
 * Format         : YUV444
 * Alpha          : Absent
 * Range          : Full
 * Color Primaries: 1
 * Transfer Char. : 13
 * Matrix Coeffs. : 6
 * ICC Profile    : Absent (0 bytes)
 * XMP Metadata   : Absent (0 bytes)
 * EXIF Metadata  : Absent (0 bytes)
 * Transformations: None
 * 1 timescales per second, 1.00 seconds (1 timescales), 1 frame
 * Frames:
   * Decoded frame [0] [pts 0.00 (0 timescales)] [duration 1.00 (1 timescales)]

SAMPLES.zip

Avif Gui

Hello.

Thank you for your great work,

Thank you for RGB color profile. it's very helpful.
i need to convert a thousand of photos, can you create GUI interface please?

Make quality trump quiet for -q

Given that the quality argument is much more frequently used vs the quiet argument, it's surprising that its short version is an inconvenient upper-case -Q instead of -q
Wouldn't it make more sense for quality take the -q?

Converted images sometimes get orange/magenta overlays on the right edge

It is clearest in this screenshot:
bunny_artifact

I have been unable to determine exactly what causes this, because some images convert just fine (this one was first converted to png with windows paint and then to avif with cavif):

eso_fine

The affected edge seems to be of constant size in pixels, because larger images have a smaller edge:

large_affected

This is on windows with the latest version.

These are the affected images for debugging:
BUNNY!
2K3vqjE

This is an unaffected image:
BcFu4F9

Premultiplied alpha support is broken since v0.6.4

It looks like the flag was left out of the transition to the new args parser in a95b3c2. The following addition is sufficient to get the code running again:

diff --git a/src/main.rs b/src/main.rs
index fd93c31..6199377 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -75,6 +75,9 @@ fn run() -> Result<(), BoxError> {
         .arg(Arg::with_name("dirty-alpha")
             .long("dirty-alpha")
             .help("Keep RGB data of fully-transparent pixels (makes larger, lower quality files)"))
+        .arg(Arg::with_name("premultiplied-alpha")
+            .long("premultiplied-alpha")
+            .help("Alternative compression mode that lowers quality of semi-transparent colors. Warning: at low qualities it may create black artifacts in transparent areas."))
         .arg(Arg::with_name("color")
             .long("color")
             .default_value("ycbcr")

However, the output it generates is invalid per ISOBMFF (ISO 14496-12:2020) § 8.11.12.1 since it requires "Zero or one" iref boxes and the output generated has 2.

Install NASM per build script

Hi!

Performance is great, but manually installing the NASM dependency is a hassle. To increase the usability of this crate, it would be nice if a build script handled the installation, and maybe if it fails, deactivate the feature as a fallback. Is such a build script possible with NASM?

Published crates currently don’t compile

The published crates currently fail to compile due to a mismatch between the cavif and ravif versions:

$ cargo install cavif
    Updating crates.io index
  Installing cavif v0.6.6
[…]
   Compiling ravif v0.6.6
   Compiling cavif v0.6.6
error[E0063]: missing field `threads` in initializer of `ravif::Config`
   --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/cavif-0.6.6/src/main.rs:154:77
    |
154 |         let (out_data, color_size, alpha_size) = encode_rgba(img.as_ref(), &Config {
    |                                                                             ^^^^^^ missing `threads`

cavif 0.6.6 depends on ravif 0.6.4, but Cargo resolves the dependency to 0.6.6.

I’m not very familiar with publishing crates. Maybe it’s missing a lock file?

AVIF files look desaturated in Firefox 98

I have a source PNG I've convered to JPEG and to AVIF. I've opened all of them in Firefox 98 on Linux and noticed that the AVIF file looks desaturated compared to both the PNG and JPEG files.

These are the test files: cavif_color_test.gz

I have tried both RGB and YCbCr color space, with no effect.

Curiously, Chrome 99 on Linux shows all files as desaturated compared to Firefox, my native GTK-based image viewer, and emulsion which uses the png crate and OpenGL.

Chrome 96 issue

Hello, images from 1.3.1 worked fine untill Chrome 96, 95 was ok but 96 not. Can this be fixed on your side or it was broken on google side?

Avif files do not pass validation

Converted images do not pass validation. Results from this validator. Images were converted using this command:
cavif --speed 1 --quality 60 sample.jpg

Result:
Compliance Warden, version v28-master-rev0-g29d5bb7.
+--------------------------------------+
| avif validation |
+--------------------------------------+

Specification description: AVIF v1.0.0, 19 February 2019
https://aomediacodec.github.io/av1-avif/

[avif][Rule #7] Error: The values of the AV1CodecConfigurationBox shall match
the Sequence Header OBU in the AV1 Image Item Data:
AV1CodecConfigurationBox:
seq_profile=0
seq_level_idx_0=0
seq_tier_0=0
high_bitdepth=0
twelve_bit=0
mono_chrome=0
chroma_subsampling_x=0
chroma_subsampling_y=0
chroma_sample_position=0
Sequence Header OBU in the AV1 Image Item Data:
seq_profile=1
seq_level_idx_0=31
seq_tier_0=0
high_bitdepth=0
twelve_bit=0
mono_chrome=0
chroma_subsampling_x=0
chroma_subsampling_y=0
chroma_sample_position=0

[avif][Rule #9] Error: Transformative property "av1C" shall be marked as essential (item_ID=1)

========================================
[avif] 2 error(s), 0 warning(s).
========================================

===== Involved rules descriptions:

[avif][Rule #7] Section 2.2.1
The values of the fields in the AV1CodecConfigurationBox shall match those of the
Sequence Header OBU in the AV1 Image Item Data.

[avif][Rule #9] Section 2.2.1
AV1 Item Configuration Property [...] shall be marked as essential.

+--------------------------------------+
| miaf validation |
+--------------------------------------+

Specification description: MIAF (Multi-Image Application Format)
MPEG-A part 22 - ISO/IEC 23000-22 - w18260 FDIS - Jan 2019

[miaf][Rule #2] Error: compatible_brands list shall contain 'miaf' (not found) and 'mif1' (found)

========================================
[miaf] 1 error(s), 0 warning(s).
========================================

===== Involved rules descriptions:

[miaf][Rule #2] Section 7.2.1.2
The FileTypeBox shall contain, in the compatible_brands list,
the following (in any order): 'mif1' (specified in ISO/IEC 23008-12)
[...]
Files conforming to the general restrictions in clause 7 shall include
the brand 'miaf' in the compatible_brands in the FileTypeBox.

+--------------------------------------+
| heif validation |
+--------------------------------------+

Specification description: HEIF - ISO/IEC 23008-12 - 2nd Edition N18310

========================================
[heif] No errors.
========================================

+--------------------------------------+
| isobmff validation |
+--------------------------------------+

Specification description: ISO Base Media File Format
MPEG-4 part 12 - ISO/IEC 14496-12 - m17277 (6th+FDAM1+FDAM2+COR1-R4)

========================================
[isobmff] No errors.
========================================

[FR] Output to a specific filename+path

It would be nice if there was a way to specify the filename (with path) that a converted file is saved to. I initially thought that that's what -o is for, but that's only the path, there doesn't seem to be a way to save to another file format?

For context, I'm trying to use cavif as an encoder together with my Imager X plugin for Craft CMS, and I need to be able to create a single cli command that encodes a temporary source image file to a target avif file. With avifenc I'm able to do it with a template that's --min {minQ} --max {maxQ} --speed {speed} {src} {dest}, for instance.

Would be cool if something like that could be done with cavif in the future.

GIF support?

Thanks for the tool @kornelski. I'm currently integrating it into my blog's CI.
I wonder if you plan to add animation support to cavif eventually.
This would help replace the gifs on my blog with avif as well (using gif as a fallback only).

avif can't keep icc profile and other metadata

Hello, kornelski
cavif-rs is work very well, file size and quality is amazing :),
but compressed avif can't keep icc profile and other metadata,
probably can add a flag to handle icc profile and other metadata?

10-bit and 12-bit support

Hi, any chance you could add support for 10 and 12-bit color depth, please? Either switching automatically based on the source image or using a command argument.

I’ve experimented with it in link-u/cavif, and the files are only 1–2 % bigger and still way smaller than the 8-bit JPEG/WebP equivalent.

Is it possible to compile `ravif` to WebAssembly?

This is just a question, really, I have not tried anything yet.
Is it possible to compile ravif to a .wasm file for use in a browser?

Are there any feature flags I have to be aware of (like the wasm feature for rav1e)?

Files with transparency doesn't work on Firefox

Hi
I think there is some issue with encoder that prevents files with alpha channel being displayed. I encoded this file:
trp
which resulted in this file. It works in Chrome but it doesn't in FF. My current FF is 86.0b2. I did use different encoder, an online one and their result worked just fine.
I did try to use different parameters but the result is always the same.

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.