Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animated AVIF not playing #17

Open
superbonaci opened this issue Jul 25, 2023 · 8 comments
Open

Animated AVIF not playing #17

superbonaci opened this issue Jul 25, 2023 · 8 comments
Labels
enhancement New feature or request

Comments

@superbonaci
Copy link

File sequence-without-pitm.avif from this bug is animated:
AVIF (AV1 Image File Format): image sequence and animation support

But animation is not played by AVIFQuickLook, only static image. Google Chrome does play it.

$ qlmanage -p sequence-without-pitm.avif
Testing Quick Look preview with files:
	sequence-without-pitm.avif
2023-07-25 10:39:29.280 qlmanage[3543:28404] +[IKImageContentView _clampImageAlphaTo01:colorSpace:] no CIImage passed in
2023-07-25 10:39:29.280 qlmanage[3543:28404] IKImageView2 _updateContentForLayerUsingIOSurface Error: source rect and destination rect of tile being drawn are not the same
@dreampiggy
Copy link
Owner

Emmm...QuickLook API design (from Apple) does not support Animated Image.
You see, it's received a CGContext (canvas, only draw one image), or CGImage (single frame)

We can only support to display animated AVIF into the static poster frame, is this enough for your use case ? @superbonaci

@dreampiggy
Copy link
Owner

For Preview (Space):
image

For Icon Thumbnail (See in Finder):
image

@superbonaci
Copy link
Author

Emmm...QuickLook API design (from Apple) does not support Animated Image.

I can play perfectly animated gif inside Quick Look (select the gif then Space Bar), for example this file: https://giphy.com/gifs/tag-sample-BfbUe877N4xsUhpcPc

ezgif-3-db1fd31a43

If I click the "Open with Preview" button then it displays a static image, but that's not what I meant.

@dreampiggy
Copy link
Owner

dreampiggy commented Jul 26, 2023

You don't realize that GIF is Apple's internal QuickLook Plugin, which does not use the public API.

As a non-Apple company employee, I can not do the similiar thing, because the public API does not contains this ability.

qlmanage -m plugins

image

qlmanage -p example.avif

Check the verbose log, which point into this `/System/Library/QuickLook/Image.qlgenerator`

@dreampiggy
Copy link
Owner

dreampiggy commented Jul 26, 2023

If possible, I can try to dis-assemble that Apple's Image.qlgenerator and see how they render Animation on CGContext. Maybe using a Timer to refresh the canvas ?

Or find their private API, which may contains something like frame count, duration, etc

@dreampiggy dreampiggy added the enhancement New feature or request label Jul 26, 2023
@dreampiggy
Copy link
Owner

dreampiggy commented Jul 26, 2023

Maybe the old generator based can not support animation. The new QLPreviewView (Which need a App, no longer a qlgenerator plugin) can custom draw anything on NSView

https://developer.apple.com/videos/play/wwdc2019/719?time=942
https://developer.apple.com/documentation/quicklookui/qlpreviewview
https://developer.apple.com/documentation/quicklook/qlpreviewingcontroller?language=objc

Maybe this is the future way to support animation.

@superbonaci
Copy link
Author

superbonaci commented Jul 26, 2023

You don't realize that GIF is Apple's internal QuickLook Plugin, which does not use the public API.

You mean that GIF is AN internal QuickLook Plugin, not the only one. The video you quoted talks about thumbnails, just hope your app doesn't create such files. Viewing or previewing any file should not create any new file or "cache" in the filesystem.

I wonder if you can make this work as a "plugin" and not having to install a full .dmg program.

@dreampiggy
Copy link
Owner

dreampiggy commented Jul 26, 2023

Maybe it's just a AVIFQuickLook.app, you can place it into anywhere you like (Because Mac has a Spotlight service, will search all .app in your disk), like ~/Documents/Tools/AVIFQuickLook.app, you don't need to open it at all.

Then you can preview the AVIFs animation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants