Hi, Ticket #3846 is about an incorrect profile being used: - The user wants alpha but the profile indicates to software there's no alpha - Also, the encoder still encodes the alpha channel in spite of the profile
The attached patch is not the most user-friendly, but is preferred by the encoder author, and has the merit to leave the final decision to the user. An alternative would be to select the profile based on the pixel format. If a user wants to encode without alpha, he would then need to change the pixel format as well as specify the proper profile, which may not be obvious to him. -- Christophe
From d9679c80df991e98b1f00fd15f9c1c3c689ec426 Mon Sep 17 00:00:00 2001 From: Christophe Gisquet <christophe.gisq...@gmail.com> Date: Mon, 18 Aug 2014 11:27:50 +0200 Subject: [PATCH] proresenc_kostya: warn/reject on incorrect profile This fixes the following situations: - Reject encoding when profile selected encodes alpha, but the pixel format does not have an alpha channel; - Warn if the pixel format has an alpha channel but the profile does not encode it; - Do not encode alpha if the profile does not specify it. --- libavcodec/proresenc_kostya.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c index 46f81db..d2419e9c 100644 --- a/libavcodec/proresenc_kostya.c +++ b/libavcodec/proresenc_kostya.c @@ -1145,11 +1145,22 @@ static av_cold int encode_init(AVCodecContext *avctx) return AVERROR(EINVAL); } if (av_pix_fmt_desc_get(avctx->pix_fmt)->flags & AV_PIX_FMT_FLAG_ALPHA) { - if (ctx->alpha_bits & 7) { + if (ctx->profile != PRORES_PROFILE_4444) { + // ignore alpha but warn + av_log(avctx, AV_LOG_WARNING, "If you want alpha to be encoded," + "please specify -profile 4444\n"); + ctx->alpha_bits = 0; + } + else if (ctx->alpha_bits & 7) { av_log(avctx, AV_LOG_ERROR, "alpha bits should be 0, 8 or 16\n"); return AVERROR(EINVAL); } } else { + if (ctx->profile == PRORES_PROFILE_4444) { + av_log(avctx, AV_LOG_ERROR, "attempt to encode alpha while " + "content has no alpha\n"); + return AVERROR(EINVAL); + } ctx->alpha_bits = 0; } -- 1.9.2.msysgit.0
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel