Repository navigation
feat: AVIF, HEIC, and APNG through Describe, and remux_video passes - #15
Merged
Merged
Conversation
mycroblog/my#3499 adds Describe to MediaService, through which a plugin of images declares AVIF, HEIC, and APNG, and #3501 fixes the MP4 of the media_video contract. Neither is released yet, so buf.gen.yaml pins a commit of main (ref), and CI builds `my plugin test` from that ref: a fetch takes a tag or a commit alike. internal/media answers Describe with ImageProcessor.InputFormats, without taking a slot, so that a busy plugin still answers it; without images it is unimplemented, which the server reads as the built-in formats only. SniffImage tells AVIF and HEIC by the brands of the ftyp box, SniffAV no longer takes them for an MP4, and SniffImageFile tells an APNG by an acTL before its first IDAT. The plugins share SniffImageFile and SniffAVFile instead of a copy each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AVIF and HEIC go through libheif (dav1d and libde265, decoders only), which the policy allows for reading only. At start the plugin decodes a small image of each and declares the formats its ImageMagick decodes, and APNG. ImageMagick reads an APNG only through FFmpeg as a delegate, which the policy keeps off. The plugin reads it itself: apngInspect reads the frames from the chunks for the limits before a pixel is decoded, and apngFrames composes each frame on the canvas (dispose and blend of APNG 1.0) into a PNG of its own, with the color space chunks of the file, which ImageMagick reads as an animation. A HEIC stored with the transformation of EXIF orientation 6 is turned once: the test pins that libheif turns it and the EXIF does not turn it again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This follows mycroblog/my's main: #3499 (
Describeand the formats AVIF, HEIC, and APNG) and #3501 (the media_video contract MP4, issue #3494). Neither is in a tag yet, so this pins a commit of main, f55bdcb.buf.gen.yamltakesref:(a tag or a commit). CI buildsmyfrom that ref with a fetch, which takes both, and caches the build by the ref.DescribewithImageProcessor.InputFormats(). It takes no slot, so a busy plugin still answers. A plugin without images answers unimplemented, which the server reads as the built-in formats only.SniffImagetells AVIF and HEIC apart by their ftyp brands, andSniffAVno longer takes them for an MP4.SniffImageFiletells an APNG apart by an acTL before its first IDAT. The two plugins now share it andSniffAVFileinstead of keeping a copy each.accepts JPEG, PNG, GIF, WebP, and AVIF, HEIC, APNG.apng.go):media_video/remux_video, since #3494 is fixed. The README now says #3493 left video and audio out.Verified
my plugin testbuilt from f55bdcb, over a unix socket, gRPC on a unix socket, and plain TCP:describe.remux_video.{"inputFormats":["FORMAT_AVIF","FORMAT_HEIC","FORMAT_APNG"]}.unimplemented.MY_PLUGIN_REQUIRE_TOOLS=1) runs these new tests:irot, which comes out turned once, not twicescripts/lint.shpasses.Notes
ci.ymlchanged, this PR runs every test. Theinternal/servertests are flaky under parallel load (unrelated to this PR); I'll fix that in a separate PR.refback to that tag.🤖 Generated with Claude Code