Make an Alpha Mask video from PNG files

2019-08-17 04:09发布

问题:

For RenPy it uses the notion of an Alpha Mask video https://www.renpy.org/doc/html/movie.html#movie-displayables-and-movie-sprites

I can convert the a bunch of PNGs with alpha channel to http://wiki.webmproject.org/howtos/convert-png-frames-to-webm-video I was wondering how to do the same sort of thing without creating another set of PNG files with just the alpha frame.

I'll be okay with something that uses imagemagik in the middle if needed.

回答1:

You can use ffmpeg to create both files at once.

ffmpeg -i img%d.png -filter_complex "alphaextract[a]" \
       -map   0:v -pix_fmt yuv420p -c:v libvpx -b:v 0 -crf 20 color.webm \
       -map "[a]" -pix_fmt yuv420p -c:v libvpx -b:v 0 -crf 20 alpha.webm

Depending on your shell, you may need to quote the map arg in single quotes.



标签: ffmpeg webm