From dd0f151ba95db213a7c97bc7f51285b57b0243fb Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 24 Feb 2012 09:49:44 +0000 Subject: Changes in FFV1 codec settings Since FFmpeg 0.10 release FFV1 codec supports alpha channel which is getting enabled when using PIX_FMT_RGB32 pixel format. This leads to incompatibility of videos rendered in Blender with almost all external players (especially in OSX). Seems that PIX_FMT_BGR0 is recommended to be used to make videos compatible with older players which doesn't support alpha channel in FFV1. Also added an option to switch to RGBA rendering if FFV1 codec is used and if RGBA rendering is used FFV1 will be using PIX_FMT_RGB32 format which supports alpha channel. --- source/blender/blenkernel/intern/writeffmpeg.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern/writeffmpeg.c') diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index e9f7823dfe8..2291ea5a249 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -506,12 +506,21 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex } // Keep lossless encodes in the RGB domain. - if (codec_id == CODEC_ID_HUFFYUV || codec_id == CODEC_ID_FFV1) { + if (codec_id == CODEC_ID_HUFFYUV) { /* HUFFYUV was PIX_FMT_YUV422P before */ c->pix_fmt = PIX_FMT_RGB32; } - if ( codec_id == CODEC_ID_QTRLE ) { + if (codec_id == CODEC_ID_FFV1) { + if (rd->im_format.planes == R_IMF_PLANES_RGBA) { + c->pix_fmt = PIX_FMT_RGB32; + } + else { + c->pix_fmt = PIX_FMT_BGR0; + } + } + + if (codec_id == CODEC_ID_QTRLE ) { if (rd->im_format.planes == R_IMF_PLANES_RGBA) { c->pix_fmt = PIX_FMT_ARGB; } @@ -1422,4 +1431,11 @@ void ffmpeg_verify_codec_settings(RenderData *rd) ffmpeg_set_expert_options(rd); } +int ffmpeg_alpha_channel_supported(RenderData *rd) +{ + int codec = rd->ffcodecdata.codec; + + return ELEM(codec, CODEC_ID_QTRLE, CODEC_ID_FFV1); +} + #endif -- cgit v1.2.3