Opened 4 years ago

Closed 4 years ago

#8434 closed defect (wontfix)

ffmpeg hangs reading HLS

Reported by: longkas Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
Hello,
I try to use ffmpeg to read live HLS stream but ffmpeg hangs and will not exit when the segments do not exist, I expect ffmpeg exits with error, how can I achieve that, I tried the -timeout but no luck. I can reproduce this issue with ffmpeg version 4.2.1 and version 3.4.7.

How to reproduce:

# ffmpeg -re -i http://fftest.kda.io/prod.m3u8 xx.mp4 
ffmpeg version 3.4.7 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-39)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro ' --extra-cflags=' ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcdio --enable-libdrm --enable-indev=jack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --disable-encoder=libopus --enable-libpulse --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzvbi --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect
  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 @ 0x1aa1900] Opening 'http://fftest.kda.io/prod-7023.ts' for reading
[http @ 0x1aa8ce0] HTTP error 404 Not Found
[hls,applehttp @ 0x1aa1900] Failed to open segment of playlist 0
[hls,applehttp @ 0x1aa1900] Opening 'http://fftest.kda.io/prod-7024.ts' for reading
[http @ 0x1aa8dc0] HTTP error 404 Not Found
[hls,applehttp @ 0x1aa1900] Failed to open segment of playlist 0
[hls,applehttp @ 0x1aa1900] Opening 'http://fftest.kda.io/prod-7025.ts' for reading
[http @ 0x1aac3e0] HTTP error 404 Not Found
[hls,applehttp @ 0x1aa1900] Failed to open segment of playlist 0


Change History (2)

comment:1 by Carl Eugen Hoyos, 4 years ago

Is the issue reproducible with current FFmpeg git head?

comment:2 by Steven Liu, 4 years ago

Resolution: wontfix
Status: newclosed

Look at the hls m3u8 content:

StevenLiu:dash StevenLiu$ curl http://fftest.kda.io/prod.m3u8
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-ALLOW-CACHE:YES
#EXT-X-MEDIA-SEQUENCE:7022
#EXT-X-TARGETDURATION:11
#EXTINF:10.019, no desc
prod-7022.ts
#EXTINF:10.002, no desc
prod-7023.ts
#EXTINF:10.007, no desc
prod-7024.ts
#EXTINF:10.005, no desc
prod-7025.ts
StevenLiu:dash StevenLiu$

It have no EXT-X-ENDLIST,so it should be a live streaming m3u8,

you can try the -m3u8_hold_counters options by the master git head,
this option will terminate ffmpeg by refresh m3u8 without new segments.

StevenLiu:dash StevenLiu$ ./ffplay -m3u8_hold_counters 3 http://fftest.kda.io/prod.m3u8
ffplay version N-96078-g9fe07908c3 Copyright (c) 2003-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --enable-libass --enable-opengl --enable-libx264 --enable-libmp3lame --enable-gpl --enable-nonfree --prefix=/usr/local --enable-libtesseract --enable-libspeex --enable-libfreetype --enable-libfontconfig --enable-libfdk-aac --enable-videotoolbox --enable-libxml2 --enable-librsvg --enable-libvmaf --enable-version3 --disable-stripping --disable-optimizations --enable-libvmaf
  libavutil      56. 36.101 / 56. 36.101
  libavcodec     58. 65.100 / 58. 65.100
  libavformat    58. 35.101 / 58. 35.101
  libavdevice    58.  9.101 / 58.  9.101
  libavfilter     7. 68.101 /  7. 68.101
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
[hls @ 0x7fa547846e00] Skip ('#EXT-X-VERSION:3')B sq=    0B f=0/0
[hls @ 0x7fa547846e00] Skip ('#EXT-X-ALLOW-CACHE:YES')
[hls @ 0x7fa547846e00] Opening 'http://fftest.kda.io/prod-7023.ts' for reading
[http @ 0x7fa546445a80] HTTP error 404 Not FoundB sq=    0B f=0/0
[hls @ 0x7fa547846e00] Failed to open segment 7023 of playlist 0
[hls @ 0x7fa547846e00] Opening 'http://fftest.kda.io/prod-7024.ts' for reading
[http @ 0x7fa54807db40] HTTP error 404 Not FoundB sq=    0B f=0/0
[hls @ 0x7fa547846e00] Failed to open segment 7024 of playlist 0
[hls @ 0x7fa547846e00] Opening 'http://fftest.kda.io/prod-7025.ts' for reading
[http @ 0x7fa5465a1a40] HTTP error 404 Not FoundB sq=    0B f=0/0
[hls @ 0x7fa547846e00] Failed to open segment 7025 of playlist 0
[hls @ 0x7fa547846e00] Skip ('#EXT-X-VERSION:3')B sq=    0B f=0/0
[hls @ 0x7fa547846e00] Skip ('#EXT-X-ALLOW-CACHE:YES')
[http @ 0x7fa5468b4800] Opening 'http://fftest.kda.io/prod.m3u8' for reading
[hls @ 0x7fa547846e00] Skip ('#EXT-X-VERSION:3')B sq=    0B f=0/0
[hls @ 0x7fa547846e00] Skip ('#EXT-X-ALLOW-CACHE:YES')
[http @ 0x7fa5468b4800] Opening 'http://fftest.kda.io/prod.m3u8' for reading
[hls @ 0x7fa547846e00] Skip ('#EXT-X-VERSION:3')B sq=    0B f=0/0
[hls @ 0x7fa547846e00] Skip ('#EXT-X-ALLOW-CACHE:YES')
[hls @ 0x7fa547846e00] Error when loading first segment 'http://fftest.kda.io/prod-7022.ts'
http://fftest.kda.io/prod.m3u8: Invalid data found when processing input

Note: See TracTickets for help on using tickets.