Playing video with alpha on iOS?

I have three formats so far to play a video with alpha channel on iOS, and none worked.

mMovie->getTexture returns nullptr.

Before I go and implement a shader keying solution, is there something I should try?

Here are the files:

animation

hap alpha

pro res 4444

–8

According to this SO article, (which I can’t believe i’m using as a reference), it’s not natively possible, but they provide a link to a commercial library that may be able to help. Also this seems to hint at a hack that may or may not work, depending on your use case.

A.

@lithium Thanks, it seems with the AVAnimator I will have to put a transparent AVAnimatorView on top of the Cinder’s view. Not sure it will work, but worth a try.

–8

When I get stuck with this I do a classic hacky fix. If possible, render a video that is double the height, but the same width, and render the alpha channel to the bottom half of the screen. Then using a shader, just draw the top half, using the bottom half as an alpha mask. It makes sure your files stay in sync and it’s pretty fast. If you get stuck, try it out!

-c

1 Like

@sharkbox That’s a nice solution! And… since I am using a grayscale video, I simply encode first channel as a gray and second channel as an alpha! No need to to increase the size of the frame!

Thanks!

–8

1 Like