Repository navigation
AVIF/WEBP/ResolutionLadder - #16329
CommanderTurtle wants to merge 44 commits into
Conversation
[Medium impact] The latest changes appear safe to merge and address the missing GIF regression coverage. SummaryThis PR adds WebP and AVIF output, long-edge resolution choices, and hardware encoding choices. The latest change adds regression tests for transparent WebM and animated AVIF exports to GIF.
Reviews (22) · Last reviewed commit: "test: cover transparent WebM and AVIF gi..." · Reviewed by Greptile |
chessing234
left a comment
There was a problem hiding this comment.
bin/omarchy-transcode now takes the third positional as quality, so omarchy transcode demo.mov mp4 720p and photo.jpg jpg medium keep the native size and ignore the old resolution. keep resolution in the third slot, or accept those old forms before the new quality argument.
Probe only the first frame for picture dimensions — a multi-frame identify concatenates per-frame dims and breaks `read` — and count frames so animated inputs are limited to animated-capable outputs (gif/webp/avif). Accept an old-form resolution passed in slot 3 when it is not a known quality.
Thanks, appreciated note @chessing234 - Backwards compatibility could do a simple check for this. Accepted the old forms in |
The animated-input guard rejected on the format inferred from the filename, before the codec menu could run, so a no-argument animated input was blocked from picking webp/avif. Validate the final chosen format instead, once the menus have settled it.
The webp and avif encoder paths funnel the input through a single-frame .png temp, so a multi-frame picture (animated GIF, APNG) fails at the ffmpeg step before the encoder runs. For animated inputs, encode directly with magick (which the jpg/png paths already use), preserving frames and timing. Stills keep the cwebp/avifenc path.
- GIFs route by output format: picture formats (jpg/png/webp) take the picture path, so gif->webp and still-GIF->jpg/png work again; avif and the other video formats keep the video path. - Animated AVIFs decode to a frame sequence once, before encoder selection, so every output (avif/webm/mp4/gif) keeps all frames. Per-frame delays ride a concat list instead of a rounded average fps; the decode tmpdir cleans up on every exit path. - -fps_mode passthrough on every video encode: the avif/webm muxers pick high-rate timebases and default CFR resampling duplicated frames to fill them (a 10 fps GIF became 20 frames of dupes). - CPU avif/webm encodes keep the input's alpha (yuva444p/yuva420p); the GPU GIF path uploads software-decoded frames before scale_cuda. - The gpu engine is CUDA (av1_nvenc/scale_cuda); only offer it in the menu where omarchy-hw-nvidia sees an NVIDIA GPU, defaulting to cpu on AMD and Intel. - Quote the "gpu" literal in [[ ]] comparisons.
- gpu engine auto-detects the vendor (NVIDIA/AMD/Intel via PCI class 0x03) and selects the matching hardware AV1 encoder (av1_nvenc / av1_amf / av1_qsv), probed with a real encode; falls back to cpu when the encoder is unusable on this silicon. Menu offers gpu only where a usable hardware encoder is compiled in. - Hardware AV1 encodes scale small inputs up to the nvenc 256x144 floor (proportional, no-op above it) so small sources don't error. - The GPU GIF pipeline uses hwupload_cuda (self-created device) after a software yuv420p convert; -hwaccel cuda on a software-decoded GIF never yields a device reference for hwupload. - Alpha-carrying AVIF output is encoded by magick (libheif) because the ffmpeg avif muxer drops the alpha auxiliary; per-frame delays survive the coalesce. Non-alpha AVIF stays on the libaom path. - input_has_alpha: AVIF alpha is a separate gray stream the demuxer exposes; GIFs are judged by palette alpha mode (IM7 reports Blend, not True) since the gif decoder's bgra would flag every GIF. - Quoted the gpu literal in [[ ]] and made -fps_mode passthrough unconditional (avif/webm muxers duplicate frames to fill high-rate timebases).
The engine is no longer a menu question. It is chosen automatically: hardware AV1 where the vendor's encoder is compiled in (NVIDIA/AMD/Intel), cpu otherwise; mp4 and pictures never use it. An explicit positional still overrides. The gif->avif alpha rule keeps that path on cpu. gpu_available no longer SIGPIPES: grep -q exits on first match, which under pipefail scored the pipeline 141 and made the check always fail whenever the encoder existed - so auto would have fallen back to cpu on every machine that has the encoder. A here-string fixes it. The avif alpha probe had the same shape and is fixed the same way. ffmpeg exits 0 when it declines to overwrite an existing output, so a re-transcode to the same name silently kept the stale file, was copied to the clipboard, and announced success. All output encodes now pass -y, matching the picture path's silent overwrite. The orphaned transcode.engine i18n key is removed.
The gpu/cpu ask returns for avif and webm - the formats where the hardware encoder changes the result - and only when the vendor's encoder passes the live probe, so a gpu pick is always honored. Probe fails (e.g. VRAM pressure) -> silent cpu, no ask. gif keeps the auto CUDA-scale detection; mp4 and pictures stay cpu. An explicit positional still overrides. main() now runs the probe for the ask and transcode_video reuses the result instead of probing a second time. The transcode.engine i18n key is restored with the ask.
libheif's per-frame delay is a 1024cs placeholder for ffmpeg-written avif, which stretched playback ~100x. Carry the per-frame delays only when their sum reconciles with the container duration (within 25%), otherwise distribute the container total uniformly; both cases keep the input framerate.
|
All three regression checks are implemented in local commit
High encoder settings, NVIDIA quality flags, and AVIF timing remain unchanged. The single test bench passes all 14 checks. Hardware routing was fixture-tested, and verified on live Linux GPU. |
Includes the JPG/PNG auto-orient fix proposed by AksharP5 in omacom#16554, extended to static WebP/AVIF intermediates. Keep source files and encoder quality settings unchanged; cover rotated, mirrored, normal and untagged inputs in the existing bench.
|
Added #16554 in the same manner for EXIF metadata edge-cases. So this now fixes #16553 - included even in the new formats. Kept the scope narrow. Two files, |
screenrecording-2026-10-25_15-18-33-1920.mp4Full final behavior. No frills, showcase of what you can expect! File manager is my omafile fork Cool read for newbies to avif: https://github.com/george-hawkins/video-in-github-markdown/blob/master/README.md |
The gif commands opened the file directly while every other format in that switch reads the decoded sequence from src_in, so a transparent WebM or animated AVIF lost its alpha plane to the native decoder and palettegen had no transparency left to reserve. A transparent two-frame WebM's gif goes from an extracted-alpha mean of 1.0 (opaque) to 0.77.
Animated WebP and AVIF encode through ImageMagick's own libwebp and libheif delegates, which imagemagick already pulls in, so refusing the format up front blocked conversions on a stock install that never call cwebp or avifenc. The refusal now sits in the still route that shells out to the CLI.
libwebp-utils and libavif are in neither default package list, and CI runs the suite on a fresh install image, so the orientation loop failed on its first WebP export, long before require_command reached it. Gate each picture format on its encoder and skip the checks that need one, the way a missing compositor is skipped; the file now passes with and without both packages installed.
I made a post under discussions/16093 - and thought I'd be the one to implement it!
This patch adds a latent resolution ladder (based on compatible-long-edge) & WebP+AVIF support (two also highly efficient image codecs). Jpeg, show the others some love!
omarchy-transcode-webpavif.patch - Updated 2026-11-22 - 11:34 EST
Preview Diff
This is solely a
bin/omarchy-transcodechange. To test this change, follow the instructions below for your English installed bin.Local variant runs under slightly different system context. System patch (applies to an English user's
binwithout anyi18nfrills):omarchy-transcode-webpavif-literal.patch
reset.sh
apply.sh
apply.shpulls the packaged copies of the files the patch names out of pacman's cache, patches those, checks the result really is the new script, and only then writes them, so there is nothing to inspect by hand:click to expand - cursed local linters/helpers
Run
apply.shas many times as you like, from any directory: it always starts from the packaged copies, so re-applying after an upstream update, after a half-finished manual attempt, or on top of its own output is the same one command. It names the patch that sits beside it, and lists the two variants if you kept both in the folder. Abinyou broke yourself gets repaired rather than refused, and a.rejan earlier manual attempt left behind is cleaned up on the way. If the patch does not fit the release you have installed it says which release it was built for and which one you have, and yourbinstays exactly as pacman shipped it. To take it back off:sudo bash reset.sh.If you would rather run the two steps yourself,
patch -p1 -d /writes one.rejper file that refused, and the English patch names the twobincopies and no catalog, so the reject check is two files:After a
pacman -Syumovesomarchy/omarchy-settings, rebuild the patch against the new release in this folder before applying it:./gen-patch.sh && sudo bash apply.sh omarchy-transcode-webpavif-literal.patchGen .patch from the right checkout:
gen-patch.sh
Gen non i18n from the i18n script, for local testing (eng.):
gen-config-patches.sh
bracket lint.py:
bracket-lint.py
Extras for local testing: