I have a set of 300 transparent png files and I would like to create a transparent video file from them. I'm using the ffmpeg command as follows:

ffmpeg -f image2 -i anim.%04d.png -r 30 -vcodec png video.webm

I know webm has an alpha channel according to this answer. The command creates the video but the transparency is completely lost. What am I doing wrong? Is it possible to create a transparent .mp4 with ffmpeg?

1 Answer 1


You have to specify the pixel format, to force it to include the alpha channel, using the -pix_fmt option. You don't need to use png as your video codec either.

ffmpeg -i anim.%04d.png -r 30  -pix_fmt yuva420p video.webm
  • What's the complex filter equivalent to -pix_fmt? Would format=yuva420p be enough? Feb 3 at 23:03
  • Not sure, that might be a good candidate for a new question
    – stib
    Feb 4 at 2:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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