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

GIF File Size Strange! #240

Open
jxdesign opened this issue Apr 28, 2021 · 10 comments
Open

GIF File Size Strange! #240

jxdesign opened this issue Apr 28, 2021 · 10 comments

Comments

@jxdesign
Copy link

Hey not sure what's happening. I've used Gifski for dozens of videos and it's worked fine.

I have a 15 second video an .mp4 that's 12 mb.

When I run Gifski using default settings, the file size ends up being 180 mb! When I use a smaller dimension, at 50% the file size is still 52 mb. I know the Gifski numbers are estimates, but the final products after making the GIFs are around those numbers.

I'm not sure how a GIF could be so much larger than a video that's only 12 mb?

image

image

image

@sindresorhus
Copy link
Owner

sindresorhus commented Apr 29, 2021

That's unfortunately completely expected in some cases. The GIF format is old and very inefficient, both performance and size-wise. Video codecs are very good at reducing file size by using a lot of cross-frame optimizations. GIF doesn't support these techniques. Gifski, however, does its best to reduce the file size, by for example, reducing noise, so it can better diff frames. In this specific case, I'm guessing that the noise is so high that it can not diff the frames, leading to the large file size.

Would you be able to share the MP4 either here or privately so we could look into this?

// @kornelski

@kornelski
Copy link
Collaborator

@sindresorhus How about adding " (why so large?)" link in the status bar next to the estimate?

@sindresorhus
Copy link
Owner

@kornelski That's a good idea. What do you think the threshold should be?

@kornelski
Copy link
Collaborator

Maybe even always display it, since it's always relatively bad. Or >2MB, Or 5x input file size.

@jxdesign
Copy link
Author

Cool, I can share the file. Should I email it to you @sindresorhus?

I wonder why nobody has improved upon the GIF format if it's "old and inefficient". GIFs are incredibly useful and valuable to quickly communicate something. For example, I can embed a GIF in a Github comment, but I can't do the same with a video.

@sindresorhus
Copy link
Owner

Cool, I can share the file. Should I email it to you @sindresorhus?

Yes

I wonder why nobody has improved upon the GIF format if it's "old and inefficient".

I'm sure people have tried, but you cannot break backwards compatibility, so there's not that much you can do.

For example, I can embed a GIF in a Github comment, but I can't do the same with a video.

GitHub supports videos now actually. Hopefully, more websites will follow. The most ideal solution IMHO is using videos in <img>: https://mpulp.mobi/2018/04/04/video-image-tags/

@kornelski
Copy link
Collaborator

kornelski commented Apr 30, 2021

I wonder why nobody has improved upon the GIF format if it's "old and inefficient".

Oh, they have been continually improving it for the last 30 years. Instead of 256 colors, slow decoding, tiny resolution, and huge file sizes we have formats with millions of colors, 4K+ resolution, HDR, hardware-acceleration, and still 15x better compression.

We just call these "video" formats now. They've advanced so far beyond GIF that they don't seem like the same thing any more.

Sadly, browser vendors other than Apple are stuck in a mindset that if a format is actually fast and efficient, it's not a GIF equivalent, so they won't allow it to be played they same way as GIF.

@jxdesign
Copy link
Author

That makes sense thanks @kornelski. GIFs are still very useful though. For example on Slack, if I upload a video, it doesn't automatically appear and show, whereas if I upload a GIF, it will show and animate without the recipient needing to click.

I'm also seeing now that videos can be uploaded on Github based on this Github, but on the corporate Github I use for my job, it seems like video files are still not allowed. I'll follow up with that team around that restriction maybe they just need to run an update.

@sindresorhus
Copy link
Owner

I looked at the video you sent and I don't think there's anything we can do to improve how Gifski handles it. The video has a lot of noise and the background is not static, meaning there's pretty much nothing that can be diffed, so the GIF has to include each frame.

If you want to improve the GIF size in the future, I recommend filming against a hard (no fabric) completely black/white background, softer light, and then post process the video by increasing the contrast and reducing noise in a video editor.

@jxdesign
Copy link
Author

jxdesign commented May 4, 2021 via email

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

No branches or pull requests

3 participants