Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Jerome Martinez <jerome@mediaarea.net>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] avcodec/ffv1enc: avoid repeating the same warning forever
Date: Wed, 9 Apr 2025 00:14:16 +0200
Message-ID: <20346e31-e7d6-49eb-b942-47b53b8a0514@mediaarea.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 1471 bytes --]

The warning is repeated forever, 1 per second, and pollues the logs 
without any added value compared to one warning for the whole stream.

Before:
$ ./ffmpeg -y -f lavfi -i testsrc=duration=10:size=8000x8000 -c:v ffv1 
-level 3 test.mkv
[...]
[ffv1 @ 0x560605332f00] Cannot allocate worst case packet size, the 
encoding could fail
[ffv1 @ 0x560605332f00] Cannot allocate worst case packet size, the 
encoding could fail
[ffv1 @ 0x560605332f00] Cannot allocate worst case packet size, the 
encoding could faild=0.0266x
[ffv1 @ 0x560605332f00] Cannot allocate worst case packet size, the 
encoding could faild=0.0399x
     Last message repeated 1 times
[ffv1 @ 0x560605332f00] Cannot allocate worst case packet size, the 
encoding could faild=0.0638x
     Last message repeated 1 times
[ffv1 @ 0x560605332f00] Cannot allocate worst case packet size, the 
encoding could faileed=0.0797x
     Last message repeated 1 times
[ffv1 @ 0x560605332f00] Cannot allocate worst case packet size, the 
encoding could faileed=0.0911x
     Last message repeated 8 timeses
frame=   17 fps=2.8 q=-0.0 Lsize=   15616KiB time=00:00:00.68 
bitrate=188126.9kbits/s speed=0.112x

After:
$ ./ffmpeg -y -f lavfi -i testsrc=duration=10:size=8000x8000 -c:v ffv1 
-level 3 test.mkv
[...]
[ffv1 @ 0x55acab29ef00] Cannot allocate worst case packet size, the 
encoding could fail
frame=   25 fps=2.5 q=-0.0 Lsize=   26368KiB time=00:00:01.00 
bitrate=216006.7kbits/s speed=0.101x

[-- Attachment #2: 0001-avcodec-ffv1enc-avoid-repeating-the-same-warning-for.patch --]
[-- Type: text/plain, Size: 1428 bytes --]

From 945ac7638e9d7fb6365ef30126e26ddd426784b7 Mon Sep 17 00:00:00 2001
From: Jerome Martinez <jerome@mediaarea.net>
Date: Wed, 9 Apr 2025 00:04:55 +0200
Subject: [PATCH] avcodec/ffv1enc: avoid repeating the same warning forever

---
 libavcodec/ffv1.h    | 1 +
 libavcodec/ffv1enc.c | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ffv1.h b/libavcodec/ffv1.h
index 9472f9c958..ee0a1a7858 100644
--- a/libavcodec/ffv1.h
+++ b/libavcodec/ffv1.h
@@ -151,6 +151,7 @@ typedef struct FFV1Context {
     int flt;
     int remap_mode;
     int remap_optimizer;
+    int maxsize_warned;
 
     int use32bit;
 
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 35a1ae16d4..0fb6caecee 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -1749,7 +1749,11 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     maxsize = ff_ffv1_encode_buffer_size(avctx);
 
     if (maxsize > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE - 32) {
-        av_log(avctx, AV_LOG_WARNING, "Cannot allocate worst case packet size, the encoding could fail\n");
+        FFV1Context *f = avctx->priv_data;
+        if (!f->maxsize_warned) {
+            av_log(avctx, AV_LOG_WARNING, "Cannot allocate worst case packet size, the encoding could fail\n");
+            f->maxsize_warned++;
+        }
         maxsize = INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE - 32;
     }
 
-- 
2.46.0.windows.1


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

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

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

                 reply	other threads:[~2025-04-08 22:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20346e31-e7d6-49eb-b942-47b53b8a0514@mediaarea.net \
    --to=jerome@mediaarea.net \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git