* [FFmpeg-devel] [PATCH] avformat/hlsenc: Use HLS version 2 if rounded durations are enabled
@ 2022-06-27 1:11 Lucy
2022-06-27 2:17 ` Steven Liu
0 siblings, 1 reply; 5+ messages in thread
From: Lucy @ 2022-06-27 1:11 UTC (permalink / raw)
To: ffmpeg-devel
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 <lucy@absolucy.moe>
---
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Use HLS version 2 if rounded durations are enabled
2022-06-27 1:11 [FFmpeg-devel] [PATCH] avformat/hlsenc: Use HLS version 2 if rounded durations are enabled Lucy
@ 2022-06-27 2:17 ` Steven Liu
2022-06-27 2:27 ` lucy
0 siblings, 1 reply; 5+ messages in thread
From: Steven Liu @ 2022-06-27 2:17 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Lucy <lucy@absolucy.moe> 于2022年6月27日周一 09:12写道:
>
> 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 <lucy@absolucy.moe>
> ---
> 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;
Do you mean the functions which support from version 3 but not use
HLS_ROUND_DURATIONS should use 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".
Thanks
Steven
_______________________________________________
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Use HLS version 2 if rounded durations are enabled
2022-06-27 2:17 ` Steven Liu
@ 2022-06-27 2:27 ` lucy
2022-06-27 2:44 ` Steven Liu
0 siblings, 1 reply; 5+ messages in thread
From: lucy @ 2022-06-27 2:27 UTC (permalink / raw)
To: 'FFmpeg development discussions and patches'
Yes. Version 3 is just Version 2 with floating point durations.
-----Original Message-----
From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Steven Liu
Sent: Sunday, June 26, 2022 10:17 PM
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Use HLS version 2 if rounded durations are enabled
Lucy <lucy@absolucy.moe> 于2022年6月27日周一 09:12写道:
>
> 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 <lucy@absolucy.moe>
> ---
> 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;
Do you mean the functions which support from version 3 but not use HLS_ROUND_DURATIONS should use 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".
Thanks
Steven
_______________________________________________
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".
_______________________________________________
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Use HLS version 2 if rounded durations are enabled
2022-06-27 2:27 ` lucy
@ 2022-06-27 2:44 ` Steven Liu
2022-06-29 4:18 ` Steven Liu
0 siblings, 1 reply; 5+ messages in thread
From: Steven Liu @ 2022-06-27 2:44 UTC (permalink / raw)
To: FFmpeg development discussions and patches
<lucy@absolucy.moe> 于2022年6月27日周一 10:28写道:
>
> Yes. Version 3 is just Version 2 with floating point durations.
LGTM
>
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Steven Liu
> Sent: Sunday, June 26, 2022 10:17 PM
> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Use HLS version 2 if rounded durations are enabled
>
> Lucy <lucy@absolucy.moe> 于2022年6月27日周一 09:12写道:
> >
> > 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 <lucy@absolucy.moe>
> > ---
> > 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;
> Do you mean the functions which support from version 3 but not use HLS_ROUND_DURATIONS should use 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".
>
> Thanks
> Steven
> _______________________________________________
> 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".
>
> _______________________________________________
> 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".
Thanks
Steven
_______________________________________________
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Use HLS version 2 if rounded durations are enabled
2022-06-27 2:44 ` Steven Liu
@ 2022-06-29 4:18 ` Steven Liu
0 siblings, 0 replies; 5+ messages in thread
From: Steven Liu @ 2022-06-29 4:18 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Steven Liu <lingjiujianke@gmail.com> 于2022年6月27日周一 10:44写道:
>
> <lucy@absolucy.moe> 于2022年6月27日周一 10:28写道:
> >
> > Yes. Version 3 is just Version 2 with floating point durations.
> LGTM
Will apply soon.
Thanks
Steven
_______________________________________________
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-06-29 4:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-27 1:11 [FFmpeg-devel] [PATCH] avformat/hlsenc: Use HLS version 2 if rounded durations are enabled Lucy
2022-06-27 2:17 ` Steven Liu
2022-06-27 2:27 ` lucy
2022-06-27 2:44 ` Steven Liu
2022-06-29 4:18 ` Steven Liu
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git