Opened 3 years ago

Closed 3 years ago

#8380 closed defect (invalid)


Reported by: Simon Blandford Owned by:
Priority: normal Component: avformat
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:
If the hls_time < 0.5 then EXT-X-TARGETDURATION is 0. This results in an invalid condition that prevents HLS players from working.

From RFC 8216:

"The EXT-X-TARGETDURATION tag specifies the maximum Media Segment duration. The EXTINF duration of each Media Segment in the Playlistfile, when rounded to the nearest integer, MUST be less than or equal to the target duration; longer segments can trigger playback stalls or other errors."

When EXT-X-TARGETDURATION is 0 then the condition, "MUST be less than or equal to the target duration", is never met.

In these conditions the capital word "MUST" implies that the requirement to "be less than or equal to the target duration" is a higher priority than "rounded to the nearest integer" and therefore represents a special case.

Bumping any EXT-X-TARGETDURATION:0 to EXT-X-TARGETDURATION:1 allows HLS players such as hls.js and Android's <audio> tag to play OK, otherwise they don't.

How to reproduce:

ffmpeg -re -f lavfi -i "sine=frequency=1000" -c:a aac -ar 44100 -ac 1 -b:a 64k -hls_time 0.2 -hls_list_size 5 -hls_flags delete_segments out.m3u8

ffmpeg-static -version
ffmpeg version N-95730-ga7245adee3 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
configuration: --prefix=/home/simonb/Documents/Source/ffmpeg/static_build --logfile=config.log --extra-cflags=-I/home/simonb/Documents/Source/ffmpeg/static_build/include --extra-ldflags=-L/home/simonb/Documents/Source/ffmpeg/static_build/lib --extra-ldexeflags=-static --pkg-config-flags=--static --disable-shared --enable-static --disable-all --disable-dxva2 --disable-vaapi --disable-vdpau --enable-network --enable-ffmpeg --enable-pthreads --enable-runtime-cpudetect --enable-libopus --enable-libmp3lame --enable-alsa --enable-indev='alsa,lavfi' --enable-parser='opus,mpegaudio,aac,aac_latm' --enable-muxer='hls,opus,mp3,segment' --enable-demuxer='ogg,mp3,aac,aac_latm,pcm_*' --enable-encoder='libopus,libmp3lame,aac,libfdk_aac' --enable-filter='aresample,sine' --enable-decoder='libopus,opus,mp3,mp3float,libfdk_aac,pcm_*' --enable-protocol='file,unix,hls,tcp,udp,rtp,http,pipe' --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --enable-swresample --enable-libfdk-aac

Change History (2)

comment:1 by Simon Blandford, 3 years ago

I just realised that if I set hls_time to, say, 1.2 then EXT-X-TARGETDURATION is 1 and therefore still less than that the segment duration. So it is more than just <0.5 being invalid, it applies to any segment length between n and n.5 where n > than its integer.

comment:2 by Simon Blandford, 3 years ago

Resolution: invalid
Status: newclosed

Sorry. I got my wires crossed. RFC 8216 is simply saying that all the segments in the list must be within the EXT-X-TARGETDURATION value /after/ each segment duration has been rounded.

Self-closing ticket with apologies.

Note: See TracTickets for help on using tickets.