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 23430405A6 for ; Mon, 27 Jun 2022 01:12:42 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C8D5968B84E; Mon, 27 Jun 2022 04:12:38 +0300 (EEST) Received: from mail-108-mta84.mxroute.com (mail-108-mta84.mxroute.com [136.175.108.84]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D77D668B830 for ; Mon, 27 Jun 2022 04:12:31 +0300 (EEST) Received: from filter006.mxroute.com ([140.82.40.27] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta84.mxroute.com (ZoneMTA) with ESMTPSA id 181a2b785b200095ec.001 for (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Mon, 27 Jun 2022 01:12:25 +0000 X-Zone-Loop: bf35194bb8ea54aeeaf3a74ce8944e3fbe2eedc6d78b X-Originating-IP: [140.82.40.27] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=absolucy.moe; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc: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=XVcECg/ZMb1YRhqxoqM8dMGDcdJVC9pxib56Q0ZyB40=; b=u8OlKk0HeNex5k/xWS4NSEgw2b 2P9j583aD6naGV8VpQPciG7fNCnnRLvi7b4TRuiDs+2IMHGAh4+HG3d3DMAfb7M/RrIVU/vpSFSHx zh8bTjTnwmy7ZwO/25BZZxkL0TrLl/dYPBKPaR0zBdQ+DbrTrGS9rONhl1l6h7wAjt94dglddjfVt JZDX4asTaidsDYIx62lKuGUxfNJjNZ0Q0LuB1aamQTehr5XowEPRv9Bm6mJgILPbsx4XtwQTmoRTy 4GK5VJHiBPDRMY1SCmmuPRQWesrrQudoYYkkHMXuNJvwriRlNgImiPfzgC5LKtqYObZ36RYGYX8/r QMvIadPQ==; From: "Lucy" To: Date: Sun, 26 Jun 2022 21:11:52 -0400 Message-ID: <003901d889c2$f4236250$dc6a26f0$@absolucy.moe> MIME-Version: 1.0 Thread-Index: AdiJsuUzXanEmemRROy6dyzAp0EiGQ== Content-Language: en-us X-AuthUser: lucy@absolucy.moe Subject: [FFmpeg-devel] [PATCH] avformat/hlsenc: Use HLS version 2 if rounded durations are enabled 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: This allows for wider compatibility with older devices, such as those running iOS 3. The only difference between HLS version 2 and version 3 is that version 3 supports non-integer EXTINF values, and as such, we can default to version 2 if we're using whole-integer EXTINFs anyways, when `-hls_flags round_durations` is set. As this code seems to otherwise consistently use the lowest compatible version, this seems to fit in properly with existing behavior. Testing confirms with that this patch, HLS output can work all the way back to iOS 3. This is my first contribution to ffmpeg, so please tell me if I did anything wrong, and I'll try my best to fix it. Signed-off-by: Lucy --- doc/muxers.texi | 2 ++ libavformat/hlsenc.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index b6cafaa5fd..b2f4326aae 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -1060,6 +1060,8 @@ and remove the @code{#EXT-X-ENDLIST} from the old segment list. @item round_durations Round the duration info in the playlist file segment info to integer values, instead of using floating point. +If there are no other features requiring higher HLS versions be used, +then this will allow ffmpeg to output a HLS version 2 m3u8. @item discont_start Add the @code{#EXT-X-DISCONTINUITY} tag to the playlist, before the diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 3bafddfa61..7c097b4bf2 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1550,7 +1550,11 @@ static int hls_window(AVFormatContext *s, int last, VariantStream *vs) double *prog_date_time_p = (hls->flags & HLS_PROGRAM_DATE_TIME) ? &prog_date_time : NULL; int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0); - hls->version = 3; + hls->version = 2; + if (!(hls->flags & HLS_ROUND_DURATIONS)) { + hls->version = 3; + } + if (byterange_mode) { hls->version = 4; sequence = 0; -- 2.36.1 _______________________________________________ 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".