`cvtColor(input[i], output[i], COLOR_RGB2RGBA);`
Looks like that this code is never called (cvtFrameFmt() called with output_cn=1). Is it OK? Why do you need RGB->RGBA conversion?