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 B41834EF9C for ; Sat, 14 Jun 2025 00:59:31 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 2EC9D68CD75; Sat, 14 Jun 2025 03:59:27 +0300 (EEST) Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id CE69C68C8B8 for ; Sat, 14 Jun 2025 03:59:20 +0300 (EEST) Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-b2f62bbb5d6so2128918a12.0 for ; Fri, 13 Jun 2025 17:59:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749862759; x=1750467559; darn=ffmpeg.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=A0qHYwMFiOH6/1sQ7RoWME/5UxRgybA/B7mrTzPKlI8=; b=LT6vAHTtNFNXO/ITIZyuJ12xClMqQ0YAuwKVEaiBdVCg9zGRTHKfAUB/ZCcKhq2BPw UOM8Aw/sLGVPx49j1ynBmqUV8R0BN6cqlgtXvAg5g0zmObLP8SRs+3TageE9oyxqflmJ t5uejc8MACgmZ8q6X+DmswUceEiIhG5gNkO0mAVC5L9nIc7qlPHgqPLg7CoQ9lWomocu P8+hZq2RCat8hFDg/6g6jirFgMmc0X2u7s4BGuG0+8xmDmy39HINxq+RAwF4UFWtLwwa +zVkPb+O4NW+dxrJFEpkT80ruCm8xXgRmovaztwjWCl+BqQzqGNQLGD1MhyEfSY+QJOM 1+0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749862759; x=1750467559; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A0qHYwMFiOH6/1sQ7RoWME/5UxRgybA/B7mrTzPKlI8=; b=vXz7fnkAnsXUQ17GVr0CIOQVMEH0vZ9nM110syWJo9glor68cxU7S5sh8bSJXEaL1g BFTlqeg3XpWde9eePersJ89h/WcKheThWz3B1ReM74sp3JFOQTCYqdcmsiv2zUIYIycl HDlZZbz9PcF4wE2HwrXCYVT+RptCZwp8fXGI8sA+qL7cNK4wF25bYrGGpTlnWsIcIO9i CkvMrKKKcXWhD1CgpyHRY7GBb6QY5aBjum2lSGUtC6UxwXkEyHtorcQ+E3qfhcXW79rH G68VwQjlUMIp6SIFourA1IcCz4b2iR2hpymNADOWB0mW+i4rkNIuQMl7KUOxeu5RZffL pPjw== X-Gm-Message-State: AOJu0YwHmgrxpEexUnw4tceyMsWkdBS4WENHEchs0eYzL1yy/mvRJk+Y mWcE3EE9vZJ6hc16k9tj7GvKointNrD5m8jN/aNuWKKKmY3kz1+jgOVzG1yAUQ== X-Gm-Gg: ASbGncuneKjdbkCf50TGX6uExitXYnCOVqa+knb8NMS2mGAlmjz7VQ3dLFqPYc8TSd4 UYTT+sId9UbATboJz7lwbx5xBSH3dqhdox1aJ/0jfC0kA7sY814MDsiQCqcm8+B1dbMnThbnD+n a9J/iYiGzMidmYHno46rrSsPq2VWA17NwFKmw2E0QP/VAq7B3Eweud9p//Ix0SnRvrQAHZCATDM 0dOS8BzGaYP2ZoiucKhAK1ziXWFN06ByDsnzU2YePEphUwxaBn24mMDsr+0IQh2k//ioNcb139E kdzh1dgGllyk5Ls9/b9O/CFmp62gIEx59KXS/80wVWUFTmVI+3kwfD6vNWL70wbvjkQ3SdEGMwy GLEgE X-Google-Smtp-Source: AGHT+IHrnRWC/BscTonw7yjqS63G2OfEDbpDFaQwiiPMNB9go+kWBG3VVCQE+8P/oHzs+amE8QEz8w== X-Received: by 2002:a05:6a21:790:b0:215:e1cc:6360 with SMTP id adf61e73a8af0-21fbd52407fmr1883357637.11.1749862758836; Fri, 13 Jun 2025 17:59:18 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-748900b28c4sm2299808b3a.126.2025.06.13.17.59.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jun 2025 17:59:18 -0700 (PDT) Message-Id: In-Reply-To: References: From: ffmpegagent Date: Sat, 14 Jun 2025 00:59:06 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v2 0/6] avformat/segment: Various segment muxer improvements 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: softworkz 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: Includes * Two new options * segment_write_temp Allows to write segments as temp files (.tmp) which are renamed on completion * segment_limit Stop after n segments have been written * some minor changes (option contraints and formatting fixes) Versions ======== V2 == * merge the documentation patch with the feature patch * segment_write_temp: use av_asprintf() directly instead of strlcatf() + av_strdup() (as per review by Marton - thanks!) * removed logging patch . softworkz (6): avformat/segment: Add segment_write_temp option avformat/segment: Add segment_limit option avformat/segment: Remove non-negative constraint from segment_time_delta avformat/segment: Don't allow negative segment duration avformat/segment: Fix typo avformat/segment: Indent and whitespace fixes doc/muxers.texi | 12 ++++++ libavformat/segment.c | 95 +++++++++++++++++++++++++++++-------------- 2 files changed, 76 insertions(+), 31 deletions(-) base-commit: f3bf5356966b4ad9334034e720fa224c2d9464a6 Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-96%2Fsoftworkz%2Fsubmit_segment_muxer-v2 Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-96/softworkz/submit_segment_muxer-v2 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/96 Range-diff vs v1: 1: 0132f3f933 ! 1: 79b4f63573 avformat/segment: Add segment_write_temp option @@ Commit message Signed-off-by: softworkz + ## doc/muxers.texi ## +@@ doc/muxers.texi: argument must be a time duration specification, and defaults to 0. + If enabled, write an empty segment if there are no packets during the period a + segment would usually span. Otherwise, the segment will be filled with the next + packet written. Defaults to @code{0}. ++ ++@item segment_write_temp @var{1|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}). + @end table + + Make sure to require a closed GOP when encoding and to set the GOP + ## libavformat/segment.c ## @@ libavformat/segment.c: typedef struct SegmentContext { int break_non_keyframes; @@ libavformat/segment.c: static int set_segment_filename(AVFormatContext *s) + // Write segment as a temp file and rename on completion + if(seg->segment_write_temp) { -+ av_strlcatf(buf, sizeof(buf), ".tmp"); -+ char *temp_name = av_strdup(buf); ++ char *temp_name = av_asprintf("%s%s", buf, ".tmp"); + if (!temp_name) + return AVERROR(ENOMEM); + ff_format_set_url(oc, temp_name); 2: 2bad7a3acc < -: ---------- doc/muxers: Add documentation for segment_write_temp option 3: 6a76e43900 < -: ---------- avformat/segment: Log more detailed information about written segments 4: 4f05a7d2e9 ! 2: 10b1c22439 avformat/segment: Add segment_limit option @@ Commit message Signed-off-by: softworkz + ## doc/muxers.texi ## +@@ doc/muxers.texi: 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. + @end table + + Make sure to require a closed GOP when encoding and to set the GOP + ## libavformat/segment.c ## @@ libavformat/segment.c: typedef struct SegmentContext { int break_non_keyframes; 5: 53b693320f < -: ---------- doc/muxers: Add documentation for segment_limit option 6: ddf37a882b < -: ---------- avformat/segment: Fix invalid codecpar extradata_size after copying 7: d5def15604 = 3: a855134dc7 avformat/segment: Remove non-negative constraint from segment_time_delta 8: 16cb8ea92b = 4: 33139f28c8 avformat/segment: Don't allow negative segment duration 9: 1348b1b42c = 5: 64451d004a avformat/segment: Fix typo 10: 88a8dc7875 = 6: cb3267591d avformat/segment: Indent and whitespace fixes -- ffmpeg-codebot _______________________________________________ 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".