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 E526C4EF4E for ; Fri, 13 Jun 2025 22:02:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 7E81768CC21; Sat, 14 Jun 2025 01:02:52 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id A6D5C68C592 for ; Sat, 14 Jun 2025 01:02:45 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 5AF6BEC7A2 for ; Fri, 13 Jun 2025 23:59:49 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0j0NeC0g99d5 for ; Fri, 13 Jun 2025 23:59:46 +0200 (CEST) Received: from iq (iq [217.27.212.140]) by iq.passwd.hu (Postfix) with ESMTPS id 72475EC7A1 for ; Fri, 13 Jun 2025 23:59:46 +0200 (CEST) Date: Fri, 13 Jun 2025 23:59:46 +0200 (CEST) From: Marton Balint To: FFmpeg development discussions and patches In-Reply-To: Message-ID: <764ebc53-28d4-8671-117b-d76b453770b9@passwd.hu> References: <53b693320f1cf07ee6094342a60002bc9cfc3d79.1749794067.git.ffmpegagent@gmail.com> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 05/10] doc/muxers: Add documentation for segment_limit option 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Fri, 13 Jun 2025, softworkz . wrote: > >> -----Original Message----- >> From: ffmpeg-devel On Behalf Of >> Marton Balint >> Sent: Freitag, 13. Juni 2025 22:26 >> To: FFmpeg development discussions and patches > devel@ffmpeg.org> >> Subject: Re: [FFmpeg-devel] [PATCH 05/10] doc/muxers: Add >> documentation for segment_limit option >> >> >> >> On Fri, 13 Jun 2025, softworkz wrote: >> >>> From: softworkz >>> >>> Signed-off-by: softworkz >>> --- >>> doc/muxers.texi | 7 +++++++ >>> 1 file changed, 7 insertions(+) >>> >>> diff --git a/doc/muxers.texi b/doc/muxers.texi >>> index 6d5c17b4cc..1cca8da1fb 100644 >>> --- a/doc/muxers.texi >>> +++ b/doc/muxers.texi >>> @@ -3510,6 +3510,13 @@ packet written. Defaults to @code{0}. >>> Write segments to files with a .tmp extension. Each file is >> renamed to its >>> actual name on completion. This can help to prevent segment files >> from >>> being accessed before they are complete. Disabled by default >> (@code{0}). >>> + >>> +@item segment_limit @var{number} >>> +Stops after the specified number of segments has been generated. >>> +This can be helpful to fill gaps in a range of already generated >> segments, >>> +which is difficult to achieve otherwise as it would either cause >> the last >>> +segment to be incomplete or to overwrite an existing segment >> with a partial >>> +data. Default is @code{0} - no limit. > > Hi Marton, > > thanks a lot for reviewing. > >> You can merge the documentation patch with the feature patch, there >> is no >> need to split. > > Sure, will do that - I just never know which way is right. > > >> What is not quite clear is that what is going to happen to the >> surplus >> data at after the last segment? Is it silently dropped? Because >> that would be unacceptable IMHO. > > Well, that's the whole point of the feature. FFmpeg will stop as > soon as the specified number of segments has been generated. As far as I understand ffmpeg will not stop, but will keep reading on the input till the end of the source file, gigabytes worst case. Or am I missing something? > > (Please note, that the default is 0, which means that nothing is > dropped and there's no change in behavior when it's 0). > > Probably it's best to look at an example. Let's say we have: > > - a 300s video > - that we want to stream via HLS > - Segment-Duration: 3s - makes 100 segments > - Now we want to create the segments on-demand only, > so we deliver a synthetic playlist with 100 3s segments, > even though we don't have any segment yet > - Once specific segments are needed, we create them on-the-fly > > That's a situation that the commit message is about: > > Existing segments 0-30 and 70-99 => we already have them on disk > > 31-69 need to be created > > This option allows to stop precisely after 69. > Otherwise, it would start overwriting segment 70 before stopping > via 'q' or break signal. > > So, in order to generate segments 31-69, you will set > segment_start_number to 31 and the segment_limit to 38. > This causes the muxer to write and complete segment 69 > in the exact same way like when it would be creating segment > 70, but without starting to write segment 70 - which would destroy > the existing segment 70 (which is good already). Buy you have to seek in the input to achieve that, don't you? And you can just as easily specify the input duration to not overwrite segment 70... If you want to implement the segment limit, you have to make sure the ffmpeg encoding process stops after the last segment. One idea is to return an error if the segment limit is reached. Regards, Marton _______________________________________________ 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".