ofxFFmpegRecorder with Alpha FBO corrupted output

Hello! I decided to post this question here as the github repo owner has stopped maintaing this addon.

The addon works when you allocated the FBO you want to save as GL_RGB, but not GL_RGBA. Does anyone know why this is and how to get around it?

If not, and the question following is unrelated to the main question, does anyone know what’s the best way to record high quality frames without frame dropping (which happens using ofSaveScreen() for example)?


Hi @samtsao,

So to encode RGBA, you will need to use a codec FFV1 which accepts RGBA. format in ffmpegRecorder, using setVideoCodec. I would advice to test the codec outside the addon.

Are you able to use the addon so far?

Hey thanks for this! I should have known it was something to do with the codecs. Yes, I have been able to use the addon but I’ve switched to using Arturo’s ofxTextureRecorder as it’s been the best fit for my use case.

I am working with my fork of ofxFFmpegRecorder

and trying to record a ofFBO with alpha channel mCapFbo.allocate( m_Grabber.getWidth(), m_Grabber.getHeight(), GL_RGBA );

But the recorded file causes the images to slide vertically.

I circumvented all fumes arguments setting in the addon and basically call ffmpeg with this command
args.push_back(" -f -an -vsync 0 -framerate 30.000000 -video_size 1280x720 -f rawvideo -pix_fmt rgba -vcodec rawvideo -i - -vcodec hap -format hap_alpha -b:v 8000k -framerate 30.000000 -pix_fmt rgba");
I also tried this output option with the same result.

args.push_back("-pix_fmt yuva444p10le");

it might be something about OpenGL RGBA not lining up with -f rawvideo -pix_fmt rgba


Apr-21-2022 21-12-31
File only works with VLC on my macOS 10.15.7 system

same issue with prores_ks and yuva444p10le

args.push_back(" -f rawvideo -pix_fmt rgba -vcodec rawvideo -framerate 29.97 -s 1280x720 -i - -vsync 1 -vcodec prores_ks -b:v 8000k -framerate 29.97 -pix_fmt yuva444p10le");

same for
args.push_back(" -r 60 -f rawvideo -pix_fmt rgba -s 1280x720 -i - -threads 0 -preset fast -y -pix_fmt yuv420p -crf 21 -vf vflip");

@Caroline_Record I think you have worked with HAP + alpha layer in the past using ofxFFmpegRecorder. How did you make that work?

HI @stephanschulz ,
Looking at this line in your addon, I think it should be multiplied by pixels.getNumChannels() instead of 3 since you are using rgba instead of rgb.


@NickHardeman you rock.
That did the trick. I updated the repo too.

Thank you very very much.

Apr-22-2022 13-02-56

1 Like