[FFmpeg-trac] #8102(avformat:new): FFmpeg selects unavailable HLS stream

FFmpeg trac at avcodec.org
Wed Aug 28 11:35:44 EEST 2019


#8102: FFmpeg selects unavailable HLS stream
-----------------------------------+----------------------------------
             Reporter:  jaylinski  |                     Type:  defect
               Status:  new        |                 Priority:  normal
            Component:  avformat   |                  Version:  4.2
             Keywords:  hls        |               Blocked By:
             Blocking:             |  Reproduced by developer:  0
Analyzed by developer:  0          |
-----------------------------------+----------------------------------
 == Summary of the bug: ==

 FFmpeg can handle HLS streams (https://tools.ietf.org/html/rfc8216) via
 m3u8 files.
 A master file contains info on available streams and can look like this:

 {{{
 #EXTM3U
 #EXT-X-INDEPENDENT-SEGMENTS
 #EXT-X-STREAM-INF:CLOSED-CAPTIONS=NONE,BANDWIDTH=644706,AVERAGE-
 BANDWIDTH=556000,RESOLUTION=640x360,FRAME-
 RATE=24.000,CODECS="avc1.64081E,mp4a.40.2"
 ../1426858145/playlist.m3u8
 #EXT-X-STREAM-INF:CLOSED-CAPTIONS=NONE,BANDWIDTH=13172611,AVERAGE-
 BANDWIDTH=4557000,RESOLUTION=1920x1080,FRAME-RATE=24.000,VIDEO-
 RANGE="SDR",CODECS="av01.0.13M.08.0.111.01.01.01.0,mp4a.40.2"
 ../1436130848/playlist.m3u8
 #EXT-X-STREAM-INF:CLOSED-CAPTIONS=NONE,BANDWIDTH=6066970,AVERAGE-
 BANDWIDTH=4992000,RESOLUTION=1920x1080,FRAME-
 RATE=24.000,CODECS="avc1.640828,mp4a.40.2"
 ../1426858148/playlist.m3u8
 }}}

 Even though the HLS specification says that all proposed streams must be
 available, a proposed stream can become unavailable (eg when the HLS
 server has an issue).

 In case of the example above, FFmpeg selects the av1 encoded stream. (I am
 aware that AV1 decoding has to be enabled with libaom or libdav1d). But
 the segments from the m3u8 file will return 404 HTTP errors, because the
 Vimeo HLS server can not yet handle av1 encoded videos. This results in
 FFmpeg stopping the playback.

 Microsoft Edge handles this differently and can play the HLS stream, by
 not switching to unavailable streams.

 == How to reproduce: ==

 1. Open https://player.vimeo.com/video/351678382/config
 2. Copy the HLS master playlist referenced in the JSON (request > files >
 hls > cdns > xxx > url)
 3. Open the HLS master playlist with ffplay

 == Debug log: ==

 {{{
 ffplay https://183skyfiregce-
 vimeo.akamaized.net/exp\=1566984057\~acl\=%2F351678382%2F%2A\~hmac\=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1426858145,1436119658,1436130849,1436130848,1436119661,1436119657,1426858149,1426858148,1426858147,1426858146/master.m3u8
 ffplay version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2003-2019 the FFmpeg
 developers
   built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
   configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1
 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
 --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping
 --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa
 --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
 --enable-libcdio --enable-libflite --enable-libfontconfig --enable-
 libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-
 libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt
 --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg
 --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex
 --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis
 --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265
 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi
 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-
 libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint
 --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
   libavutil      55. 78.100 / 55. 78.100
   libavcodec     57.107.100 / 57.107.100
   libavformat    57. 83.100 / 57. 83.100
   libavdevice    57. 10.100 / 57. 10.100
   libavfilter     6.107.100 /  6.107.100
   libavresample   3.  7.  0 /  3.  7.  0
   libswscale      4.  8.100 /  4.  8.100
   libswresample   2.  9.100 /  2.  9.100
   libpostproc    54.  7.100 / 54.  7.100
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1426858145/playlist.m3u8'
 for reading
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/playlist.m3u8'
 for reading
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436130849/playlist.m3u8'
 for reading
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436130848/playlist.m3u8'
 for reading
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119661/playlist.m3u8'
 for reading
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119657/playlist.m3u8'
 for reading
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1426858149/playlist.m3u8'
 for reading
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1426858148/playlist.m3u8'
 for reading
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1426858147/playlist.m3u8'
 for reading
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1426858146/playlist.m3u8'
 for reading
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1426858145/chop/segment-1.ts'
 for reading
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-1.ts'
 for reading
 [https @ 0x7f0560440760] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-2.ts'
 for reading
 [https @ 0x7f0560a87aa0] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-3.ts'
 for reading
 [https @ 0x7f0560803f60] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-4.ts'
 for reading
 [https @ 0x7f0560815580] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-5.ts'
 for reading
 [https @ 0x7f0560825040] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-6.ts'
 for reading
 [https @ 0x7f0560770300] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-7.ts'
 for reading
 [https @ 0x7f05608d8860] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-8.ts'
 for reading
 [https @ 0x7f0560836700] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-9.ts'
 for reading
 [https @ 0x7f0560449040] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-10.ts'
 for reading
 [https @ 0x7f05609842e0] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-11.ts'
 for reading
 [https @ 0x7f05609ab600] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-12.ts'
 for reading
 [https @ 0x7f05609cd040] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-13.ts'
 for reading
 [https @ 0x7f0560a768e0] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-14.ts'
 for reading
 [https @ 0x7f0560752e60] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-15.ts'
 for reading
 [https @ 0x7f05608f5320] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-16.ts'
 for reading
 [https @ 0x7f0560737200] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-17.ts'
 for reading
 [https @ 0x7f0560a17ee0] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-18.ts'
 for reading
 [https @ 0x7f05608f48a0] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-19.ts'
 for reading
 [https @ 0x7f0560449040] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-20.ts'
 for reading
 [https @ 0x7f056085c200] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-21.ts'
 for reading
 [https @ 0x7f05607e84c0] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-22.ts'
 for reading
 [https @ 0x7f0560904c40] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-23.ts'
 for reading
 [https @ 0x7f0560904e60] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-24.ts'
 for reading
 [https @ 0x7f0560738140] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-25.ts'
 for reading
 [https @ 0x7f05607fae00] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Opening 'https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-26.ts'
 for reading
 [https @ 0x7f0560707b80] HTTP error 404 Not Found sq=    0B f=0/0
 [hls,applehttp @ 0x7f0560000b80] Failed to open segment of playlist 1
 [hls,applehttp @ 0x7f0560000b80] Error when loading first segment 'https
 ://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1436119658/chop/segment-1.ts'
 https://183skyfiregce-
 vimeo.akamaized.net/exp=1566984057~acl=%2F351678382%2F%2A~hmac=ffc5dc761c7011181bea093b31615e6c9900a7bb1d29ab9e930037c103ab48b7/351678382/video/1426858145,1436119658,1436130849,1436130848,1436119661,1436119657,1426858149,1426858148,1426858147,1426858146/master.m3u8:
 Invalid data found when processing input
 }}}

 I also reproduced the problem with the current 4.2 release.

 == Possible fix: ==

 Check if a stream returns a 2xx HTTP status code before selecting it.
 I guess this has to be done somewhere in
 https://github.com/FFmpeg/FFmpeg/blob/release/4.2/libavformat/hls.c. If
 you can point me to the right line, I'll try to submit a fix.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/8102>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list