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 322984EF72 for ; Fri, 13 Jun 2025 22:49:40 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 0465168CC4F; Sat, 14 Jun 2025 01:49:36 +0300 (EEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11olkn2101.outbound.protection.outlook.com [40.92.18.101]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 29A6B68BFBA for ; Sat, 14 Jun 2025 01:49:29 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=c4v73esmY9URjGxTbHE+uaAqPYAUQphoyijZVN37SzJ9sqFccOvgbr3vkayryZ+2WRj4SEhQ4ugPTb1SObGzB6IdgHotd2YhK4y3EYQ6ASzUNkXrMgfowdiPcleeqj4mPSGuD4xHSQcWsUuK41NIxozf5OicEul0G1b17AYaMofOXdIDmftjHmqso2MJes8m+X8MeYxaAJ7Iyxcw/E/CBqwFBKEm0p/w48/xveyZ/Hc92cPkl0ggqRlBwXEPTlo50OnF3cppEEloS8Wqc8aGhrmdAEO53o4SnqfWdjpQ9//GqhF+NSq0nB5lztQmycbgzMBj2X3YZmGhixXjatmQAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2IcvMs+MiMAcTn+unChiZuvuHC/ZHcz8qyMXa0KUMEE=; b=eJcyu0JG9USwfLuXSC/q98Obrcbj3auYrmJFhDI1KUSa7eac+J8Cx0vFjTjA41kg6Yw0fVGVsnLPPaahiQ7DFEFNH/GpDmwTtrt6m9rt8PWGG8Iz562IgTukbaSHJedVKQIojaJ6AAKiDQktfaFxIPaUBc1y9cfABmbLgzbfJII6nHFjW7QSHHfeSiJ6qGUYB+z7a+uv0AoDw6LxopcKxadSqCVdLXnd8PjE0HJ9wmHoUgQd19ZhPgvES5tZ7y4zTEk0z+zmxEzqO0stQt01AcOCCZbne1Tm2AhOuRfXcnu4HQe8diSxNKV0QKxNJV5CZH2BfhgwRXpJyQPJY39cTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2IcvMs+MiMAcTn+unChiZuvuHC/ZHcz8qyMXa0KUMEE=; b=nvcWswccGovLD7vDFS+7XpetPy+PfntHco7o6p7HmjUf6jipyYG7vdsL+5IHwANlWopnVDYC7m1mMMHOcQel5FowPFtkoaY1sP3sNZiS5xM81GDxroMlrIxS2evc8pOzOz6liE27F0FULhCR+LdebjV8VRoT+2kFEIpZjR6Gr093DmLCHLEHht5l95QkggfFESA8y8stX8YgG45amkR37eqiHYpo0+4ypnd31AVQxrNw+2M1bhex0UFS1ivinaimKugCKri6rM4G1SuWxX2mD0pIMqRJ88IPqQqvKzkkGiK59NTfWDASegLA3966/Xa7C+9cZYj9RxVyC+4TA3Lerw== Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM (2603:10b6:8:b::20) by BL3P223MB0116.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:34f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8835.24; Fri, 13 Jun 2025 22:49:25 +0000 Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM ([fe80::bf09:8e9:b07f:98a7]) by DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM ([fe80::bf09:8e9:b07f:98a7%6]) with mapi id 15.20.8835.023; Fri, 13 Jun 2025 22:49:25 +0000 From: "softworkz ." To: FFmpeg development discussions and patches Thread-Topic: [FFmpeg-devel] [PATCH 05/10] doc/muxers: Add documentation for segment_limit option Thread-Index: AQHb3Ce1JEyc6RJW1UWZRoOvVHgo7LQBilOAgAAK5iCAAA9qAIAAB4fg Date: Fri, 13 Jun 2025 22:49:24 +0000 Message-ID: References: <53b693320f1cf07ee6094342a60002bc9cfc3d79.1749794067.git.ffmpegagent@gmail.com> <764ebc53-28d4-8671-117b-d76b453770b9@passwd.hu> In-Reply-To: <764ebc53-28d4-8671-117b-d76b453770b9@passwd.hu> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM8P223MB0365:EE_|BL3P223MB0116:EE_ x-ms-office365-filtering-correlation-id: 61768a95-09f3-4128-1337-08ddaacc8ba1 x-ms-exchange-slblob-mailprops: Cq7lScuPrnorNxbFcnOr5XZ/wReADy9KoWTleaAowCF4H3+hZPB0fwqXP9Q2nDQmkA7OB3AKcdluWJFnhmiI/KhNLMrnYVE6rh7nVLPngK33OzQvuDle85/NFX6KI4xi38DTv9sgbLMcZLX+s7VbXMtkeEoJ9VVWmYXyk+esGK/Zy+RYPKvwfZt5WpNT/it5Qn2PRIv13YG9dWnKb/SNNKLeMpOcS4qNlrQAL3hV3vADupKpZC3kSqMvtgGNbu/OvPU8DspnqRkV6BGTkU313F+noenYUAtS3bwhh0rqEraUU7GoMpYd5v7ScoDaH3F6xwF9AjDAyxQslKoVpwm5+OMI8JjxvDdUZJMkTpLHIkQ4ajaVmodyl7InlhbJa2BYa9ZgofXr7/RzD+N1MpwGjZUtD0hDKfm+u8ocIlNFBlneXzBkkau49icGKB8NceGkxFegx5bTQE9tn1BR+NGsvi8dABOc4IauML+vn4iyxJgyqje9lBG9xJYLrwouph9jthAdURABo63hE56uB3HX7tWx2FnqjOpogge2bMaMarowo4Y3ayfuxmlrjsalMtbY6XZGUSIoqERnMlxkF8yjz7u6bjsAglij8R16+b6/NwUbnDAcRqxZFN0TkMZC2bqFjIPfMBtTWwDWK/auX7BU1Z8r9LwpF1ek+2rdmsq0gTnSC59N/qD9d7DZQcom/aJ4PYeYyGkdoLI8uu3iEjstBn3dcKg42Uz7YcOvcU4YfeZO7OZGTDDxFB91iqURX8q8mI6yIkqagnM= x-microsoft-antispam: BCL:0; ARA:14566002|41001999006|7092599006|19110799006|15080799009|8060799009|8062599006|461199028|3412199025|440099028|40105399003|102099032|56899033; x-microsoft-antispam-message-info: =?us-ascii?Q?1k0GEUFQlc4fMw0q6aCSMebCnQwgKNl2ld9gyyTvDp47PGKhpelmPzxzc3Ma?= =?us-ascii?Q?31bX7dcBgNlz0YhN3oPYMpRsOblp0jApdn4dX7l5mgIBCHhbqMhS+4m9i81o?= =?us-ascii?Q?1eiSlyaNr8bl3ZieBjGiCZwjW30e6+gmAz36bnieTCtu3pE/eOGs9o2VE5gd?= =?us-ascii?Q?4FLJ0/X/DkCSvOMPsdMVtNi/j597aSg8PEPnBifCjqDEdRAda4QYkP5Hw4AF?= =?us-ascii?Q?qdCV2RQux+fEx/umlsZniAgjow2m0nl+GEm/8yZli/MqrCaHrjYeCQZ3xTu+?= =?us-ascii?Q?SIhDwIumbT38uo4YO7BpjeqRkZKAviEtOv9LaY7CKdy9r72OikrTob7/8ueT?= =?us-ascii?Q?h9/UwV/FXoxRbkzqB9xF5sZUwMoqbsyiLvpDLi59xcX4nWMQF0HmfQxEXHos?= =?us-ascii?Q?mpVtKm4KPHtqgbQYezo8gR3vq/1lc/+suzKpxvTihjfZMdy2P+tmXghyv6Vz?= =?us-ascii?Q?5Kutj/YbU37AKjZzZvu8+2xnSz5SJGcnN7bpgJsy8KC0XePCsFM/unGf17yC?= =?us-ascii?Q?icMx65CHWfFj1Zy4DCBF/NGfjjMDuvxdYmilRT4FEDRgfJunZN7KYDk2Vla/?= =?us-ascii?Q?Xx0xDl/QEo9L/DjuxMoKlgf3OGHHMtY7uOv7dyTIFx7ryeMGA1+QeRbVbCP4?= =?us-ascii?Q?0n2WZ6LxZJu3JUYhYcy4V6jdb8PIFcl0QUvrV4PML/uJm17gi7Sum62cWx/5?= =?us-ascii?Q?EAwmE7AOfL1jP4leu2OXFVfnTzrrPD+yaBCETTePDowGRV55/H5E9h+G0/jA?= =?us-ascii?Q?CSzliegJVHKy9bYxPJy539JUuph143iXU21dt+fklUM9T/jweT5wNLzKS2lv?= =?us-ascii?Q?7by78fAIptYwISqa2dhCxBo3KFhzyuaWf0stssBstMLns8PguiEH+hPVuU7w?= =?us-ascii?Q?9BXIDZZSB76NJZgq9Ps8R4PgWxG902ENfyIP9DxoXtElkXbJLn2OWwecCJLe?= =?us-ascii?Q?NDtXiKkQVnMCBmErZyXieJVj3dUIasfMGE914w1XyM+bPh/hW6bU/PTr2mUS?= =?us-ascii?Q?PlFu6UdG0Iv3DxzDOUvxyFf445WuhLcb4uxVUggDl9NssorwdO3ff/eNFUnp?= =?us-ascii?Q?27uMhXz5GktnfAUysZcvYEXl4HlYyLds3DZktdKtJSrF2mBXmC4RY5zCWjUU?= =?us-ascii?Q?CeWPz2jNZEDmSlwruZzJM1xKWcyMLDOZbIBBMtqyNk8ot6Pg7yLprLY=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?nGTV/MgwVG1egUWPjNOYZcpgw9/Y6oCKxIb/bigfy4OhKVEo7px7YMOqUqrU?= =?us-ascii?Q?qe6uhAlll0HQNsX19JeGXD1/i7ShU0cYVAdor344TUFGH558Vq9PeluppUrf?= =?us-ascii?Q?Cz1qEsbQuLF56H32FWhXJfLaJVTqQMlbyN35VpCl7KyR2JDxw7W2sXux4plL?= =?us-ascii?Q?Oo986ZkUzJ1XHafJ9T6vERGLEFjmHP5AbYOXSD+n5bzyP7sACGhPAz0pkfxf?= =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ey6PebDvhtZSdTX+m3fMmXf73xJ3O?= =?us-ascii?Q?4l0YaxJdHoWKjuFlKaX7zRUn6k+yGim47Hfxe6iQ4Su6RM2uzHX/Qo3B2sWe?= =?us-ascii?Q?ePrdQifE+Ec7GJNtr171EObCXvMe/WjsvvUyCLKLJPFh1oji21IcdsTrsyg?= =?us-ascii?Q?=3D?= MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-8534-20-msonline-outlook-c7cf3.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 61768a95-09f3-4128-1337-08ddaacc8ba1 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Jun 2025 22:49:24.8512 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3P223MB0116 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-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: > -----Original Message----- > From: ffmpeg-devel On Behalf Of > Marton Balint > Sent: Samstag, 14. Juni 2025 00:00 > 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: > > > > >> -----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? Ah you are right! It's been a while since I had been dealing with the use cases. The reason why I said that "it stops" is because we're additionally setting an end time ('-to') which is slightly after the end of the last segment to generate. > > (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... Here we're getting at the core of the problem: When specifying -to or a duration, you cannot achieve the exact same "cut" like the segment muxer does it. It usually cuts by video key frames. And when it does the cut it also cuts all other streams at that moment. Timestamp offsets between video and audio are common, often the audio is somewhat ahead of the video (specifically in case of TV broadcast streams), but it varies. Also, when transcoding before segmenting, it's not easy to predict the exact video key frame times. For each segment n to segment n+1 the cut must be done in a way that for each stream, there is neither a duplicate nor a missing frame. That is what makes it non-trivial. In the end, it always comes down to the same conclusion: the only way to get the exact same cut point through all streams like the segment muxer does it - is to let the segment muxer do it. At least that was my conclusion from intensive work on this, some years ago. > 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. Maybe an EOF/EOS error? Thanks, sw _______________________________________________ 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".