How to tell whether the colors in a video frame decoded by FFmpeg are pre-multiplied by alpha?

611 views Asked by At

When I decode video frames with FFmpeg (avcodec_decode_video2(), sws_scale()), with some videos (e.g., ProRes4444), I get colors pre-multiplied by alpha, and with other videos (e.g., QuickTime PNG), I get colors that aren't pre-multiplied by alpha.

How can I tell whether the colors are pre-multiplied? Alternatively, how can I tell FFmpeg to always provide either pre-multiplied or un-pre-multiplied ("straight alpha") colors?

1

There are 1 answers

1
Karim Agha On

Try looking at AVCodecContext's color-space related properties, like AVColorSpace.