smokris
smokris

Reputation: 11850

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

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?

Upvotes: 6

Views: 694

Answers (2)

Jie
Jie

Reputation: 1

The alpha is always straight, never pre-multiplied.

ffmpeg doc writes. https://ffmpeg.org/doxygen/4.1/pixdesc_8h.html#a06924ef0ebf07d8742ff8994e3a948bf

Upvotes: 0

Karim Agha
Karim Agha

Reputation: 3625

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

Upvotes: 0

Related Questions