Flash, FLV, and alpha channels: straight or premultiplied?
[Today’s post is from Tim Kurkoski, After Effects quality engineer.]
When you render and export an FLV file with an alpha channel and then import the FLV file into Adobe Flash Professional (the Flash authoring application), you may get a colored halo in semi-transparent areas of the image if the background color of your After Effects composition is not black.
To work around this problem, do either of the following and re-render the FLV file:
* Change the background color of your composition to black.
* Change the Color setting to Straight in the Video Settings section of the Output Module Settings dialog box.
This problem occurs because the FLV encoder (the Adobe Media Encoder) only embeds alpha channels as premultiplied with black. The encoding happens after After Effects renders each frame and passes it on to the Adobe Media Encoder, according to the output module settings. This means that if After Effects rendered a frame as premultiplied and the background color was not black, then the background color will become embedded in the visible pixels of the frame.
Adobe Flash Professional and Flash Player only support alpha channels that are premultiplied with black. This is faster and simpler for Flash Player to decode than straight alpha channels. Flash Professional does not have a function to control how alpha channel colors are interpreted.
It is safe to use the straight alpha mode in the output module settings because straight mode does not embed the background color into the pixels. Thus there is no color contamination when the FLV encoder converts the alpha to premultiplied with black. However, the default Color setting is Premultiplied (with the composition background color), so you must change this setting manually every time. If you use this setting frequently you can create a new output module template.
Note: Earlier versions of After Effects have the opposite problem: black as the background color will cause a black halo, while other premultiplied colors may appear OK in Flash. FLV encoding in After Effects CS4 was changed so the default options (black background and premultiplied alpha) will produce a good-looking image. For any version of After Effects, choosing straight alpha will produce a good-looking image.