[Bf-blender-cvs] [43b7512a59c] master: FFmpeg: Added support for writing alpha values in WebM/VP9 video

Sybren A. Stüvel noreply at git.blender.org
Wed Jul 31 11:43:04 CEST 2019


Commit: 43b7512a59c2c4400ab7ccb5783efa707bfa2148
Author: Sybren A. Stüvel
Date:   Wed Jul 31 11:18:55 2019 +0200
Branches: master
https://developer.blender.org/rB43b7512a59c2c4400ab7ccb5783efa707bfa2148

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

===================================================================

M	source/blender/blenkernel/intern/writeffmpeg.c

===================================================================

diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 0d4182ff24d..fcd00837f4f 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -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



More information about the Bf-blender-cvs mailing list