[FFmpeg-devel] [PATCH 2/7] avcodec/ffv1enc: add information message when version is changed by the encoder

Jerome Martinez jerome at mediaarea.net
Wed Mar 7 17:49:24 EET 2018


There is a message when coder type is forced to a value not chosen by 
user, but no message when version is forced to a value not chosen by user.
This patch adds such message for more coherency in the messages, and the 
user is informed that the command is not fully respected.

ffmpeg f lavfi -i mandelbrot=s=1920x1080 -vf format=gbrp9 -vframes 1 -c 
ffv1 -level 0 -coder 0 a.mkv

Before:
[ffv1 @ 000002492CD69B40] bits_per_raw_sample > 8, forcing range coder

After:
[ffv1 @ 000001A6E404A780] bits_per_raw_sample > 8, forcing version 1
[ffv1 @ 000001A6E404A780] bits_per_raw_sample > 8, forcing range coder


-------------- next part --------------
From 49db6049fa50976683fc651cf180ab8c7428225e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Martinez?= <jerome at mediaarea.net>
Date: Wed, 7 Mar 2018 10:37:46 +0100
Subject: [PATCH 2/7] avcodec/ffv1enc: add information message when version is
 changed by the encoder

---
 libavcodec/ffv1enc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index d71d952c6d..ac8b715b74 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -509,7 +509,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
 {
     FFV1Context *s = avctx->priv_data;
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
-    int i, j, k, m, ret;
+    int i, j, k, m, ret, oldversion;
 
     if ((ret = ff_ffv1_common_init(avctx)) < 0)
         return ret;
@@ -534,6 +534,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
         }
         s->version = avctx->level;
     }
+    oldversion = s->version;
 
     if (s->ec < 0) {
         s->ec = (s->version >= 3);
@@ -679,6 +680,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
     av_assert0(s->bits_per_raw_sample >= 8);
 
     if (s->bits_per_raw_sample > 8) {
+        if (oldversion >= 0 && oldversion != s->version) {
+            av_log(avctx, AV_LOG_INFO,
+                    "bits_per_raw_sample > 8, forcing version 1\n");
+            oldversion = s->version;
+        }
         if (s->ac == AC_GOLOMB_RICE) {
             av_log(avctx, AV_LOG_INFO,
                     "bits_per_raw_sample > 8, forcing range coder\n");
-- 
2.13.3.windows.1



More information about the ffmpeg-devel mailing list