diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-02-24 13:49:44 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-02-24 13:49:44 +0400 |
commit | dd0f151ba95db213a7c97bc7f51285b57b0243fb (patch) | |
tree | 9c46804519a7788db235a052213a551e0367b9f0 /source/blender/blenkernel/intern/writeffmpeg.c | |
parent | 1fbd91b8a1277f5616245ef8357f930681764adf (diff) |
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.
Diffstat (limited to 'source/blender/blenkernel/intern/writeffmpeg.c')
-rw-r--r-- | source/blender/blenkernel/intern/writeffmpeg.c | 20 |
1 files changed, 18 insertions, 2 deletions
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 |