Opened 4 years ago
Closed 3 years ago
#8861 closed defect (fixed)
Creating GIF with full transparent background from PNGs with semi-transparent pixels, somehow causes this outline
Reported by: | karl-police | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avfilter |
Version: | git-master | Keywords: | paletteuse |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug: There's an unwanted outline, how can I fix it? I created a GIF from PNGs with semi-transparent pixels and it had this outline. When using transparency_color I was able to change the color, but I couldn't get rid of the outline.
This doesn't happen with APNG, but APNG supports semi-transparent pixels. I need it as a GIF though.
How to reproduce:
ffmpeg version = ffmpeg version 4.3.1 built on downloadable .exe from ffmpeg.org
Commands used:
ffmpeg -y -i "sprite2/amongus_player_walk_00%02d.png" -lavfi fps=50,palettegen palette.png ffmpeg -i "sprite2/amongus_player_walk_00%02d.png" -i palette.png -lavfi "fps=50,paletteuse" -y output.gif
One of the original images looks like this:https://i.imgur.com/aCZxKuW.png
the output is this: https://i.imgur.com/9iuJ14K.gif as you can see there's this weird outline, that I'm trying to get rid of.
Attachments (2)
Change History (22)
by , 4 years ago
Attachment: | sprite2.zip added |
---|
follow-ups: 2 3 comment:1 by , 4 years ago
Component: | ffmpeg → avfilter |
---|---|
Keywords: | paletteuse added |
Priority: | wish → normal |
comment:2 by , 4 years ago
Replying to cehoyos:
This has very little similarities with a valid ticket.
Does
paletteuse=bayer
fix the issue for you?
yep it does, how so?
comment:3 by , 4 years ago
Replying to cehoyos:
This has very little similarities with a valid ticket.
Does
paletteuse=bayer
fix the issue for you?
another question
uhh I set the fps 12 with bayer, and it's doing this https://i.imgur.com/trtfjhQ.gif
ffmpeg -i "sprite2/amongus_player_walk_00%02d.png" -i palette.png -lavfi "fps=12,paletteuse=bayer" -y output.gif
how do I fix that?
follow-up: 6 comment:5 by , 4 years ago
comment:6 by , 4 years ago
Replying to karl-police:
Replying to cehoyos:
See #7902.
Removing the first frame check?
I don't understand the question.
follow-ups: 8 9 comment:7 by , 4 years ago
I think that artifact is from the fps filter, and you're dropping frames. It looks ok if you use -r as an input option
eg.
ffmpeg -r 25 -i "sprite2/amongus_player_walk_00%02d.png" -i palette.png -lavfi "paletteuse=bayer" r25_output.gif
12fps works too, I just left it at 25fps for the example
https://imgur.com/a/5MNxLQI
follow-up: 10 comment:8 by , 4 years ago
Replying to pdr0:
I think that artifact is from the fps filter, and you're dropping frames. It looks ok if you use -r as an input option
eg.
ffmpeg -r 25 -i "sprite2/amongus_player_walk_00%02d.png" -i palette.png -lavfi "paletteuse=bayer" r25_output.gif12fps works too, I just left it at 25fps for the example
https://imgur.com/a/5MNxLQI
What does -r do? And why exactly 25?
follow-up: 11 comment:9 by , 4 years ago
Replying to pdr0:
I think that artifact is from the fps filter
This seems unlikely as the artefacts are a known issue.
comment:10 by , 4 years ago
Replying to karl-police:
What does -r do? And why exactly 25?
-r as an input option (before the -i) sets the input framerate . An image sequence can be any framerate . I randomly chose 25. Choose the framerate you want for the speed of the animation. -vf fps will duplicate or drop frames to achieved the desired output fps, based on the input framerate . It does not make sense that -vf fps should cause that artifact
follow-ups: 12 13 comment:11 by , 4 years ago
Replying to cehoyos:
Replying to pdr0:
I think that artifact is from the fps filter
This seems unlikely as the artefacts are a known issue.
Yes, it seems unlikely, and according to what -vf fps is supposed to do
Excluding the fps filter, there are no artifacts. Using the fps filter, there are artifacts. Regardless of including or excluding -r as an input option. How else would you explain this observation?
follow-up: 14 comment:12 by , 4 years ago
Replying to pdr0:
Replying to cehoyos:
Replying to pdr0:
I think that artifact is from the fps filter
This seems unlikely as the artefacts are a known issue.
Yes, it seems unlikely, and according to what -vf fps is supposed to do
Excluding the fps filter, there are no artifacts. Using the fps filter, there are artifacts. Regardless of including or excluding -r as an input option. How else would you explain this observation?
but why are there these artifacts?
comment:13 by , 4 years ago
Replying to pdr0:
Replying to cehoyos:
Replying to pdr0:
I think that artifact is from the fps filter
This seems unlikely as the artefacts are a known issue.
Yes, it seems unlikely, and according to what -vf fps is supposed to do
Excluding the fps filter, there are no artifacts. Using the fps filter, there are artifacts. Regardless of including or excluding -r as an input option. How else would you explain this observation?
but why are there these artifacts?
follow-up: 15 comment:14 by , 4 years ago
Replying to karl-police:
but why are there these artifacts?
Because of a known bug in the gif encoder that is not related to the behaviour of the paletteuse
option dither
.
comment:15 by , 4 years ago
Replying to cehoyos:
Replying to karl-police:
but why are there these artifacts?
Because of a known bug in the gif encoder that is not related to the behaviour of the
paletteuse
optiondither
.
and is that planned to be fixed?
comment:16 by , 4 years ago
Is it possible in FFMPEG to do these color replacements?
As example on https://i.imgur.com/GotzcqY.gif
you see the "Red, Green, Blue" templates. And, apperantly you split them up and then you define another RGB color to replace all with. I'm not sure how that is called. A general term for it seems to be color interpolation, but that just means, math with colors or something.
comment:17 by , 4 years ago
Is it possible in FFMPEG to do these color replacements?
As example on hhttps://i.imgur.com/GotzcqY.gif
you see the "Red, Green, Blue" templates. And, apperantly you split them up and then you define another RGB color to replace all with. I'm not sure how that is called. A general term for it seems to be color interpolation, but that just means, math with colors or something.
comment:18 by , 4 years ago
so is -r 12 better than fps=12
or is that just when it's very slow?
these artifacts?
comment:19 by , 4 years ago
when using "bayer" to prevent these outlines, though what can happen, let's say the entire thing would be a bit more yellow. That the entire image gets dithered, which is something I want to prevent.
by , 4 years ago
Attachment: | sprite3.zip added |
---|
comment:20 by , 3 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in 835eb0a556d678dd65bb1978519c4d62d93c37c4
The black outline got little green tint if dithering is used but that is covered in different open bug report.
This has very little similarities with a valid ticket.
Does
paletteuse=bayer
fix the issue for you?