2014-08-18 19:26 GMT+02:00 Christophe Gisquet <christophe.gisq...@gmail.com>:
> Hi,

And with all patches.

-- 
Christophe
From 89b54fbd698eb9c68f0bf30105bcaf72c5575d27 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: force correct profile for alpha

Irrespective of the strictness level, if the pixel format contains alpha,
the profile is forced to be 4:4:4:4. Otherwise, the file may contain
alpha, but software like Final Cut Pro or After Effects will consider
this file to not contain alpha data.
---
 libavcodec/proresenc_kostya.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
index 46f81db..08ea906 100644
--- a/libavcodec/proresenc_kostya.c
+++ b/libavcodec/proresenc_kostya.c
@@ -1145,6 +1145,13 @@ 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->profile != PRORES_PROFILE_4444) {
+            // force alpha and warn
+            av_log(avctx, AV_LOG_WARNING, "Profile 4:4:4:4 forced to "
+                   "allow encoding of alpha channel. Change pixel format"
+                   " if you actually want this.\n");
+            ctx->profile = PRORES_PROFILE_4444;
+        }
         if (ctx->alpha_bits & 7) {
             av_log(avctx, AV_LOG_ERROR, "alpha bits should be 0, 8 or 16\n");
             return AVERROR(EINVAL);
-- 
1.9.2.msysgit.0

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