2

I have a short animation clip made with PyMOL software (visualizing molecules), in the MP4 format. I am going to use this animation in future presentations, and it would look much better if the background was transparent. Is there an easy way to achieve this? I am working on a Mac. Obviously free/open source software would be best, but I am interested in any software capable of this.

I also have the option in PyMOL to save each frame of the video as PNG files, which do have an alpha channel. But once I convert this to mpeg or MP4, the alpha channel disappears.

3
  • How do you intend to use the MP4?
    – Gyan
    Commented Apr 23, 2018 at 13:58
  • For use in powerpoint or keynote presentations. The format is not important to me, any format that us not too large will do.
    – Yoda
    Commented Apr 23, 2018 at 13:59
  • One has to wonder, what exactly do you want to show through this hypothetical transparent background? You mentioned presentations. Does that mean you want to paste it onto some kind of slide texture or solid color? What's wrong with the current background? A molecular animation would seem to require a simple, white or black background. Is that not what you have now? A screen shot might help us to understand the issue.
    – user8356
    Commented Apr 24, 2018 at 17:08

1 Answer 1

5

The MP4 format doesn't support an Alpha channel. The question you've asked is very broad, and I've tried to answer to a certain extent below. However you may need to decide what route you're going to try and then researching that route or asking further, more specific questions.

The file types that currently support an Alpha (transparency) channel are FLV, F4V, AVI, Quicktime, and WebM. If you're using free programs, you may find they can export in these formats. Often, there will be a named codec for an Alpha channel within the settings of these, or a PNG option. Firstly, I would see if there's an option to export video within your PyMOL software in any of these formats - try exporting them in different ways to see if they have the Alpha channel.

Alternatively, if it's a one off video, you could use the free trial of Premiere Pro or After Effects to create and export your video, although it can be a learning curve if it's a complex project and you have never used Adobe Creative Cloud before. Lastly, you could export your video and try and remove the background in a video editor. (If you want to use WebM, you need a third-party WebM codec for Adobe Media Encoder.)

PNG import /export

You could import the png sequence into either After Effects or Premiere Pro (free trials available for each). I'm sure several free programs can import a PNG sequence automatically, or you could manually arrange the images on the timeline, one image per frame.

I mainly use Premiere Pro so below I've listed a couple of ways I can use it to export a transparent video directly from Premiere. HOWEVER - there are likely to be similar options in other programs - most video programs will export in a variety of formats / codecs.

###Export a movie file with an alpha channel in Premiere Pro ###

  1. Select the sequence.
  2. Choose File > Export > Media.
  3. In the Export Settings dialog box, choose one of the following options:

Option 1 - QuickTime

  • Select "QuickTime" in the file format
  • Select "PNG" from the video codecs
  • Under Channels, select "RGB + Alpha"

Option 2 - Microsoft AVI

  • Select "AVI" in the file format
  • Select "RGBA + " from the video codecs
  • Under Channels, select "RGB + Alpha"
  1. Once you have changed settings as per one of the sets of options above, continue to set other settings and click Export or Queue to export as you normally would.

Remove background

Another option is that if the background is a consistent colour - white, grey, green etc, most advanced video editors will have options to remove the background using a colour match.

In Premiere Pro, this is done using the Chroma key effect. In essence, add the effect to the video, take a sample of the background colour, and the background should be removed, it's just left for you to export the video in one of the methods mentioned previously.

Not the answer you're looking for? Browse other questions tagged or ask your own question.