Opened 12 years ago

Closed 5 years ago

#2617 closed defect (fixed)

Playback of HLS fails when one of the variant streams are down

Reported by: Kyle Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: hls
Cc: denim2x@cyberdude.com Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:
In cases of poorly managed HLS streams where one of the variant streams inside the m3u8 playlist are down, ffmpeg fails to play as soon as it sees a 404 error for one of the variant streams, while iOS ignores the dead stream and just plays it with the ones that work.
How to reproduce:

ffmpeg -i http://telly.powerrangermail.net/hlstest/playlist.m3u8
ffmpeg version N-53690-g2886e80 Copyright (c) 2000-2013 the FFmpeg developers
  built on May 30 2013 15:49:51 with gcc 4.7 (Ubuntu/Linaro 4.7.3-1ubuntu1)
  configuration: --prefix=/usr --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-postproc --enable-libx264 --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libdc1394 --enable-libmp3lame --enable-libtheora --enable-libopenjpeg --enable-libvpx --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libvorbis --enable-libxvid --enable-libfaac --cpu=amdfam10 --enable-x11grab --enable-libxavs --enable-libfreetype --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libcelt --enable-openal --enable-libcdio --enable-libaacplus --enable-libmodplug --enable-libpulse --enable-openssl --enable-libv4l2 --enable-libass --enable-libbluray --enable-avresample --enable-libiec61883 --enable-libopus --enable-libcaca --enable-libfdk-aac --enable-libilbc --enable-libtwolame --enable-librtmp --enable-libsoxr --disable-stripping --enable-libaacplus --enable-opencl --enable-libflite --enable-libquvi
  libavutil      52. 34.100 / 52. 34.100
  libavcodec     55. 12.102 / 55. 12.102
  libavformat    55.  8.100 / 55.  8.100
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 73.100 /  3. 73.100
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[http @ 0xf8d2c0] HTTP error 404 Not Found
http://telly.powerrangermail.net/hlstest/playlist.m3u8: Input/output error

Since the stream in question that I use is only available weekdays for one hour a day, the output above is with a sample I created that intentionally has the same error so you can reproduce.

Change History (9)

comment:1 by Carl Eugen Hoyos, 12 years ago

Keywords: hls added
Reproduced by developer: set
Status: newopen

comment:2 by gorilla.maguila, 8 years ago

The issue is still reproducible with latest git:

ffplay http://amd.cdn.turner.com/adultswim/big/streams/playlists/toonami.m3u8 -loglevel debug
ffplay version N-85461-gcd8e62746f Copyright (c) 2003-2017 the FFmpeg developers
  built with gcc 6.3.1 (GCC) 20170306
  configuration: --prefix=/usr --disable-debug --disable-static --enable-avisynth --enable-avresample --enable-fontconfig --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libfdk-aac --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-nonfree --enable-shared --enable-version3
  libavutil      55. 61.100 / 55. 61.100
  libavcodec     57. 92.100 / 57. 92.100
  libavformat    57. 72.100 / 57. 72.100
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 84.101 /  6. 84.101
  libavresample   3.  6.  0 /  3.  6.  0
  libswscale      4.  7.100 /  4.  7.100
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
[http @ 0x7faedc0012c0] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
[http @ 0x7faedc0012c0] request: GET /adultswim/big/streams/playlists/toonami.m3u8 HTTP/1.1                                                                                                              
User-Agent: Lavf/57.72.100                                                                                                                                                                               
Accept: */*                                                                                                                                                                                              
Range: bytes=0-                                                                                                                                                                                          
Connection: close                                                                                                                                                                                        
Host: amd.cdn.turner.com                                                                                                                                                                                 
Icy-MetaData: 1                                                                                                                                                                                          


[hls,applehttp @ 0x7faedc000920] Format hls,applehttp probed with size=2048 and score=100                                                                                                                
[http @ 0x7faedc005cc0] request: GET /hls/live/249295/adultswim_6/main/1/stream_Layer1.m3u8 HTTP/1.1                                                                                                     
User-Agent: Lavf/57.72.100                                                                                                                                                                               
Accept: */*                                                                                                                                                                                              
Connection: close                                                                                                                                                                                        
Host: adultswimhls-i.akamaihd.net                                                                                                                                                                        
Icy-MetaData: 1                                                                                                                                                                                          


[http @ 0x7faedc005cc0] HTTP error 403 ForbiddenB sq=    0B f=0/0   
[AVIOContext @ 0x7faedc004160] Statistics: 1780 bytes read, 0 seeks
http://amd.cdn.turner.com/adultswim/big/streams/playlists/toonami.m3u8: Server returned 403 Forbidden (access denied)

Other player such as vlc can handle the stream:

vlc http://amd.cdn.turner.com/adultswim/big/streams/playlists/toonami.m3u8
VLC media player 2.2.4 Weatherwax (revision 2.2.3-37-g888b7e89)
[0000000000e64148] core libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[00007fa6a8005ed8] httplive stream: HTTP Live Streaming (amd.cdn.turner.com/adultswim/big/streams/playlists/toonami.m3u8)
[00007fa6a8005888] http access error: error: HTTP/1.1 403 Forbidden
[00007fa6a8005888] http access error: error: HTTP/1.0 403 Forbidden
[00007fa6a8005888] access_mms access error: error: HTTP/1.0 403 Forbidden
[00007fa6a8005ed8] core stream error: no suitable access module for `http://adultswimhls-i.akamaihd.net/hls/live/249295/adultswim_6/main/1/stream_Layer1.m3u8'
[00007fa6a8c07728] http access error: error: HTTP/1.1 403 Forbidden
[00007fa6a8c07728] http access error: error: HTTP/1.0 403 Forbidden
[00007fa6a8c07728] access_mms access error: error: HTTP/1.0 403 Forbidden
[00007fa6a8005ed8] core stream error: no suitable access module for `http://adultswimhls-i.akamaihd.net/hls/live/249295/adultswim_6/main/1/stream_Layer2.m3u8'
[00007fa6a8c07d88] http access error: error: HTTP/1.1 403 Forbidden
[00007fa6a8c07d88] http access error: error: HTTP/1.0 403 Forbidden
[00007fa6a8c07d88] access_mms access error: error: HTTP/1.0 403 Forbidden
[00007fa6a8005ed8] core stream error: no suitable access module for `http://adultswimhls-i.akamaihd.net/hls/live/249295/adultswim_6/main/1/stream_Layer3.m3u8'
[00007fa6a8c094f8] http access error: error: HTTP/1.1 403 Forbidden
[00007fa6a8c094f8] http access error: error: HTTP/1.0 403 Forbidden
[00007fa6a8c094f8] access_mms access error: error: HTTP/1.0 403 Forbidden
[00007fa6a8005ed8] core stream error: no suitable access module for `http://adultswimhls-i.akamaihd.net/hls/live/249295/adultswim_6/main/1/stream_Layer4.m3u8'
[00007fa6a8c0a1b8] http access error: error: HTTP/1.1 403 Forbidden
[00007fa6a8c0a1b8] http access error: error: HTTP/1.0 403 Forbidden
[00007fa6a8c0a1b8] access_mms access error: error: HTTP/1.0 403 Forbidden
[00007fa6a8005ed8] core stream error: no suitable access module for `http://adultswimhls-i.akamaihd.net/hls/live/249295/adultswim_6/main/1/stream_Layer5.m3u8'
[00007fa6a8c0abb8] ts demux: MPEG-4 descriptor not found for pid 0x1e2 type 0xf
[00007fa6a8de55d8] packetizer_mpeg4audio packetizer: AAC channels: 1 samplerate: 22050
[00007fa6a8c991a8] avcodec decoder: Using G3DVL VDPAU Driver Shared Library version 1.0 for hardware decoding.

Url for testing http://amd.cdn.turner.com/adultswim/big/streams/playlists/toonami.m3u8

comment:4 by denim2x, 8 years ago

@gorilla.maguila I made a patch causing libavformat to skip some parsing errors related to M3U - let me know if you have any other issues with FFmpeg http://www.smiley.com/sites/default/files/image/cover/Happy.png

Last edited 8 years ago by denim2x (previous) (diff)

comment:5 by denim2x, 8 years ago

Cc: denim2x@cyberdude.com added

in reply to:  4 comment:6 by gorilla.maguila, 8 years ago

Replying to denim2x:

@gorilla.maguila I made a patch causing libavformat to skip some errors related to M3U - let me know if you have any other issues with FFmpeg http://www.smiley.com/sites/default/files/image/cover/Happy.png

If the patch is accepted upstream we will gladly grant you the bounty. Thanks

comment:7 by gorilla.maguila, 8 years ago

Last edited 8 years ago by gorilla.maguila (previous) (diff)

comment:8 by Carl Eugen Hoyos, 6 years ago

I don't think this patch works, at least not with current FFmpeg git head (5d958f09):
If one of the playlists that were searched for was not found, the corresponding structure exists but contains invalid data which leads to a crash. This cannot be tested with above link as it needs an url for testing with at least one working playlist (and at least one failing).

comment:9 by Kyle, 5 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.