Opened 8 weeks ago

#7516 new defect

ffmpeg 3.4.4-0ubuntu0.18.04.1 and n4.0.2 hls timeout not working

Reported by: mvasi90 Owned by:
Priority: normal Component: ffmpeg
Version: 3.4 Keywords: rw_timeout
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I'm trying to download from hls url (m3u8) and save it to mkv (or mp4) file.
I'm using -rw_timeout 3000000 (3 seconds) and I'm simulating a network disconnection with

sudo rfkill block all

This cause ffmpeg to wait forever. I want ffmpeg to close if no response after a period of time.

How to reproduce:

% ffmpeg -rw_timeout 3000000 -v 9 -loglevel 99 -i https://web.server.com/playlist.m3u8 -c copy a.mkv
Two versions tested:

ffmpeg version n4.0.2
built with gcc 8.2.1 (GCC) 20180831

ffmpeg version 3.4.4-0ubuntu0.18.04.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)

Output:

[username@PC]$ ffmpeg -rw_timeout 3000000 -v 9 -loglevel 99 -i https://web.server.com/playlist.m3u8 -c copy a.mkv
ffmpeg version n4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20180831
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Splitting the commandline.
Reading option '-rw_timeout' ... matched as AVOption 'rw_timeout' with argument '3000000'.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-i' ... matched as input url with argument 'https://web.server.com/playlist.m3u8'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'a.mkv' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input url https://web.server.com/playlist.m3u8.
Successfully parsed a group of options.
Opening an input file: https://web.server.com/playlist.m3u8.
[NULL @ 0x558c32f88480] Opening 'https://web.server.com/playlist.m3u8' for reading
[https @ 0x558c32f89000] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
[https @ 0x558c32f89000] request: GET /playlist.m3u8 HTTP/1.1
User-Agent: Lavf/58.12.100
Accept: */*
Range: bytes=0-
Connection: close
Host: web.server.com
Icy-MetaData: 1


[https @ 0x558c32f89000] header='HTTP/1.1 206 Partial Content'
[https @ 0x558c32f89000] http_code=206
[https @ 0x558c32f89000] header='Server: nginx'
[https @ 0x558c32f89000] header='Date: Wed, 24 Oct 2018 18:38:37 GMT'
[https @ 0x558c32f89000] header='Content-Type: application/vnd.apple.mpegurl'
[https @ 0x558c32f89000] header='Content-Length: 621'
[https @ 0x558c32f89000] header='Connection: close'
[https @ 0x558c32f89000] header='Vary: Accept-Encoding'
[https @ 0x558c32f89000] header='Access-Control-Expose-Headers: Date, Server, Content-Type, Content-Length'
[https @ 0x558c32f89000] header='Cache-Control: no-cache'
[https @ 0x558c32f89000] header='Access-Control-Allow-Origin: *'
[https @ 0x558c32f89000] header='Access-Control-Allow-Credentials: true'
[https @ 0x558c32f89000] header='Access-Control-Allow-Methods: OPTIONS, GET, POST, HEAD'
[https @ 0x558c32f89000] header='Access-Control-Allow-Headers: Content-Type, User-Agent, If-Modified-Since, Cache-Control, Range'
[https @ 0x558c32f89000] header='X-Cache-Status: HIT'
[https @ 0x558c32f89000] header='Content-Range: bytes 0-620/621'
[https @ 0x558c32f89000] header=''
Probing hls,applehttp score:100 size:621
[hls,applehttp @ 0x558c32f88480] Format hls,applehttp probed with size=2048 and score=100
[hls,applehttp @ 0x558c32f88480] Opening 'https://web.server.com/chunklist_w367960315_b448000.m3u8' for reading
[https @ 0x558c335c1140] request: GET /chunklist_w367960315_b448000.m3u8 HTTP/1.1
User-Agent: Lavf/58.12.100
Accept: */*
Connection: keep-alive
Host: web.server.com
Icy-MetaData: 1


[https @ 0x558c335c1140] header='HTTP/1.1 200 OK'
[https @ 0x558c335c1140] http_code=200
[https @ 0x558c335c1140] header='Server: nginx'
[https @ 0x558c335c1140] header='Date: Wed, 24 Oct 2018 18:38:38 GMT'
[https @ 0x558c335c1140] header='Content-Type: application/vnd.apple.mpegurl'
[https @ 0x558c335c1140] header='Content-Length: 220'
[https @ 0x558c335c1140] header='Connection: keep-alive'
[https @ 0x558c335c1140] header='Vary: Accept-Encoding'
[https @ 0x558c335c1140] header='Access-Control-Expose-Headers: Date, Server, Content-Type, Content-Length'
[https @ 0x558c335c1140] header='Cache-Control: no-cache'
[https @ 0x558c335c1140] header='Access-Control-Allow-Origin: *'
[https @ 0x558c335c1140] header='Access-Control-Allow-Credentials: true'
[https @ 0x558c335c1140] header='Access-Control-Allow-Methods: OPTIONS, GET, POST, HEAD'
[https @ 0x558c335c1140] header='Access-Control-Allow-Headers: Content-Type, User-Agent, If-Modified-Since, Cache-Control, Range'
[https @ 0x558c335c1140] header='X-Cache-Status: HIT'
[https @ 0x558c335c1140] header='Accept-Ranges: bytes'
[https @ 0x558c335c1140] header=''
[https @ 0x558c335ca940] Opening 'https://web.server.com/chunklist_w367960315_b848000.m3u8' for reading
[https @ 0x558c335c1140] request: GET /chunklist_w367960315_b848000.m3u8 HTTP/1.1
User-Agent: Lavf/58.12.100
Accept: */*
Connection: keep-alive
Host: web.server.com
Icy-MetaData: 1


[https @ 0x558c335c1140] header='HTTP/1.1 200 OK'
[https @ 0x558c335c1140] http_code=200
[https @ 0x558c335c1140] header='Server: nginx'
[https @ 0x558c335c1140] header='Date: Wed, 24 Oct 2018 18:38:39 GMT'
[https @ 0x558c335c1140] header='Content-Type: application/vnd.apple.mpegurl'
[https @ 0x558c335c1140] header='Content-Length: 220'
[https @ 0x558c335c1140] header='Connection: keep-alive'
[https @ 0x558c335c1140] header='Vary: Accept-Encoding'
[https @ 0x558c335c1140] header='Access-Control-Expose-Headers: Date, Server, Content-Type, Content-Length'
[https @ 0x558c335c1140] header='Cache-Control: no-cache'
[https @ 0x558c335c1140] header='Access-Control-Allow-Origin: *'
[https @ 0x558c335c1140] header='Access-Control-Allow-Credentials: true'
[https @ 0x558c335c1140] header='Access-Control-Allow-Methods: OPTIONS, GET, POST, HEAD'
[https @ 0x558c335c1140] header='Access-Control-Allow-Headers: Content-Type, User-Agent, If-Modified-Since, Cache-Control, Range'
[https @ 0x558c335c1140] header='X-Cache-Status: HIT'
[https @ 0x558c335c1140] header='Accept-Ranges: bytes'
[https @ 0x558c335c1140] header=''
[https @ 0x558c335ca940] Opening 'https://web.server.com/chunklist_w367960315_b1148000.m3u8' for reading
[https @ 0x558c335c1140] request: GET /chunklist_w367960315_b1148000.m3u8 HTTP/1.1
User-Agent: Lavf/58.12.100
Accept: */*
Connection: keep-alive
Host: web.server.com
Icy-MetaData: 1


[https @ 0x558c335c1140] header='HTTP/1.1 200 OK'
[https @ 0x558c335c1140] http_code=200
[https @ 0x558c335c1140] header='Server: nginx'
[https @ 0x558c335c1140] header='Date: Wed, 24 Oct 2018 18:38:39 GMT'
[https @ 0x558c335c1140] header='Content-Type: application/vnd.apple.mpegurl'
[https @ 0x558c335c1140] header='Content-Length: 223'
[https @ 0x558c335c1140] header='Connection: keep-alive'
[https @ 0x558c335c1140] header='Vary: Accept-Encoding'
[https @ 0x558c335c1140] header='Access-Control-Expose-Headers: Date, Server, Content-Type, Content-Length'
[https @ 0x558c335c1140] header='Cache-Control: no-cache'
[https @ 0x558c335c1140] header='Access-Control-Allow-Origin: *'
[https @ 0x558c335c1140] header='Access-Control-Allow-Credentials: true'
[https @ 0x558c335c1140] header='Access-Control-Allow-Methods: OPTIONS, GET, POST, HEAD'
[https @ 0x558c335c1140] header='Access-Control-Allow-Headers: Content-Type, User-Agent, If-Modified-Since, Cache-Control, Range'
[https @ 0x558c335c1140] header='X-Cache-Status: HIT'
[https @ 0x558c335c1140] header='Accept-Ranges: bytes'
[https @ 0x558c335c1140] header=''
[https @ 0x558c335ca940] Opening 'https://web.server.com/chunklist_w367960315_b1896000.m3u8' for reading
[https @ 0x558c335c1140] request: GET /chunklist_w367960315_b1896000.m3u8 HTTP/1.1
User-Agent: Lavf/58.12.100
Accept: */*
Connection: keep-alive
Host: web.server.com
Icy-MetaData: 1


[https @ 0x558c335c1140] header='HTTP/1.1 200 OK'
[https @ 0x558c335c1140] http_code=200
[https @ 0x558c335c1140] header='Server: nginx'
[https @ 0x558c335c1140] header='Date: Wed, 24 Oct 2018 18:38:39 GMT'
[https @ 0x558c335c1140] header='Content-Type: application/vnd.apple.mpegurl'
[https @ 0x558c335c1140] header='Content-Length: 221'
[https @ 0x558c335c1140] header='Connection: keep-alive'
[https @ 0x558c335c1140] header='Vary: Accept-Encoding'
[https @ 0x558c335c1140] header='Access-Control-Expose-Headers: Date, Server, Content-Type, Content-Length'
[https @ 0x558c335c1140] header='Cache-Control: no-cache'
[https @ 0x558c335c1140] header='Access-Control-Allow-Origin: *'
[https @ 0x558c335c1140] header='Access-Control-Allow-Credentials: true'
[https @ 0x558c335c1140] header='Access-Control-Allow-Methods: OPTIONS, GET, POST, HEAD'
[https @ 0x558c335c1140] header='Access-Control-Allow-Headers: Content-Type, User-Agent, If-Modified-Since, Cache-Control, Range'
[https @ 0x558c335c1140] header='X-Cache-Status: HIT'
[https @ 0x558c335c1140] header='Accept-Ranges: bytes'
[https @ 0x558c335c1140] header=''
[https @ 0x558c335ca940] Opening 'https://web.server.com/chunklist_w367960315_b3096000.m3u8' for reading
[https @ 0x558c335c1140] request: GET /chunklist_w367960315_b3096000.m3u8 HTTP/1.1
User-Agent: Lavf/58.12.100
Accept: */*
Connection: keep-alive
Host: web.server.com
Icy-MetaData: 1


[https @ 0x558c335c1140] header='HTTP/1.1 200 OK'
[https @ 0x558c335c1140] http_code=200
[https @ 0x558c335c1140] header='Server: nginx'
[https @ 0x558c335c1140] header='Date: Wed, 24 Oct 2018 18:38:39 GMT'
[https @ 0x558c335c1140] header='Content-Type: application/vnd.apple.mpegurl'
[https @ 0x558c335c1140] header='Content-Length: 223'
[https @ 0x558c335c1140] header='Connection: keep-alive'
[https @ 0x558c335c1140] header='Vary: Accept-Encoding'
[https @ 0x558c335c1140] header='Access-Control-Expose-Headers: Date, Server, Content-Type, Content-Length'
[https @ 0x558c335c1140] header='Cache-Control: no-cache'
[https @ 0x558c335c1140] header='Access-Control-Allow-Origin: *'
[https @ 0x558c335c1140] header='Access-Control-Allow-Credentials: true'
[https @ 0x558c335c1140] header='Access-Control-Allow-Methods: OPTIONS, GET, POST, HEAD'
[https @ 0x558c335c1140] header='Access-Control-Allow-Headers: Content-Type, User-Agent, If-Modified-Since, Cache-Control, Range'
[https @ 0x558c335c1140] header='X-Cache-Status: HIT'
[https @ 0x558c335c1140] header='Accept-Ranges: bytes'
[https @ 0x558c335c1140] header=''
[hls,applehttp @ 0x558c32f88480] new_program: id=0x0000
[hls,applehttp @ 0x558c32f88480] new_program: id=0x0001
[hls,applehttp @ 0x558c32f88480] new_program: id=0x0002
[hls,applehttp @ 0x558c32f88480] new_program: id=0x0003
[hls,applehttp @ 0x558c32f88480] new_program: id=0x0004
[hls,applehttp @ 0x558c32f88480] HLS request for url 'https://web.server.com/media_w367960315_b448000_1210.ts', offset 0, playlist 0
[hls,applehttp @ 0x558c32f88480] Opening 'https://web.server.com/media_w367960315_b448000_1210.ts' for reading
[https @ 0x558c33030780] request: GET /media_w367960315_b448000_1210.ts HTTP/1.1
User-Agent: Lavf/58.12.100
Accept: */*
Connection: keep-alive
Host: web.server.com
Icy-MetaData: 1


[https @ 0x558c33030780] header='HTTP/1.1 200 OK'
[https @ 0x558c33030780] http_code=200
[https @ 0x558c33030780] header='Server: nginx'
[https @ 0x558c33030780] header='Date: Wed, 24 Oct 2018 18:38:40 GMT'
[https @ 0x558c33030780] header='Content-Type: video/MP2T'
[https @ 0x558c33030780] header='Content-Length: 143256'
[https @ 0x558c33030780] header='Connection: keep-alive'
[https @ 0x558c33030780] header='Access-Control-Expose-Headers: Date, Server, Content-Type, Content-Length'
[https @ 0x558c33030780] header='Cache-Control: no-cache'
[https @ 0x558c33030780] header='Access-Control-Allow-Origin: *'
[https @ 0x558c33030780] header='Access-Control-Allow-Credentials: true'
[https @ 0x558c33030780] header='Access-Control-Allow-Methods: OPTIONS, GET, POST, HEAD'
[https @ 0x558c33030780] header='Access-Control-Allow-Headers: Content-Type, User-Agent, If-Modified-Since, Cache-Control, Range'
[https @ 0x558c33030780] header='X-Cache-Status: HIT'
[https @ 0x558c33030780] header='Accept-Ranges: bytes'
[https @ 0x558c33030780] header=''
[hls,applehttp @ 0x558c32f88480] HLS request for url 'https://web.server.com/media_w367960315_b448000_1211.ts', offset 0, playlist 0
[hls,applehttp @ 0x558c32f88480] Opening 'https://web.server.com/media_w367960315_b448000_1211.ts' for reading

=============================================================================
here I'm executing: 'sudo rfkill block all' to simulate network disconnection
ffmpeg freezes forever, no timeout
to stop it: ctrl+c and the following error appears
=============================================================================

[hls,applehttp @ 0x558c32f88480] Error when loading first segment 'https://web.server.com/media_w367960315_b448000_1210.ts'
[AVIOContext @ 0x558c33034f00] Statistics: 0 bytes read, 0 seeks
[AVIOContext @ 0x558c335c1280] Statistics: 1107 bytes read, 0 seeks
[AVIOContext @ 0x558c335b1e40] Statistics: 621 bytes read, 0 seeks
https://web.server.com/playlist.m3u8: Immediate exit requested
Exiting normally, received signal 2.

Change History (0)

Note: See TracTickets for help on using tickets.