i have the following command to overlay gif above png
String command = '-y -i $path.png -i $path.gif -filter_complex '
'[1:v]scale=200:200[i1];'
'[0:v][i1]overlay=100:100'
' -q:v 1 $output.gif';
it work fine , but the problem is that my first input ($path.png) is no longer transparently as what it was before execute .
in other word : before i execute the command my path.png has rounded corners and transparently background , when i overlay the gif above it so it totally effect path.png like it remove the rounded corners and background became black .
when i overlay png instead of gif so it does not effect the path.png and everything is fine .
So how to to overlay gif with preserving the transparently of path.png and it's rounded corner too . thanks
Edit
this is the first input (png)
this is second input (gif)
Now i am trying to overlay the second input (gif) above the first input (png)
'-y -i png -i gif -filter_complex '
'[1:v]scale=$w:$h[i1];'
'[0:v][i1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)-10'
' -q:v 1 outputGif';
OUTPUT
as you can see , it lost the black transparently and rounded corners
and the following is @Rotem command
'-y -i png -i gif -filter_complex '
'"[1:v]scale=$w:$h[i1];'
'[0:v][i1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)-10:'
'format=auto,split[s0][s1];[s0]palettegen=reserve_transparent=1[p];[s1][p]paletteuse" -q:v 1 outputGif';
output
it became totally transparent . but i am trying to keep that black transparent background like original and not fully transparent







$png,$gif... and replacecommand =with full FFmpeg command. Can you please make sure that animated GIF format supports semi-transparent background? I think it is not supported. See this post for example. – Rotem Jul 29 '23 at 08:08ffmpeg -y -i in.png -i in.gif -filter_complex "[0:v]format=rgba[v0];[1:v]scale=200:50[i1];[v0][i1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)-10:format=auto" -plays 0 out.apng, It is not possible using Animated GIF. The gray background of the Animated GIF can't be semi-transparent. – Rotem Jul 30 '23 at 16:16'-y -i $png -i https://lukeroberts.tv/blog/wp-content/uploads/2019/05/apng1.png' ' -filter_complex "[0:v]format=rgba[v0];[1:v]scale=200:50[i1];[v0][i1]' 'overlay=(main_w-overlay_w)/2:(main_h-overlay_h)-10:format=auto" -plays 0 $.apng';
– Mohammed Hamdan Aug 05 '23 at 12:33