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.
This commit is contained in:
2012-02-24 09:49:44 +00:00
parent 1fbd91b8a1
commit dd0f151ba9
3 changed files with 20 additions and 3 deletions

View File

@@ -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