Note that a few video codecs also support alpha these days, which could be used to preserve the mask and overlay the video over some background.
It even works on the web: https://files.catbox.moe/uu2ze0.webm (needs a non-black background)
It even works on the web: https://files.catbox.moe/uu2ze0.webm (needs a non-black background)