FFmpeg: Added support for writing alpha values in WebM/VP9 video

The VP9 video codec supports writing alpha values; now this is available
in Blender too.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5156
This commit is contained in:
Sybren A. Stüvel 2019-07-31 11:18:55 +02:00
parent 631d5026c7
commit 43b7512a59
Notes: blender-bot 2023-02-14 09:44:56 +01:00
Referenced by issue #80769, RGBA movie rendering: WebM/VP9 codec missing alpha channel
1 changed files with 7 additions and 0 deletions

View File

@ -701,6 +701,12 @@ static AVStream *alloc_video_stream(FFMpegContext *context,
c->pix_fmt = AV_PIX_FMT_ARGB;
}
if (codec_id == AV_CODEC_ID_VP9) {
if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
c->pix_fmt = AV_PIX_FMT_YUVA420P;
}
}
if (codec_id == AV_CODEC_ID_PNG) {
if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
c->pix_fmt = AV_PIX_FMT_RGBA;
@ -1838,6 +1844,7 @@ bool BKE_ffmpeg_alpha_channel_is_supported(RenderData *rd)
return ELEM(codec,
AV_CODEC_ID_QTRLE,
AV_CODEC_ID_PNG,
AV_CODEC_ID_VP9,
# ifdef FFMPEG_FFV1_ALPHA_SUPPORTED
AV_CODEC_ID_FFV1,
# endif