Video with transparent background


I’m trying to create a video that contains a gif. From a previous answer, I saw that the best way to do it is convert the gif to a video like webm and add that to my result.

Here’s the video I’m using with transparent background:

And here’s the result I’m getting:

As you can see, there is a black background :frowning:

Do I have to specify something more for this to work?


Reference to the prev answer: What formats does Shotstack support? - #4 by lucas.spielberg

Hi StaggerDev!

Would you mind sharing a link to the original gif?

Could you please also outline how you converted the gif to video?

Sure! The original gif is: but I’m not using this, I’m using the webm.

I use the node sdk.

Something like:

    const api = new Shotstack.EditApi();
    const tracks = [];
    const duration = 10;

    // This is the webm video
    const overlayAsset = new Shotstack.VideoAsset();
    const newUrl = convertGifToVideo(url);
    const overlayClip = new Shotstack.Clip();

    const overlayTrack = new Shotstack.Track();


    // This is just a background image
    const backgroundAsset = new Shotstack.ImageAsset();
    const backgroundClip = new Shotstack.Clip();
    const backgroundTrack = new Shotstack.Track();

    const timeline = new Shotstack.Timeline();

    const size = new Shotstack.Size();

    const output = new Shotstack.Output();

    const edit = new Shotstack.Edit();


    await api.postRender(edit);

I’m using Cloudinary to serve the assets and they take care of conversions. You just change the extension in the url. Animated GIF? Convert to WebM or MP4

I had a look at the webm video but it has the black background in the video. It looks like when you convert gif to webm in Cloudinary it does not retain the transparency. The ideal conversion would be gif to mov with alpha channel if that is possible. Do you need to dynamically convert the file or can it be manually converted and exported in software like Adobe Premiere?

Oh ok thanks! I’ll chat with them to see if I can keep the transparency of the video. I need it to be dynamic yes