From f420118335e4a3c81f7a50eb08c9da8765d451e3 Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Tue, 1 Feb 2022 00:00:29 +0100 Subject: Fix T93856: VP9 lossless render missing alpha Since 0ea0ccc4ffd5, `AV_PIX_FMT_YUV444P` pixel format was used for lossless renders, which did override `AV_PIX_FMT_YUVA420P` format when "RGBA" output is chosen. VP9 encoder doesn't seem to support `AV_PIX_FMT_YUVA444P` pixel format, so use `AV_PIX_FMT_YUVA420P` for lossless RGBA ouput instead. Reviewed By: sergey Differential Revision: https://developer.blender.org/D13947 --- source/blender/blenkernel/intern/writeffmpeg.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 4d94132e6fd..9effeb831b6 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -726,14 +726,12 @@ static AVStream *alloc_video_stream(FFMpegContext *context, } } - 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_VP9 && rd->im_format.planes == R_IMF_PLANES_RGBA) { + c->pix_fmt = AV_PIX_FMT_YUVA420P; } - - /* Use 4:4:4 instead of 4:2:0 pixel format for lossless rendering. */ - if ((codec_id == AV_CODEC_ID_H264 || codec_id == AV_CODEC_ID_VP9) && context->ffmpeg_crf == 0) { + else if ((codec_id == AV_CODEC_ID_H264 || codec_id == AV_CODEC_ID_VP9) && + context->ffmpeg_crf == 0) { + /* Use 4:4:4 instead of 4:2:0 pixel format for lossless rendering. */ c->pix_fmt = AV_PIX_FMT_YUV444P; } -- cgit v1.2.3