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

How to set better gif quality? #179

Closed
gornostal opened this issue Sep 2, 2017 · 9 comments
Closed

How to set better gif quality? #179

gornostal opened this issue Sep 2, 2017 · 9 comments
Milestone

Comments

@gornostal
Copy link

Peek is awesome 👍
Exactly what I need from a screen recorder in terms of features and UX.
However I wish GIF quality could be better.

Is that possible to do at all?
If so, what part of the code should be tweaked to make gifs less pixelated?

I'm using Fedora 26 with GNOME Shell 3.24.3
Installed as it was instructed here

@phw
Copy link
Owner

phw commented Sep 13, 2017

It is hard to say what you mean with "better quality" and "less pixelated", can you provide an example.

In general you should be aware that the GIF format is limited to 256 colors. So if you record something with many colors you will get color distortions and dithering. In general ImageMagick does a decent job at getting a good color palette, but it can't do magic ;)

Having said this it could be possible to tweak this in Peek by calling imagemagick with maybe different dithering algorithms to improve results (but this quickly depends on the type of content you captured).

For some background see

http://www.imagemagick.org/Usage/anim_opt/#color_problem

http://www.imagemagick.org/Usage/quantize/#colors

@gornostal
Copy link
Author

Hi,
Here are two gifs. The first one was created using shell script that converts video to gif (see below), the second using Peek.
Notice the pixelated background gradient on the input box in second gif.

I'm not familiar with ffmpeg and I find Its CLI complicated. I would prefer using software like Peek for creating gifs.

I wonder if you can tell why the first gif turned out to be better quality by looking at the script?

First
Second

#!/bin/sh

palette="/tmp/palette.png"
filters="fps=15"
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2

@NolanSyKinsley
Copy link

Will Peek ever have gifv, or rather mp4 comparability for high quality uploads?

@phw
Copy link
Owner

phw commented Sep 14, 2017

@NolanSkyKinsley GIFV is pretty much just a fancy marketing term for using MP4 in place of animated GIFs :)

Peek already supports recording MP4 (and WebM), you can choose the output format in the settings.

@phw
Copy link
Owner

phw commented Sep 18, 2017

Just to comment on the two GIFs you posted: The second one uses dithering to create the color gradient, which produces those single pixels, while the first one uses distinct color areas, which is why you see those clear lines of color (as GIF just does not allow for enough colors to make it really smooth).

Personally I think the second image gives a better overall quality of the image when viewed. I really have to look really closely to realize the colors are dithered, while I clearly see the colored lines in the first image without looking closely. But this is probably a) a matter of preference and b) it really depends on what you capture.

I can try making this an option, but it is rather low on my priority list.

@gornostal
Copy link
Author

Thanks for the explanation @phw

@phw
Copy link
Owner

phw commented Nov 3, 2017

You might be interested in #212 and try the latest git release (see instructions in the ticket there).

TL;DR: I added support for the new gifski utility to generate the GIFs. File size is bigger, but quality is amazing.

@phw phw added this to the 1.2.0 milestone Nov 6, 2017
@phw
Copy link
Owner

phw commented Nov 6, 2017

I consider this closed with the inclusion of the excellent gifski tool. See #212 for details, but the bottom line is that you have to use the latest git version and have the gifski tool installed, then you will have high quality encoding with configurable quality setting.

If you don't want to install from source you can also use the flatpak development release, it already includes gifski.

@phw phw closed this as completed Nov 6, 2017
@gornostal
Copy link
Author

Thanks @phw

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

No branches or pull requests

3 participants