0

I am a researcher, trying to string together a bunch of png files of a protein to a short video. I have all the png images with transparent backgrounds, but I can't seem to get this in the video.

I use this (on macOS terminal) to convert:

ffmpeg -framerate 20 -pattern_type glob -i '*.png' -c:v libx264 -preset slow  -profile:v high -level:v 4.0 -pix_fmt yuv420p -vf pad="width=ceil(iw/2)*2:height=ceil(ih/2)*2" -crf 22 -codec:a aac -pix_fmt yuva420p SST4.mp4

I added the -pix_fmt yuva420p that I found as an accepted answer here, but it doesn't work for me. I also tried other options (rgb24, bgra, etc.), but none I have tried works. I get a nice video, just with black background instead of transparent.

5
  • How do you intend to play the video?
    – Gyan
    Sep 14 at 12:14
  • This is just for a PowerPoint presentation (where it will partly overlap something else; that's why I want the transparent background).
    – Aephir
    Sep 15 at 6:42
  • How about apng (Animated PNG). Size will be large but it is simply PNG with animation . Sep 18 at 14:46
  • Thanks for the suggestion, @AbdullahIbnFulan, but if I try that, I see "ghosting". That is, each part of the previous image that is now where there is nothing (clear background) sticks around for the next. So I can see parts of each of the 240 images once it's done (done with online tool, ezgif.com/apng-maker).
    – Aephir
    Sep 23 at 11:59
  • @AbdullahIbnFulan scratch that, apparently there was a checkbox to avoid that behavior. Still interested in alternatives for as you say, size is large. But for now it'll work, thanks!
    – Aephir
    Sep 23 at 12:13

Your Answer

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

Browse other questions tagged or ask your own question.