I'm attempting to combine several pngs and a .gif that are 40px in size and then upscale that to 800px. However, it ends up with dithering dots. These should not occur because we are not adding any additional colors to the frames by upscaling.
Here's my FFMPEG command:
ffmpeg -i assets/background.png -i assets/Brown_Boy_Jacket.png -i assets/Wet_Hair.png -i assets/Bouncing_Floppy_Green.gif -i assets/Cigarette.png -filter_complex "[0][1]overlay=format=auto[i1];[i1][2]overlay=format=auto[i2];[i2][3]overlay=format=auto[i3];[i3][4]overlay=format=auto,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse=dither=bayer: bayer_scale=5,scale=800:-1:flags=neighbor " -loop 0 output/mygiffile.gif
Example if dithered .gif:
[Attachment 70591 - Click to enlarge]
When I upscale to a .png there is no dithering:
[Attachment 70590 - Click to enlarge]
+ Reply to Thread
Results 1 to 7 of 7
-
-
Did you try
Code:paletteuse=dither=none
Right now you have bayer dither specified
Code:paletteuse=dither=bayer
-
Just tried it and there is still some noise in the gif:
[Attachment 70596 - Click to enlarge]. Thanks for the suggestions though -
-sws_dither 0 should disable dithering if it's being applied during the scaling or pixel format conversion step
You might have to insert it in the filter chain or under flags
Code:scale=800:-1:flags=neighbor
Code:scale=800:-1:flags=neighbor:sws_dither=0
-
This still has dithering,
ffmpeg -i assets/background.png -i assets/Brown_Boy_Jacket.png -i assets/Wet_Hair.png -i assets/Bouncing_Floppy_Green.gif -i assets/Cigarette.png -filter_complex "[0][1]overlay=format=auto[i1];[i1][2]overlay=format=auto[i2];[i2][3]overlay=format=auto[i3];[i3][4]overlay=format=auto,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse=dither=none, scale=800:-1:flags=neighborws_dither=0 " -loop 0 output/mygiffile.gif
[Attachment 70600 - Click to enlarge]
Is there something wrong with this structure where the dithering is getting applied before we apply the dither=none and sws_dither=0 parms? I still get confused by the flow of these [s0],[s1], [p] labels and what is actually happening.
split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse=dither=none, -
Probably dither is being applied at an earlier step. Maybe something with your format=auto , some hidden conversions to pal8 dithering . You might have to flag those too. Because Bouncing_Floppy_Green.gif is already a gif (pal8) , that overlay step might be applying dithering. eg. If you overlay a RGB24 png and RGB24 png, the "auto" format would be RGB24 and it would not dither
I don't think overlay format has flags to control the conversion. And "auto" is often a recipe for disaster . Maybe if convert the gif to an APNG first, then use that as input
https://ffmpeg.org/ffmpeg-filters.html#overlay-1
s0 and s1 are the same output node (just duplicated) in order to use palletegen and palleteuse in the same commandline
p is the output node of palletegen, and fed into palletuse as input -
You may add to scale additional flags 'accurate_rnd:bitexact' also seem ffmpeg may call silently automatic pixel format conversion... (perhaps libswscale prefer YCbCr color space) this is biggest problem in ffmpeg workflow - i would explicitly request RGB pixel format - alternatively you may give a chance to 'zscale' - it may behave more predictable than 'scale' .
Similar Threads
-
How do i upscale PAL
By HansensUniverse in forum Newbie / General discussionsReplies: 26Last Post: 4th Feb 2022, 00:30 -
Question on dithering
By Betelman in forum RestorationReplies: 26Last Post: 26th Jun 2020, 05:47 -
What is the best way to upscale videos.
By Felow in forum Video ConversionReplies: 15Last Post: 9th Jan 2020, 15:00 -
Dithering of Video in Pinnacle Studio 19
By DonH in forum EditingReplies: 10Last Post: 29th Sep 2019, 09:28 -
Dithering Settings in Audacity
By Dabuss55 in forum AudioReplies: 4Last Post: 22nd Jun 2019, 05:52