Hi,

2014-08-18 13:40 GMT+02:00 Carl Eugen Hoyos <ceho...@ag.or.at>:
> Christophe Gisquet <christophe.gisquet <at> gmail.com> writes:
> If a profile was set, the automatic setting should
> probably not overwrite it.
> (If this is possible.)
>
> But I consider the usecase where a user wants to encode
> alpha but at the same time using a profile that
> indicates no alpha of very limited usefulness.

0001-proresenc-skip-warn-on-incorrect-profile.patch is the
continuation of the first patch: we still encode the alpha with the
incorrect profile (ie no change in behaviour) thereby not overriding
the user decision. If he selected strict conformance and a profile
without alpha, alpha channel coding is skipped.

Second patch 0001-proresenc-force-correct-profile-for-alpha.patch
overrides the profile information. The default profile is
PRORES_PROFILE_STANDARD, maye a PRORES_PROFILE_AUTO could be
introduced to control the behavior of this patch.

-- 
Christophe
From f24ec2b80392918e436fd5b5564b0641e37131f9 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: skip/warn on incorrect profile

This does, if strictness level is high enough:
- Skip encoding of alpha when profile does not allow it;
- Warn about profile allowing alpha when content does not have alpha.

Some software such as After Effects and Final Cut Pro entirely skip
alpha channel decoding if the profile is not 4444.
---
 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..90e9d74 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 &&
+            avctx->strict_std_compliance > FF_COMPLIANCE_NORMAL) {
+            // 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 &&
+            avctx->strict_std_compliance > FF_COMPLIANCE_NORMAL)
+            av_log(avctx, AV_LOG_WARNING, "profile with alpha but "
+                   "content has no alpha\n");
+
         ctx->alpha_bits = 0;
     }
 
-- 
1.9.2.msysgit.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to