1

I overlay using the following command:

ffmpeg -i video.mp4 -i logo.png -filter_complex "[1]geq=r='r(X,Y)':a=0.1[a];[0][a] overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0" out.mp4

I tried adjusting the opacity using

fmpeg -i video.mp4 -i logo.png -filter_complex "[1]format=rgba,geq=r='r(X,Y)':a='1*alpha(X,Y)'[a];[0][a] overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0" out.mp4

but it is still transparent at the white color part.

It seems like the white color part has a transparency of 0, causing the second command to not work.

Is there any reason why this is happening? The logo I tried is

enter image description here

How can I preserve the white color?

1 Answer 1

1

There is no white color. That's the background color of the page showing through. Your input PNG is palettized 8-bit image where black color indicates transparency.

Apply the following filter to the image to convert black pixels to white and set a uniform transparency.

geq=r='if(p(X,Y),p(X,Y),255)':g='if(p(X,Y),p(X,Y),255)':b='if(p(X,Y),p(X,Y),255)':a=0.1
2
  • I dont quite understand what do you mean by black color. I dont see any black color. Also, can you kindly explain what is p(X,Y)? The documentation says pixel at the current plane which is kind of vague. Commented Apr 8, 2018 at 14:45
  • The actual color stored in the PNG in the area of the 'f' is black, which the viewer interprets as transparency. My geq expr checks if a pixel is non-black. If so, it keeps it, else changes it to white.
    – Gyan
    Commented Apr 8, 2018 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.