QtVideoSaver() - which codec supports alpha channel?

Hi all,

its me again, i am struggling at the moment with qtvideosaver + alpha channels. normally png’s support alpha channel, therefore i am using


But i have a suspicion, that alpha channel is not supported in qtVideoSaver?

I would be deeply greatefull to get some information on that.

thank you

I’m pretty sure that ofxQtVideoSaver does not support 4 channel images. Consider that the signature is:

void ofxQtVideoSaver::addFrame(unsigned char* data, float frameLengthInSecs)  

And inside that function there are lines that say things like:

int myWidth = w*3;  

So it’s definitely not generalized for non-3-channel images.

Hi Kyle,

how can you see that qtvideosaver doesn not support 4channel images by looking to the function signature addFrame?

Is it possible to just extend it by adding “4” or will the library not allow that?

thank you for your help

By looking at the signature, I can tell that it’s looking for an unsigned char* which means it doesn’t know what kind of data you’re passing it. Therefore, it assumes you are passing it one specific kind of data: RGB triples.

I don’t think it’s as easy as changing the *3 to *4, there are probably other functions in there you will need to modify and some places where memory is allocated that you will need to modify.