-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
Discussion #1
Comments
The buffer looks like it's ABGR rather than BGRA. You may need to byte-swap the pixels.
I'll make a PR |
I was following the docs example which calls |
I'm sorry, I forgot to publish the docs fix (now live) |
Ah, ok. That makes it clearer. Thanks. I'm still not sure how to do byte-swapping of the pixels though. |
From the docs:
It never returns a non-nil message:
|
Why is the method named |
I managed to implement an inefficient byte-swapping: 231408c I'm certain it can be done more efficiently, so help welcome. Probably with some kind of bit-shifting https://stackoverflow.com/a/42133405/64949 |
I'll fix the BGRA was a typo in my github comment. It's supposed to be RGBA8. |
The inefficient byte swapping is straightforward enough that hopefully the compiler will be able to optimize it nicely. |
The progress callback with non-null arg was a bad idea, and it wouldn't work in the library implementation. I've dropped the argument (currently in git master, I'll release it as 0.8.0 later). Now it's called only for frames. To know when the whole process is done, wait for |
Ah ok. That means the original buffer is actually ARGB. |
Unfortunately not. Some quick testing:
But we can worry about that later. I just want to get something out soon. |
OK, I can add swapping in Rust then (edit: done) |
I tried the latest master now and seems the byte-swapping is just as slow with Rust. I got 25 sec on release build now too. Can you reproduce that? |
Are you sure it's byte swapping? It doesn't show up in profiling. 1 second per frame is normal for gifski. Almost all of the time is spent on quantization and remapping, and that can't be parallelized well, because each frame depends on all previous frames. |
Using |
Any way to use |
|
Xcode uses clang, and clang doesn't support OpenMP, so it's tricky.
|
There's also |
Oh, hold off with the fast flag. I just found a bug in it when OpenMP is used :) |
OK, the fast flag is fixed. Clean build directory in Xcode to get the fix. |
@kornelski I'm done with the initial version of the app. (FYI, I forced pushed to clean up the commit history) There are still many things missing, like the ability to cancel the conversion, but I'd like to get it out ASAP and we can continue from there. Could you try it out and give me some feedback? |
I am worried people will throw long-form videos in there and create GB-large gifs. Maybe hardcode some limits? e.g. while number of frames * image size > arbitrary limit { keep halving image size } (GIF uses about 2-4bits per pixel, so hugeness of the output is predictable in advance) |
I thought videos could not have odd dimensions. Do you know if the problem is at the app-level here or in libgifski? I'm not really sure how to handle this.
I don't fully understand this. You want to reduce the image size automatically? Wouldn't that be unexpected for the user. I think I better solution would be to have a image size option (in percentage of original?) in the export window.
I can easily implement the abort function.
Does that mean we could estimate the resulting GIF size in the export dialog? That would be super useful |
So instead of trying to invent a heuristic for this, I think it's better to just present the estimated size to the user and give them the ability to downscale the GIF, set quality, and eventually trim it. What do you think? |
Yeah, that's doable. The file size estimate can be as simple as I could add actual number of bytes written as an extra arg in the progress callback. |
Videos can have odd sizes, the same way JPEG can, despite being limited to multiple of 8 internally. The frames are encoded at size rounded up. It's most likely a quirk of the video decoder - it leaves unused pixels at end of each row. it probably reports bytes per row or stride somewhere as a separate dimension from frame width. |
|
Yeah, I can add it in Rust easily. I'll update the lib tomorrow. |
Fixed |
This icon is for grabs: https://gif.ski/icon.png |
From the
Should I set the minimum to 50 then? |
The |
Your icon is ok. The computer thing was supposed to be a VHS-era TV (since GIF is from 1989). The rainbow is inspired by VHS boxes: https://www.agostinoscafidi.com/wp-content/uploads/2016/07/VHS-box-series-by-Agostino-Scafidi-1024x707.jpg |
I'd guess quality 50% lowers file size by 20%.
|
Yes, set qualty to 50% minimum (0 on the slider could be q=50) |
Yes. Seems to be pretty accurate. |
I've pushed another commit now (b3e328c) with the finished initial app. I plan to publish it to the Mac App Store when I have your 👍. Can you try it out and let me know? I will make this repo public when it's out in the Mac App Store and we can announce it then. |
I'm having some problems building the app for distribution. When I build for running it works fine, but when using "Product" => "Archive" in Xcode, I end up with this error message:
Any ideas? |
You have to link with the static library (libgifski.a), not dylib. |
Scaling & filesize estimate help a lot! It's nice. Can you add me to the About panel? |
Of course, done: 8ba2b77 The about dialog is now just a RTF file. So feel free to add a mention of the gifski library there too ;) |
Thanks! The app is good to go! |
The repo is now public as we're linking to it in the app and it's a requirement that it exists for the review to be accepted. |
I'm having a couple of problems with libgifski. I'm probably using it incorrectly, but I've been stuck on it.
Update the paths in https://github.com/sindresorhus/gifski-draft/blob/793d9289961524667d47bc9d18a675166a374149/Gifski/AppDelegate.swift#L21 to your paths before testing.
The produced GIF has the wrong colors:
I'm probably passing the image as bytes incorrectly, but I'm not sure what I'm doing wrong.
I also have problems when trying to produce more than 4 frames. It seems to never finish then. Try to uncomment https://github.com/sindresorhus/gifski-draft/blob/master/Gifski/AppDelegate.swift#L48 and you'll see.
Is there any way for me to use libgifski with GCD? I tried, and Rust threw an error.
Any other feedback welcome.
The text was updated successfully, but these errors were encountered: