Message ID | 003901d889c2$f4236250$dc6a26f0$@absolucy.moe |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel] avformat/hlsenc: Use HLS version 2 if rounded durations are enabled | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
yinshiyou/configure_loongarch64 | warning | Failed to apply patch |
andriy/make_armv7_RPi4 | success | Make finished |
andriy/make_fate_armv7_RPi4 | success | Make fate finished |
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
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
<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
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
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; + } +
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(-) if (byterange_mode) { hls->version = 4; sequence = 0;