How do I make a video animation with transparent background?

Dale Marvin dmarv at dop.com
Wed Aug 10 01:38:19 EDT 2016


On 8/9/16 6:50 PM, Lawrence D’Oliveiro wrote:
> On Wednesday, August 10, 2016 at 12:44:30 AM UTC+12, Martin Schöön wrote:
>
>> What I have failed to achieve is a graph with a transparent
>> background.
>
> While it is possible to render image frames with alpha transparency channels, as far as I know none of the motion-video image formats supports transparency. They all assume that the image fills the entire frame and completely covers anything behind.
>
> You could invent your own player which draws the frames one after another itself. Note that the JPEG image format doesn’t support transparency; you would have to use a bulkier format like PNG.
>
> Another option would be to have an additional video track where the image is interpreted purely as transparency masking information for the “proper” video track. You would still need to write your own player to handle this.
>

Another option in the Python world is Vapoursynth:
<https://github.com/vapoursynth/vapoursynth>
<http://www.vapoursynth.com/doc/index.html>

I runs with Cython and generally pipes to something like ffmpeg which 
creates the final video file so it may be a more complex than you want 
but it is capable of the processing you are asking for and in a Python 
language syntax.

Dale



More information about the Python-list mailing list