From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id A269C48AA8 for ; Thu, 28 Mar 2024 21:37:58 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B714368D607; Thu, 28 Mar 2024 23:37:56 +0200 (EET) Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E04B568D4E5 for ; Thu, 28 Mar 2024 23:37:50 +0200 (EET) Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2d700beb60bso27179621fa.1 for ; Thu, 28 Mar 2024 14:37:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711661870; x=1712266670; darn=ffmpeg.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=X3qwSHt7H5Lb6DG632lKdA+b1jfzcP0EtLWk5Unkap8=; b=hZBTLZ9X0jpz+BI8CBbOMFR2QmM3k2S9J8PkP4W93huDTQMdmbGsTp2KhAmAH3QGnh ECJOTmMWEyT92uxdxXjBdjriWxjRDCQjKbl+eu4aDf6H+u7Ts7NugMXAVnk6RC5CEZ9o OtqFXwKCWUToXcnTb6JNnisieEOhE0YeYw8p27frHvyC8NwCYGIM0QBVwLq3iOLKG/Al Jr3BMWGC51qgwIzE+ifPLdglBCGEPX5ETSDKEeDUJNjD+F2WWM6c0g0viSjMojtrTsqc e/u84dei1GP50QqY8mMmj7pglXEsP8g6fq77sHFrtkIhaXx6ojcvOgIk5xSaQZ6b4Aw7 dvMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711661870; x=1712266670; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=X3qwSHt7H5Lb6DG632lKdA+b1jfzcP0EtLWk5Unkap8=; b=O8iB8G6Mi5/Yx0vn/KT96opcmLc/P7SwoR4XGAyZVWL/yYhn0kDtxVELFuRX7cLw+Q CIdJG4i380UieqPg0eJoteq+xazVehKqi6+C/lxT6GgKdsU6hJhYLVrSOnzu0nhf+9DD 8MGykj7hulm0N/Eyo48VgX7tEdDduVsMYikN8tQDh1k87H5aRFPyCYPggzTF6OPJKhnC jDvQm26uzKZxnuJ6Hk7Wl6brMrvHlcArf5iydyZe0sc3b5Jldr1lB3K/lwbkcrLhz/yJ HN3IN7rVjd6sr86k+45S8cr04AB02T5ZtOj612Ddp+n0ldvg8PTZNx6qh65ZQU2BHuzg epMQ== X-Gm-Message-State: AOJu0YzM733+Au08Cx/a4yqIngxz1ruyoE7H/zlPVElBv5aWfAw4jlQy KcxFO+OSeeqNQUq2ge1rQhJzwv+YSZ+7SwSvZx+f4F5rGOsZEd9hnQ/OOIRx X-Google-Smtp-Source: AGHT+IEVJoiQbvFsRDmoEPg9Emfg0i1PpBCSrjuo8a56vGfxglDzIt0Hvxcw7vfmLfBv6aa87choNg== X-Received: by 2002:a2e:9185:0:b0:2d6:edd8:f488 with SMTP id f5-20020a2e9185000000b002d6edd8f488mr315278ljg.37.1711661869568; Thu, 28 Mar 2024 14:37:49 -0700 (PDT) Received: from mariano (net-93-70-84-101.cust.vodafonedsl.it. [93.70.84.101]) by smtp.gmail.com with ESMTPSA id f4-20020a17090660c400b00a457a55b814sm1188394ejk.73.2024.03.28.14.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 14:37:49 -0700 (PDT) Received: by mariano (Postfix, from userid 1000) id A2080BFCE4; Thu, 28 Mar 2024 20:11:44 +0100 (CET) Date: Thu, 28 Mar 2024 20:11:44 +0100 From: Stefano Sabatini To: FFmpeg development discussions and patches Message-ID: Mail-Followup-To: FFmpeg development discussions and patches , Nicolas Gaullier References: <20240328175736.161733-1-nicolas.gaullier@cji.paris> <20240328175736.161733-2-nicolas.gaullier@cji.paris> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240328175736.161733-2-nicolas.gaullier@cji.paris> User-Agent: Mutt/2.1.4 (2021-12-11) Subject: Re: [FFmpeg-devel] [PATCH v5 1/1] avformat/demux: Add duration_probesize AVOption X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Nicolas Gaullier Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On date Thursday 2024-03-28 18:57:36 +0100, Nicolas Gaullier wrote: > Yet another probesize used to get the durations when > estimate_timings_from_pts is required. It is aimed at users interested > in better durations probing for itself, or because using > avformat_find_stream_info indirectly and requiring exact values: for > concatdec for example, especially if streamcopying above it. > The current code is a performance trade-off that can fail to get video > stream durations in a scenario with high bitrates and buffering for > files ending cleanly (as opposed to live captures): the physical gap > between the last video packet and the last audio packet is very high in > such a case. > > Default behaviour is unchanged: 250k up to 250k << 6 (step by step). > Setting this new option has two effects: > - override the maximum probesize (currently 250k << 6) > - reduce the number of steps to 1 instead of 6, this is to avoid > detecting the audio "too early" and failing to reach a video packet. > Even if a single audio stream duration is found but not the other > audio/video stream durations, there will be a retry, so at the end the > full user-overriden probesize will be used as expected by the user. > > Signed-off-by: Nicolas Gaullier > --- > doc/APIchanges | 3 +++ > doc/formats.texi | 19 ++++++++++++++++++- > libavformat/avformat.h | 16 ++++++++++++++-- > libavformat/demux.c | 13 ++++++++----- > libavformat/options_table.h | 1 + > libavformat/version.h | 2 +- > 6 files changed, 45 insertions(+), 9 deletions(-) > > diff --git a/doc/APIchanges b/doc/APIchanges > index aa102b4925..f709db536d 100644 > --- a/doc/APIchanges > +++ b/doc/APIchanges > @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07 > > API changes, most recent first: > > +2024-03-28 - xxxxxxxxxx - lavf 61.3.100 - avformat.h > + Add AVFormatContext.duration_probesize. > + > 2024-03-27 - xxxxxxxxxx - lavu 59.10.100 - frame.h > Add AVSideDataDescriptor, enum AVSideDataProps, and > av_frame_side_data_desc(). > diff --git a/doc/formats.texi b/doc/formats.texi > index 69fc1457a4..3fe7fa9d8d 100644 > --- a/doc/formats.texi > +++ b/doc/formats.texi > @@ -225,9 +225,26 @@ Specifies the maximum number of streams. This can be used to reject files that > would require too many resources due to a large number of streams. > > @item skip_estimate_duration_from_pts @var{bool} (@emph{input}) > -Skip estimation of input duration when calculated using PTS. > +Skip estimation of input duration if it requires an additional probing for PTS at end of file. > At present, applicable for MPEG-PS and MPEG-TS. > > +@item duration_probesize @var{integer} (@emph{input}) > +Set probing size, in bytes, for input duration estimation when it actually requires > +an additional probing for PTS at end of file (at present: MPEG-PS and MPEG-TS). > +It is aimed at users interested in better durations probing for itself, or indirectly > +because using the concat demuxer, for example. > +The typical use case is an MPEG-TS CBR with a high bitrate, high video buffering and > +ending cleaning with similar PTS for video and audio: in such a scenario, the large > +physical gap between the last video packet and the last audio packet makes it necessary > +to read many bytes in order to get the video stream duration. > +Another use case is where the default probing behaviour only reaches a single video frame which is > +not the last one of the stream due to frame reordering, so the duration is not accurate. > +Setting the duration_probesize has a performance impact even for small files because the probing > +size is fixed. nit++: setting the @option{duration_probesize} or ... setting this option > +Default behaviour is a general purpose trade-off, largely adaptive: the probing size may range from > +250000 up to 16M, but it is not extended to get streams durations at all costs. I'm a bit concerned if we should really mention these values, since they are currently hardcoded and this might result in inconsistent documentation in case of update (probably we can only mention that it is adaptive therefore avoiding to expose the internal thresholds). > +Must be an integer not lesser than 1, or 0 for default behaviour. > + [...] Looks good to me otherwise, thanks. _______________________________________________ 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".