From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id EC3C74DE7C for ; Tue, 6 Jan 2026 15:28:36 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'pf3ik28bNTqAI2wFMFssdJ5u2NxwfzV293Ly/f3FUaA=', expected b'zgOsmG4eWyUcZ4zmQYYCruMTST88SO3RW3+jxIbF3tI=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1767713294; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=pf3ik28bNTqAI2wFMFssdJ5u2NxwfzV293Ly/f3FUaA=; b=Wje7Mgqk2CH3PmxeMGwe+UFw2E0/r/mb0ZxsDK1/Xxo6HtogLCQO3vIIrdktlmI4ZgkCg LTy/Wmz3v3qupNB2RPmZ/VJj2/Kayc1DFZ7TuyTya10yRmV9n1l5PGqm33gsmFIZLpYWbER Nadu9vziCqPOBpC0YZvYQOAaeHLP0QmFyz89ETmYaZ3ne/5W/NTsup7UJqJPJDnKLKAe4xR jb6sklw2oW+sofQLhLYCAYJeU81X8FpKBIyJjXib76CEuTGKZTDstozHyOMqBpMv+qDsnJt M+/Ot56lZ2d8dov0z7VvtwhPvCeP1zq/Rq8xit4u9Y/ekw6Qjv49VS9gUdVQ== Received: from [172.20.0.4] (unknown [172.20.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id AA7F1690D80; Tue, 6 Jan 2026 17:28:14 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1767713276; b=E9PQrHYcFfd1HyFh1ZIkzUaeMdlpFaATofKp+omjuyYvy9yyOwmapWxo/zuN35WqiZwck 78ChfgABGhLASbxWhS0i2YoMgCO46AEiF6MwAg4yaZwLChbFzCVow+VY2x3BruRxnICUrnb pf8/rzjZxW6/bJ4ofd0SSxPXP7Rz/Dt7te7dhoMNGusMNlbHs9ke0t+jPhs1aG1vvccpPD8 G6JLT08XYZvXlL99y5C2wlv2FtyyRKOhfzDY6Lnn6I7GetxAC7BczLJIGIfwv2qLxegW/Qs 7/4ihGgoiesb2kYKeBcakH1DVKj36705czWuu00Bay6ysZf1Lixlw26vCaKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1767713276; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=bk6ZTed14awCTotf6gK1p/r2+3qt4q0ol8cqW9l529s=; b=h0kx1eKp/BDZZyqtrN8/pQ5Vg6GVq6/1QJMNmw7XbtzCHTCy5eD8iagiJPEs0fSUwB9d5 xsdiA8eyAQcY16207TMNWTG42fDtjLOb3SavVWYilDW0WGud7xFJudKaoNQjCVyKAxe3qVP 32lcc9Em4e9JjQ4Exc3SIcXxuqNvsSN+JtekAiXEGY6oUEWTNxCuMPj4aJQQaUavAO19iIB g7HYfv8JUHIICeccvRVgqJjGtVV7+3CyWpk2xGiQYASgHoLTmulT5e1kVqa989RjcedL0MJ 6SvWDJiPIAAAZkmZzC/pqToeXfp9IzSGDwW/1imApU4AwuKOxU/cj7szB9Wg== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1767713269; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=zgOsmG4eWyUcZ4zmQYYCruMTST88SO3RW3+jxIbF3tI=; b=Ka3VK6kwl4tVHhjOR52ZEIe4ZusQn0foVlG0+i+sykry6MCecOLspRMgDWueCXTrU0FvP ldlBcOcYeQJ2c9H5iFFwPmDWco3uKuyXImdvZZG5r2r20WAxWSbnqrC3z2O1XfIXkKoGaeR o5sPXVnqzuX1G5R3oKpM2R0RBKFG2zE/WWpa2SEJnfSMX7UU3nTEls5mT4iPpZAzlvOvPJc msYshAPxSwF48GnDn68fiXBbhTQNbpXTlWEq+eEmfYLdeUiNmVtH8RrgS9dAtm84LSQsGW3 soLc5KkeoKTqKU4sBIj3czWVaqUw6Bh+3saQnK8/BZC6qEdkntQsRw1yGH0A== Received: from de3a2b3407a2 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id EC42B68FCCD for ; Tue, 6 Jan 2026 17:27:48 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Tue, 06 Jan 2026 15:27:48 -0000 Message-ID: <176771326910.25.734799837863509048@4457048688e7> Message-ID-Hash: 5TF57KBMBHMPKJILCNMP2JC22U46YR5B X-Message-ID-Hash: 5TF57KBMBHMPKJILCNMP2JC22U46YR5B X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PR] [RFC] avformat: Add an option to force analysis of all known streams (PR #21395) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Derek Buitenhuis via ffmpeg-devel Cc: Derek Buitenhuis Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #21395 opened by Derek Buitenhuis (dwbuiten) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21395 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21395.patch Often it happens that when probing streams, we already know the the number of streams we have, but fail to fill out all the codec info like pixel format, etc. due to relying on an arbitrary max analyze duration set by us or the user. >>From a user perspective, using the API or `ffprobe`, you would end up with weird hacks/workarounds like probing once to get the number of streams and starting timestamp, since the format has that in its header, and then probing a second time, with `analyzeduration` set to the first timestamp, or exponentially increasing until all info is filled out. This is, of course, silly. Add an option to probe until all streams are analyzed, if possible. (This, of course, does not fix the case like in FLV where we may not even know there is another stream until it is seen.) >>From 14bec46baa75d32765c2dcabcd4472337d1e42ae Mon Sep 17 00:00:00 2001 From: Derek Buitenhuis Date: Tue, 6 Jan 2026 15:12:43 +0000 Subject: [PATCH] avformat: Add an option to force analysis of all known streams Often it happens that when probing streams, we already know the the number of streams we have, but fail to fill out all the codec info like pixel format, etc. due to relying on an arbitrary max analyze duration set by us or the user. >>From a user perspective, using the API or ffprobe, you would end up with weird hacks/workarounds like probing once to get the number of streams and starting timestamp, since the format has that in its header, and then probing a second time, with analyzeduration set to the first timestamp, or exponentially increasing until all info is filled out. This is, of course, silly. Add an option to probe until all streams are analyzed, if possible. (This, of course, does not fix the case like in FLV where we may not even know there is another stream until it is seen.) Signed-off-by: Derek Buitenhuis --- doc/formats.texi | 7 +++++++ libavformat/avformat.h | 7 +++++++ libavformat/demux.c | 4 +++- libavformat/options_table.h | 1 + libavformat/version.h | 2 +- 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/doc/formats.texi b/doc/formats.texi index 876a9e92b3..1a66a61fd2 100644 --- a/doc/formats.texi +++ b/doc/formats.texi @@ -245,6 +245,13 @@ Default behaviour is a general purpose trade-off, largely adaptive, but the prob will not be extended to get streams durations at all costs. Must be an integer not lesser than 1, or 0 for default behaviour. +@item force_analyze_all_streams @var{integer} (@emph{input}) +For formats which we know the number of streams (due to header, etc.), setting +this forces stream probing to keep reading packets until it has info for all +known streams, regardless of what @code{analyzeduration} is set to. Note that +this may cause excessive reads, which may matter if probing over a network. +Note that @code{probesize} is still respected. + @item strict, f_strict @var{integer} (@emph{input/output}) Specify how strictly to follow the standards. @code{f_strict} is deprecated and should be used only via the @command{ffmpeg} tool. diff --git a/libavformat/avformat.h b/libavformat/avformat.h index bd34132e00..7527129f66 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1884,6 +1884,13 @@ typedef struct AVFormatContext { * @see skip_estimate_duration_from_pts */ int64_t duration_probesize; + + /** + * Force all streams to be analyzed, regardless of what max_analyze_duration is set + * to. Demuxing only. Default is 0 (off). + */ + int force_analyze_all_streams; + } AVFormatContext; /** diff --git a/libavformat/demux.c b/libavformat/demux.c index b40739dc3a..8ea9c00797 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -2872,7 +2872,9 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) else if (avctx->codec_type == AVMEDIA_TYPE_SUBTITLE) limit = max_subtitle_analyze_duration; else limit = max_stream_analyze_duration; - if (t >= limit) { + if (!analyzed_all_streams && ic->force_analyze_all_streams) { + av_log(ic, AV_LOG_VERBOSE, "hit max_analyze_duration but ignoring, since force_analyze_all_streams is set.\n"); + } else if (t >= limit) { av_log(ic, AV_LOG_VERBOSE, "max_analyze_duration %"PRId64" reached at %"PRId64" microseconds st:%d\n", limit, t, pkt->stream_index); diff --git a/libavformat/options_table.h b/libavformat/options_table.h index 5047b5ce50..7e54828c66 100644 --- a/libavformat/options_table.h +++ b/libavformat/options_table.h @@ -106,6 +106,7 @@ static const AVOption avformat_options[] = { {"skip_estimate_duration_from_pts", "skip duration calculation in estimate_timings_from_pts", OFFSET(skip_estimate_duration_from_pts), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, D}, {"max_probe_packets", "Maximum number of packets to probe a codec", OFFSET(max_probe_packets), AV_OPT_TYPE_INT, { .i64 = 2500 }, 0, INT_MAX, D }, {"duration_probesize", "Maximum number of bytes to probe the durations of the streams in estimate_timings_from_pts", OFFSET(duration_probesize), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, (double)INT64_MAX, D}, +{"force_analyze_all_streams", "Force all streams to be analyzed, regardless of analyzeduration", OFFSET(force_analyze_all_streams), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, D}, {NULL}, }; diff --git a/libavformat/version.h b/libavformat/version.h index 1d3a53875a..9d1b6ede7e 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -32,7 +32,7 @@ #include "version_major.h" #define LIBAVFORMAT_VERSION_MINOR 8 -#define LIBAVFORMAT_VERSION_MICRO 102 +#define LIBAVFORMAT_VERSION_MICRO 103 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org