Sibbs Gambling
Sibbs Gambling

Reputation: 20355

Replace transparent pixels (alpha) with black in ffmpeg?

I have an image with alpha channel indicating what the background is.

How do I de-alpha-y (remove the alpha channel) and make the background pure black with ffmpeg?

Upvotes: 3

Views: 5660

Answers (1)

Gyan
Gyan

Reputation: 93048

Basic syntax would be

ffmpeg -i in.png -filter_complex "color=black,format=rgb24[c];[c][0]scale2ref[c][i];[c][i]overlay=format=auto:shortest=1,setsar=1" out.png

What this does is generate a black canvas and resizes it to the image size. Then the image is overlaid on top. The opaque pixels from the image are retained but the transparent pixels reveal the canvas underneath.

Upvotes: 3

Related Questions