<p>I have remote <code>index.m3u8</code> file and I want to download it with <code>ffmpeg</code>.<br />
The contents file is:</p>
<pre><code>#EXTM3U
#EXT-X-TARGETDURATION:6
#EXT-X-ALLOW-CACHE:YES
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-KEY:METHOD=AES-128,URI=&quot;https://example.com/encryption.key?x=AVCoPj...&quot;
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:6.000,
https://example.com/seg-1-v1-a1.ts?x=AVCoPj...
#EXTINF:6.000,
https://example.com/seg-2-v1-a1.ts?x=AVCoPj...
#EXTINF:6.000,
https://example.com/seg-3-v1-a1.ts?x=AVCoPj...
#EXTINF:6.000,
:
:
</code></pre>
<p>I try this command in Windows and Linux:</p>
<pre><code>ffmpeg -headers &quot;User-Agent: a&quot; -i &quot;https://example.com/index.m3u8?x=AVCoPj...&quot; -c copy &quot;video.mp4&quot;
</code></pre>
<p>In the linux all thing as well and the video downloaded. But on windows I get this error:</p>
<pre><code>[AVIOContext @ 000001cef2816ec0] Statistics: 368 bytes read, 0 seeks
[hls @ 000001cef21be3c0] Error when loading first segment 'https://example.com/seg-1-v1-a1.ts?x=AVCoPj...'
[AVIOContext @ 000001cef21c8f00] Statistics: 24167 bytes read, 0 seeks
https://example.com/index.m3u8?x=AVCoPj...: Invalid data found when processing input
</code></pre>
<p>Note: Also in the same windows on the chrome browser nothing problem with play this video URL and also can be download with <code>streamlink</code> software.(so not have any problem for network or blocking IP.)</p>
<p>You can see all logs:</p>
<p><strong>Log Windows:</strong></p>
<pre><code>C:\&gt;ffmpeg -headers &quot;User-Agent: a&quot; -i &quot;https://example.com/index.m3u8?x=AVCoPj...&quot; -c copy &quot;video.mp4&quot; -loglevel debug
ffmpeg version 2020-11-18-git-e3081d6f4f-full_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10.2.0 (Rev3, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      56. 60.100 / 56. 60.100
  libavcodec     58.112.103 / 58.112.103
  libavformat    58. 64.100 / 58. 64.100
  libavdevice    58. 11.102 / 58. 11.102
  libavfilter     7. 90.100 /  7. 90.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Splitting the commandline.
Reading option '-headers' ... matched as AVOption 'headers' with argument 'User-Agent: a'.
Reading option '-i' ... matched as input url with argument 'https://example.com/index.m3u8?x=AVCoPj...'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'video.mp4' ... matched as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url https://example.com/index.m3u8?x=AVCoPj....
Successfully parsed a group of options.
Opening an input file: https://example.com/index.m3u8?x=AVCoPj....
[NULL @ 000001cef21be3c0] Opening 'https://example.com/index.m3u8?x=AVCoPj...' for reading
[https @ 000001cef21bed80] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
[https @ 000001cef21bed80] No trailing CRLF found in HTTP header. Adding it.
[tcp @ 000001cef21c1f80] Original list of addresses:
[tcp @ 000001cef21c1f80] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef21c1f80] Interleaved list of addresses:
[tcp @ 000001cef21c1f80] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef21c1f80] Starting connection attempt to 1.2.3.4 port 443
[tcp @ 000001cef21c1f80] Successfully connected to 1.2.3.4 port 443
[https @ 000001cef21bed80] request: GET /index.m3u8?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a


[hls @ 000001cef21be3c0] Format hls probed with size=2048 and score=100
[hls @ 000001cef21be3c0] Skip ('#EXT-X-ALLOW-CACHE:YES')
[hls @ 000001cef21be3c0] Skip ('#EXT-X-VERSION:3')
[https @ 000001cef21bed80] Last chunk received, closing conn
[hls @ 000001cef21be3c0] HLS request for url 'https://example.com/seg-1-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls @ 000001cef21be3c0] Opening 'https://example.com/encryption.key?x=AVCoPj...' for reading
[tcp @ 000001cef2891bc0] Original list of addresses:
[tcp @ 000001cef2891bc0] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef2891bc0] Interleaved list of addresses:
[tcp @ 000001cef2891bc0] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef2891bc0] Starting connection attempt to 1.2.3.4 port 443
[tcp @ 000001cef2891bc0] Successfully connected to 1.2.3.4 port 443
[https @ 000001cef2270900] request: GET /encryption.key?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: keep-alive
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 000001cef2269980] Statistics: 16 bytes read, 0 seeks
[hls @ 000001cef21be3c0] Opening 'crypto+https://example.com/seg-1-v1-a1.ts?x=AVCoPj...' for reading
[tcp @ 000001cef21eb740] Original list of addresses:
[tcp @ 000001cef21eb740] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef21eb740] Interleaved list of addresses:
[tcp @ 000001cef21eb740] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef21eb740] Starting connection attempt to 1.2.3.4 port 443
[tcp @ 000001cef21eb740] Successfully connected to 1.2.3.4 port 443
[https @ 000001cef282acc0] request: GET /seg-1-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: keep-alive
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 000001cef28992c0] Statistics: 368 bytes read, 0 seeks
[hls @ 000001cef21be3c0] HLS request for url 'https://example.com/seg-2-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls @ 000001cef21be3c0] Opening 'crypto+https://example.com/seg-2-v1-a1.ts?x=AVCoPj...' for reading
[tcp @ 000001cef21e2a80] Original list of addresses:
[tcp @ 000001cef21e2a80] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef21e2a80] Interleaved list of addresses:
[tcp @ 000001cef21e2a80] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef21e2a80] Starting connection attempt to 1.2.3.4 port 443
[tcp @ 000001cef21e2a80] Successfully connected to 1.2.3.4 port 443
[https @ 000001cef282acc0] request: GET /seg-2-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: keep-alive
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 000001cef21c6d40] Statistics: 368 bytes read, 0 seeks
[hls @ 000001cef21be3c0] HLS request for url 'https://example.com/seg-3-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls @ 000001cef21be3c0] Opening 'crypto+https://example.com/seg-3-v1-a1.ts?x=AVCoPj...' for reading
[tcp @ 000001cef282bd40] Original list of addresses:
[tcp @ 000001cef282bd40] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef282bd40] Interleaved list of addresses:
[tcp @ 000001cef282bd40] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef282bd40] Starting connection attempt to 1.2.3.4 port 443
[tcp @ 000001cef282bd40] Successfully connected to 1.2.3.4 port 443
[https @ 000001cef2270900] request: GET /seg-3-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: keep-alive
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 000001cef226e6c0] Statistics: 368 bytes read, 0 seeks
[hls @ 000001cef21be3c0] HLS request for url 'https://example.com/seg-4-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls @ 000001cef21be3c0] Opening 'crypto+https://example.com/seg-4-v1-a1.ts?x=AVCoPj...' for reading
[tcp @ 000001cef282bec0] Original list of addresses:
[tcp @ 000001cef282bec0] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef282bec0] Interleaved list of addresses:
[tcp @ 000001cef282bec0] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef282bec0] Starting connection attempt to 1.2.3.4 port 443
[tcp @ 000001cef282bec0] Successfully connected to 1.2.3.4 port 443
[https @ 000001cef282acc0] request: GET /seg-4-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: keep-alive
Host: example.com
Icy-MetaData: 1
User-Agent: a

:
:
:

[AVIOContext @ 000001cef226b9c0] Statistics: 368 bytes read, 0 seeks
[hls @ 000001cef21be3c0] HLS request for url 'https://example.com/seg-75-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls @ 000001cef21be3c0] Opening 'crypto+https://example.com/seg-75-v1-a1.ts?x=AVCoPj...' for reading
[tcp @ 000001cef28dd1c0] Original list of addresses:
[tcp @ 000001cef28dd1c0] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef28dd1c0] Interleaved list of addresses:
[tcp @ 000001cef28dd1c0] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef28dd1c0] Starting connection attempt to 1.2.3.4 port 443
[tcp @ 000001cef28dd1c0] Successfully connected to 1.2.3.4 port 443
[https @ 000001cef282ba40] request: GET /seg-75-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: keep-alive
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 000001cef2817800] Statistics: 368 bytes read, 0 seeks
[hls @ 000001cef21be3c0] HLS request for url 'https://example.com/seg-76-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls @ 000001cef21be3c0] Opening 'crypto+https://example.com/seg-76-v1-a1.ts?x=AVCoPj...' for reading
[tcp @ 000001cef2270700] Original list of addresses:
[tcp @ 000001cef2270700] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef2270700] Interleaved list of addresses:
[tcp @ 000001cef2270700] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef2270700] Starting connection attempt to 1.2.3.4 port 443
[tcp @ 000001cef2270700] Successfully connected to 1.2.3.4 port 443
[https @ 000001cef2271600] request: GET /seg-76-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: keep-alive
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 000001cef2816ec0] Statistics: 368 bytes read, 0 seeks
[hls @ 000001cef21be3c0] Error when loading first segment 'https://example.com/seg-1-v1-a1.ts?x=AVCoPj...'
[AVIOContext @ 000001cef21c8f00] Statistics: 24167 bytes read, 0 seeks
https://example.com/index.m3u8?x=AVCoPj...: Invalid data found when processing input
</code></pre>
<p><strong>Log CentOS:</strong></p>
<pre><code># ffmpeg -headers &quot;User-Agent: a&quot; -i &quot;https://example.com/index.m3u8?x=AVCoPj...&quot; -c copy &quot;video.mp4&quot; -loglevel debug
ffmpeg version 3.4.8 Copyright (c) 2000-2020 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-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzvbi --enable-avfilter --enable-avresample --enable-libmodplug --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
Splitting the commandline.
Reading option '-headers' ... matched as AVOption 'headers' with argument 'User-Agent: a'.
Reading option '-i' ... matched as input url with argument 'https://example.com/index.m3u8?x=AVCoPj...'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option 'video.mp4' ... matched as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url https://example.com/index.m3u8?x=AVCoPj....
Successfully parsed a group of options.
Opening an input file: https://example.com/index.m3u8?x=AVCoPj....
[NULL @ 0x2634700] Opening 'https://example.com/index.m3u8?x=AVCoPj...' for reading
[https @ 0x2635080] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
[https @ 0x2635080] No trailing CRLF found in HTTP header.
[https @ 0x2635080] request: GET /index.m3u8?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a


[hls,applehttp @ 0x2634700] Format hls,applehttp probed with size=2048 and score=100
[hls,applehttp @ 0x2634700] HLS request for url 'https://example.com/seg-1-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls,applehttp @ 0x2634700] Opening 'https://example.com/encryption.key?x=AVCoPj...' for reading
[https @ 0x26af660] request: GET /encryption.key?x=AVCoPj... HTTP/1.1
Accept: */*
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 0x26af500] Statistics: 16 bytes read, 0 seeks
[hls,applehttp @ 0x2634700] Opening 'crypto+https://example.com/seg-1-v1-a1.ts?x=AVCoPj...' for reading
[https @ 0x26af4e0] request: GET /seg-1-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a


Format mpegts probed with size=2048 and score=50
[mpegts @ 0x26b5680] stream=0 stream_type=1b pid=100 prog_reg_desc=
[mpegts @ 0x26b5680] stream=1 stream_type=f pid=101 prog_reg_desc=
[mpegts @ 0x26b5680] stream=2 stream_type=15 pid=102 prog_reg_desc=
[hls,applehttp @ 0x2634700] Before avformat_find_stream_info() pos: 24167 bytes read:24167 seeks:0 nb_streams:3
[mpegts @ 0x26b5680] All programs have pmt, headers found
[NULL @ 0x26aeb60] user data:&quot;x264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=10 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=-2 threads=5 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=90 keyint_min=46 scenecut=0 intra_refresh=0 rc_lookahead=60 rc=crf mbtree=1 crf=25.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=89 vbv_bufsize=102 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00&quot;
[AVBSFContext @ 0x2c7f080] nal_unit_type: 9, nal_ref_idc: 0
[AVBSFContext @ 0x2c7f080] nal_unit_type: 7, nal_ref_idc: 3
[AVBSFContext @ 0x2c7f080] nal_unit_type: 8, nal_ref_idc: 3
[AVBSFContext @ 0x2c7f080] nal_unit_type: 6, nal_ref_idc: 0
[AVBSFContext @ 0x2c7f080] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x26dbc40] nal_unit_type: 9, nal_ref_idc: 0
[h264 @ 0x26dbc40] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x26dbc40] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x26dbc40] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 0x26dbc40] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x26dbc40] user data:&quot;x264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=10 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=-2 threads=5 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=90 keyint_min=46 scenecut=0 intra_refresh=0 rc_lookahead=60 rc=crf mbtree=1 crf=25.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=89 vbv_bufsize=102 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00&quot;
[h264 @ 0x26dbc40] Reinit context to 272x160, pix_fmt: yuv420p
[h264 @ 0x26dbc40] no picture
[mpegts @ 0x26b5680] probing stream 1 pp:2500
[mpegts @ 0x26b5680] Probe with size=7346, packets=1 detected aac with score=51
[mpegts @ 0x26b5680] probed stream 1
[hls,applehttp @ 0x2634700] All info found
[hls,applehttp @ 0x2634700] Setting avg frame rate based on r frame rate
[hls,applehttp @ 0x2634700] After avformat_find_stream_info() pos: 24167 bytes read:24167 seeks:0 frames:82
Input #0, hls,applehttp, from 'https://example.com/index.m3u8?x=AVCoPj...':
  Duration: 00:07:34.20, start: 0.101000, bitrate: N/A
  Program 0
    Metadata:
      variant_bitrate : 0
    Stream #0:0, 21, 1/90000: Video: h264 (High), 1 reference frame ([27][0][0][0] / 0x001B), yuv420p(left), 270x152 (272x160) [SAR 1:1 DAR 135:76], 0/1, 15 fps, 15 tbr, 90k tbn, 30 tbc
    Metadata:
      variant_bitrate : 0
    Stream #0:1, 61, 1/90000: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 0
    Stream #0:2, 0, 1/90000: Data: timed_id3 (ID3  / 0x20334449), 0/1
    Metadata:
      variant_bitrate : 0
Successfully opened the file.
Parsing a group of options: output url video.mp4.
Applying option c (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: video.mp4.
[file @ 0x2c403a0] Setting default whitelist 'file,crypto'
Successfully opened the file.
Output #0, mp4, to 'video.mp4':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0, 0, 1/90000: Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 270x152 (0x0) [SAR 1:1 DAR 135:76], 0/1, q=2-31, 15 fps, 15 tbr, 90k tbn, 90k tbc
    Metadata:
      variant_bitrate : 0
    Stream #0:1, 0, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 0
Stream mapping:
  Stream #0:0 -&gt; #0:0 (copy)
  Stream #0:1 -&gt; #0:1 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 10 times
Automatically inserted bitstream filter 'aac_adtstoasc'; args=''
[AVIOContext @ 0x26b1dc0] Statistics: 138744 bytes read, 0 seeks
[hls,applehttp @ 0x2634700] HLS request for url 'https://example.com/seg-2-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls,applehttp @ 0x2634700] Opening 'crypto+https://example.com/seg-2-v1-a1.ts?x=AVCoPj...' for reading
[https @ 0x2c93100] request: GET /seg-2-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 0x2c98f20] Statistics: 153784 bytes read, 0 seeksate=   0.1kbits/s speed=8.51x
[hls,applehttp @ 0x2634700] HLS request for url 'https://example.com/seg-3-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls,applehttp @ 0x2634700] Opening 'crypto+https://example.com/seg-3-v1-a1.ts?x=AVCoPj...' for reading
[https @ 0x2c930e0] request: GET /seg-3-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 0x2c92c20] Statistics: 135736 bytes read, 0 seeksate= 175.1kbits/s speed=8.37x
[hls,applehttp @ 0x2634700] HLS request for url 'https://example.com/seg-4-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls,applehttp @ 0x2634700] Opening 'crypto+https://example.com/seg-4-v1-a1.ts?x=AVCoPj...' for reading
[https @ 0x2c85260] request: GET /seg-4-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a

:
:
:

[AVIOContext @ 0x26cccc0] Statistics: 144760 bytes read, 0 seeksate= 172.4kbits/s speed=8.08x
[hls,applehttp @ 0x2634700] HLS request for url 'https://example.com/seg-75-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls,applehttp @ 0x2634700] Opening 'crypto+https://example.com/seg-75-v1-a1.ts?x=AVCoPj...' for reading
[https @ 0x2c836a0] request: GET /seg-75-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 0x26ccec0] Statistics: 123704 bytes read, 0 seeksate= 170.0kbits/s speed=8.08x
[hls,applehttp @ 0x2634700] HLS request for url 'https://example.com/seg-76-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls,applehttp @ 0x2634700] Opening 'crypto+https://example.com/seg-76-v1-a1.ts?x=AVCoPj...' for reading
[https @ 0x2c85da0] request: GET /seg-76-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 0x26cccc0] Statistics: 84600 bytes read, 0 seeksrate= 172.4kbits/s speed=8.08x
No more output streams to write to, finishing.
frame= 6813 fps=122 q=-1.0 Lsize=    9873kB time=00:07:34.13 bitrate= 178.1kbits/s speed=8.14x
video:2506kB audio:7255kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.141788%
Input file #0 (https://example.com/index.m3u8?x=AVCoPj...):
  Input stream #0:0 (video): 6813 packets read (2566107 bytes);
  Input stream #0:1 (audio): 19556 packets read (7429357 bytes);
  Input stream #0:2 (data): 0 packets read (0 bytes);
  Total: 26369 packets (9995464 bytes) demuxed
Output file #0 (video.mp4):
  Output stream #0:0 (video): 6813 packets muxed (2566107 bytes);
  Output stream #0:1 (audio): 19556 packets muxed (7429357 bytes);
  Total: 26369 packets (9995464 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x2c91480] Statistics: 2 seeks, 41 writeouts
[AVIOContext @ 0x2c2d240] Statistics: 24167 bytes read, 0 seeks
</code></pre>
<p>Why I can not download it on windows with ffmpeg and how can I resolve it?</p>
<p><strong>EDIT 1:</strong> I tried <a href="https://johnvansickle.com/ffmpeg/" rel="nofollow noreferrer"><code>ffmpeg N-54874-ga1553b0cfb-static (latest)</code></a> on <code>linux</code> and get same error! Then tried <a href="https://www.videohelp.com/download/ffmpeg-3.4.2-win64-static.zip" rel="nofollow noreferrer"><code>ffmpeg 3.4.2</code></a> on <code>windows</code> and works well!<br />
<strong>So seem this is not related to the operating system. And seem this is a bug in newer version of <code>ffmpeg</code>!</strong></p>
<p><strong>EDIT 2:</strong> I tried <a href="https://www.videohelp.com/software/ffmpeg/old-versions" rel="nofollow noreferrer">many versions</a> of <code>ffmpeg</code> for <code>windows</code>:</p>
<pre><code>ffmpeg-1.0.1-win64-static           Error in the pull function.
ffmpeg-1.2-win64-static             Error in the pull function.
ffmpeg-2.0.1-win64-static           Error in the pull function.
ffmpeg-2.2.3-win64-static           Error in the pull function.
ffmpeg-3.0-win64-static             OK
ffmpeg-3.1.5-win64-static           OK warning...
ffmpeg-3.2.4-win64-static           OK
ffmpeg-3.3.4-win64-static           OK
ffmpeg-3.4.2-win64-static           OK
ffmpeg-4.0.2-win64-static           OK
ffmpeg-4.1.4-win64-static           OK
ffmpeg-4.2.3-win64-static           OK
ffmpeg-4.3-win64-static             Error when loading first segment
ffmpeg-4.3.1-win64-static           Error when loading first segment
ffmpeg-2020-11-18-git-e3081d6f4f    Error when loading first segment
</code></pre>
<p>Seem after <code>&gt;=4.3</code> there is a bug in ffmpeg!</p>
<p><strong>EDIT 3:</strong>
I'm not sure if this is relevant; but apparently in all the cases where the test of versions failed, this skip warning appeared in the output:</p>
<pre><code>[hls @ 000002794d99dcc0] Skip ('#EXT-X-ALLOW-CACHE:YES')
[hls @ 000002794d99dcc0] Skip ('#EXT-X-VERSION:3')
</code></pre>

CC BY-SA 4.0
2020-11-19T10:55:06.520Z
First check with a current version on linux. get a git master build from https://johnvansickle.com/ffmpeg/
Gyan
CC BY-SA 4.0
2020-11-19T20:11:30.047Z
@Gyan I try `ffmpeg N-54874-ga1553b0cfb-static (latest)` on `linux` and get same error! Then try `ffmpeg 3.4.2` on `windows` and works well! So seem this is not related to the operating system. And seem is a bug in newer version of ffmpeg!
Nabi K.A.Z.
CC BY-SA 4.0
2020-11-20T05:26:28.380Z
Open a ticket at trac.ffmpeg.org
Gyan
CC BY-SA 4.0
2020-11-20T21:08:38.100Z
@Gyan Sure, I opened it: http://trac.ffmpeg.org/ticket/8998
Nabi K.A.Z.
<ffmpeg><windows><linux>
FFmpeg works in linux and same command in windows get me error Invalid data found when processing input
Nabi K.A.Z.
# FFmpeg works in linux and same command in windows get me error Invalid data found when processing input

(Asked by: username_0 on 2020-11-19)

I have remote index.m3u8 file and I want to download it with ffmpeg.
The contents file is:
#EXTM3U
#EXT-X-TARGETDURATION:6
#EXT-X-ALLOW-CACHE:YES
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-KEY:METHOD=AES-128,URI="https://example.com/encryption.key?x=AVCoPj..."
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:6.000,
https://example.com/seg-1-v1-a1.ts?x=AVCoPj...
#EXTINF:6.000,
https://example.com/seg-2-v1-a1.ts?x=AVCoPj...
#EXTINF:6.000,
https://example.com/seg-3-v1-a1.ts?x=AVCoPj...
#EXTINF:6.000,
:
:

I try this command in Windows and Linux:
ffmpeg -headers "User-Agent: a" -i "https://example.com/index.m3u8?x=AVCoPj..." -c copy "video.mp4"

In the linux all thing as well and the video downloaded. But on windows I get this error:
[AVIOContext @ 000001cef2816ec0] Statistics: 368 bytes read, 0 seeks
[hls @ 000001cef21be3c0] Error when loading first segment 'https://example.com/seg-1-v1-a1.ts?x=AVCoPj...'
[AVIOContext @ 000001cef21c8f00] Statistics: 24167 bytes read, 0 seeks
https://example.com/index.m3u8?x=AVCoPj...: Invalid data found when processing input

Note: Also in the same windows on the chrome browser nothing problem with play this video URL and also can be download with streamlink software.(so not have any problem for network or blocking IP.)
You can see all logs:
Log Windows:
C:\>ffmpeg -headers "User-Agent: a" -i "https://example.com/index.m3u8?x=AVCoPj..." -c copy "video.mp4" -loglevel debug
ffmpeg version 2020-11-18-git-e3081d6f4f-full_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10.2.0 (Rev3, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      56. 60.100 / 56. 60.100
  libavcodec     58.112.103 / 58.112.103
  libavformat    58. 64.100 / 58. 64.100
  libavdevice    58. 11.102 / 58. 11.102
  libavfilter     7. 90.100 /  7. 90.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Splitting the commandline.
Reading option '-headers' ... matched as AVOption 'headers' with argument 'User-Agent: a'.
Reading option '-i' ... matched as input url with argument 'https://example.com/index.m3u8?x=AVCoPj...'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'video.mp4' ... matched as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url https://example.com/index.m3u8?x=AVCoPj....
Successfully parsed a group of options.
Opening an input file: https://example.com/index.m3u8?x=AVCoPj....
[NULL @ 000001cef21be3c0] Opening 'https://example.com/index.m3u8?x=AVCoPj...' for reading
[https @ 000001cef21bed80] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
[https @ 000001cef21bed80] No trailing CRLF found in HTTP header. Adding it.
[tcp @ 000001cef21c1f80] Original list of addresses:
[tcp @ 000001cef21c1f80] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef21c1f80] Interleaved list of addresses:
[tcp @ 000001cef21c1f80] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef21c1f80] Starting connection attempt to 1.2.3.4 port 443
[tcp @ 000001cef21c1f80] Successfully connected to 1.2.3.4 port 443
[https @ 000001cef21bed80] request: GET /index.m3u8?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a


[hls @ 000001cef21be3c0] Format hls probed with size=2048 and score=100
[hls @ 000001cef21be3c0] Skip ('#EXT-X-ALLOW-CACHE:YES')
[hls @ 000001cef21be3c0] Skip ('#EXT-X-VERSION:3')
[https @ 000001cef21bed80] Last chunk received, closing conn
[hls @ 000001cef21be3c0] HLS request for url 'https://example.com/seg-1-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls @ 000001cef21be3c0] Opening 'https://example.com/encryption.key?x=AVCoPj...' for reading
[tcp @ 000001cef2891bc0] Original list of addresses:
[tcp @ 000001cef2891bc0] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef2891bc0] Interleaved list of addresses:
[tcp @ 000001cef2891bc0] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef2891bc0] Starting connection attempt to 1.2.3.4 port 443
[tcp @ 000001cef2891bc0] Successfully connected to 1.2.3.4 port 443
[https @ 000001cef2270900] request: GET /encryption.key?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: keep-alive
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 000001cef2269980] Statistics: 16 bytes read, 0 seeks
[hls @ 000001cef21be3c0] Opening 'crypto+https://example.com/seg-1-v1-a1.ts?x=AVCoPj...' for reading
[tcp @ 000001cef21eb740] Original list of addresses:
[tcp @ 000001cef21eb740] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef21eb740] Interleaved list of addresses:
[tcp @ 000001cef21eb740] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef21eb740] Starting connection attempt to 1.2.3.4 port 443
[tcp @ 000001cef21eb740] Successfully connected to 1.2.3.4 port 443
[https @ 000001cef282acc0] request: GET /seg-1-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: keep-alive
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 000001cef28992c0] Statistics: 368 bytes read, 0 seeks
[hls @ 000001cef21be3c0] HLS request for url 'https://example.com/seg-2-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls @ 000001cef21be3c0] Opening 'crypto+https://example.com/seg-2-v1-a1.ts?x=AVCoPj...' for reading
[tcp @ 000001cef21e2a80] Original list of addresses:
[tcp @ 000001cef21e2a80] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef21e2a80] Interleaved list of addresses:
[tcp @ 000001cef21e2a80] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef21e2a80] Starting connection attempt to 1.2.3.4 port 443
[tcp @ 000001cef21e2a80] Successfully connected to 1.2.3.4 port 443
[https @ 000001cef282acc0] request: GET /seg-2-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: keep-alive
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 000001cef21c6d40] Statistics: 368 bytes read, 0 seeks
[hls @ 000001cef21be3c0] HLS request for url 'https://example.com/seg-3-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls @ 000001cef21be3c0] Opening 'crypto+https://example.com/seg-3-v1-a1.ts?x=AVCoPj...' for reading
[tcp @ 000001cef282bd40] Original list of addresses:
[tcp @ 000001cef282bd40] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef282bd40] Interleaved list of addresses:
[tcp @ 000001cef282bd40] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef282bd40] Starting connection attempt to 1.2.3.4 port 443
[tcp @ 000001cef282bd40] Successfully connected to 1.2.3.4 port 443
[https @ 000001cef2270900] request: GET /seg-3-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: keep-alive
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 000001cef226e6c0] Statistics: 368 bytes read, 0 seeks
[hls @ 000001cef21be3c0] HLS request for url 'https://example.com/seg-4-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls @ 000001cef21be3c0] Opening 'crypto+https://example.com/seg-4-v1-a1.ts?x=AVCoPj...' for reading
[tcp @ 000001cef282bec0] Original list of addresses:
[tcp @ 000001cef282bec0] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef282bec0] Interleaved list of addresses:
[tcp @ 000001cef282bec0] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef282bec0] Starting connection attempt to 1.2.3.4 port 443
[tcp @ 000001cef282bec0] Successfully connected to 1.2.3.4 port 443
[https @ 000001cef282acc0] request: GET /seg-4-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: keep-alive
Host: example.com
Icy-MetaData: 1
User-Agent: a

:
:
:

[AVIOContext @ 000001cef226b9c0] Statistics: 368 bytes read, 0 seeks
[hls @ 000001cef21be3c0] HLS request for url 'https://example.com/seg-75-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls @ 000001cef21be3c0] Opening 'crypto+https://example.com/seg-75-v1-a1.ts?x=AVCoPj...' for reading
[tcp @ 000001cef28dd1c0] Original list of addresses:
[tcp @ 000001cef28dd1c0] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef28dd1c0] Interleaved list of addresses:
[tcp @ 000001cef28dd1c0] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef28dd1c0] Starting connection attempt to 1.2.3.4 port 443
[tcp @ 000001cef28dd1c0] Successfully connected to 1.2.3.4 port 443
[https @ 000001cef282ba40] request: GET /seg-75-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: keep-alive
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 000001cef2817800] Statistics: 368 bytes read, 0 seeks
[hls @ 000001cef21be3c0] HLS request for url 'https://example.com/seg-76-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls @ 000001cef21be3c0] Opening 'crypto+https://example.com/seg-76-v1-a1.ts?x=AVCoPj...' for reading
[tcp @ 000001cef2270700] Original list of addresses:
[tcp @ 000001cef2270700] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef2270700] Interleaved list of addresses:
[tcp @ 000001cef2270700] Address 1.2.3.4 port 443
    Last message repeated 1 times
[tcp @ 000001cef2270700] Starting connection attempt to 1.2.3.4 port 443
[tcp @ 000001cef2270700] Successfully connected to 1.2.3.4 port 443
[https @ 000001cef2271600] request: GET /seg-76-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: keep-alive
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 000001cef2816ec0] Statistics: 368 bytes read, 0 seeks
[hls @ 000001cef21be3c0] Error when loading first segment 'https://example.com/seg-1-v1-a1.ts?x=AVCoPj...'
[AVIOContext @ 000001cef21c8f00] Statistics: 24167 bytes read, 0 seeks
https://example.com/index.m3u8?x=AVCoPj...: Invalid data found when processing input

Log CentOS:
# ffmpeg -headers "User-Agent: a" -i "https://example.com/index.m3u8?x=AVCoPj..." -c copy "video.mp4" -loglevel debug
ffmpeg version 3.4.8 Copyright (c) 2000-2020 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-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzvbi --enable-avfilter --enable-avresample --enable-libmodplug --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
Splitting the commandline.
Reading option '-headers' ... matched as AVOption 'headers' with argument 'User-Agent: a'.
Reading option '-i' ... matched as input url with argument 'https://example.com/index.m3u8?x=AVCoPj...'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option 'video.mp4' ... matched as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url https://example.com/index.m3u8?x=AVCoPj....
Successfully parsed a group of options.
Opening an input file: https://example.com/index.m3u8?x=AVCoPj....
[NULL @ 0x2634700] Opening 'https://example.com/index.m3u8?x=AVCoPj...' for reading
[https @ 0x2635080] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
[https @ 0x2635080] No trailing CRLF found in HTTP header.
[https @ 0x2635080] request: GET /index.m3u8?x=AVCoPj... HTTP/1.1
Accept: */*
Range: bytes=0-
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a


[hls,applehttp @ 0x2634700] Format hls,applehttp probed with size=2048 and score=100
[hls,applehttp @ 0x2634700] HLS request for url 'https://example.com/seg-1-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls,applehttp @ 0x2634700] Opening 'https://example.com/encryption.key?x=AVCoPj...' for reading
[https @ 0x26af660] request: GET /encryption.key?x=AVCoPj... HTTP/1.1
Accept: */*
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 0x26af500] Statistics: 16 bytes read, 0 seeks
[hls,applehttp @ 0x2634700] Opening 'crypto+https://example.com/seg-1-v1-a1.ts?x=AVCoPj...' for reading
[https @ 0x26af4e0] request: GET /seg-1-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a


Format mpegts probed with size=2048 and score=50
[mpegts @ 0x26b5680] stream=0 stream_type=1b pid=100 prog_reg_desc=
[mpegts @ 0x26b5680] stream=1 stream_type=f pid=101 prog_reg_desc=
[mpegts @ 0x26b5680] stream=2 stream_type=15 pid=102 prog_reg_desc=
[hls,applehttp @ 0x2634700] Before avformat_find_stream_info() pos: 24167 bytes read:24167 seeks:0 nb_streams:3
[mpegts @ 0x26b5680] All programs have pmt, headers found
[NULL @ 0x26aeb60] user data:"x264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=10 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=-2 threads=5 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=90 keyint_min=46 scenecut=0 intra_refresh=0 rc_lookahead=60 rc=crf mbtree=1 crf=25.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=89 vbv_bufsize=102 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00"
[AVBSFContext @ 0x2c7f080] nal_unit_type: 9, nal_ref_idc: 0
[AVBSFContext @ 0x2c7f080] nal_unit_type: 7, nal_ref_idc: 3
[AVBSFContext @ 0x2c7f080] nal_unit_type: 8, nal_ref_idc: 3
[AVBSFContext @ 0x2c7f080] nal_unit_type: 6, nal_ref_idc: 0
[AVBSFContext @ 0x2c7f080] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x26dbc40] nal_unit_type: 9, nal_ref_idc: 0
[h264 @ 0x26dbc40] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x26dbc40] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x26dbc40] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 0x26dbc40] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x26dbc40] user data:"x264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=10 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=-2 threads=5 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=90 keyint_min=46 scenecut=0 intra_refresh=0 rc_lookahead=60 rc=crf mbtree=1 crf=25.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=89 vbv_bufsize=102 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00"
[h264 @ 0x26dbc40] Reinit context to 272x160, pix_fmt: yuv420p
[h264 @ 0x26dbc40] no picture
[mpegts @ 0x26b5680] probing stream 1 pp:2500
[mpegts @ 0x26b5680] Probe with size=7346, packets=1 detected aac with score=51
[mpegts @ 0x26b5680] probed stream 1
[hls,applehttp @ 0x2634700] All info found
[hls,applehttp @ 0x2634700] Setting avg frame rate based on r frame rate
[hls,applehttp @ 0x2634700] After avformat_find_stream_info() pos: 24167 bytes read:24167 seeks:0 frames:82
Input #0, hls,applehttp, from 'https://example.com/index.m3u8?x=AVCoPj...':
  Duration: 00:07:34.20, start: 0.101000, bitrate: N/A
  Program 0
    Metadata:
      variant_bitrate : 0
    Stream #0:0, 21, 1/90000: Video: h264 (High), 1 reference frame ([27][0][0][0] / 0x001B), yuv420p(left), 270x152 (272x160) [SAR 1:1 DAR 135:76], 0/1, 15 fps, 15 tbr, 90k tbn, 30 tbc
    Metadata:
      variant_bitrate : 0
    Stream #0:1, 61, 1/90000: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 0
    Stream #0:2, 0, 1/90000: Data: timed_id3 (ID3  / 0x20334449), 0/1
    Metadata:
      variant_bitrate : 0
Successfully opened the file.
Parsing a group of options: output url video.mp4.
Applying option c (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: video.mp4.
[file @ 0x2c403a0] Setting default whitelist 'file,crypto'
Successfully opened the file.
Output #0, mp4, to 'video.mp4':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0, 0, 1/90000: Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 270x152 (0x0) [SAR 1:1 DAR 135:76], 0/1, q=2-31, 15 fps, 15 tbr, 90k tbn, 90k tbc
    Metadata:
      variant_bitrate : 0
    Stream #0:1, 0, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 0
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 10 times
Automatically inserted bitstream filter 'aac_adtstoasc'; args=''
[AVIOContext @ 0x26b1dc0] Statistics: 138744 bytes read, 0 seeks
[hls,applehttp @ 0x2634700] HLS request for url 'https://example.com/seg-2-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls,applehttp @ 0x2634700] Opening 'crypto+https://example.com/seg-2-v1-a1.ts?x=AVCoPj...' for reading
[https @ 0x2c93100] request: GET /seg-2-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 0x2c98f20] Statistics: 153784 bytes read, 0 seeksate=   0.1kbits/s speed=8.51x
[hls,applehttp @ 0x2634700] HLS request for url 'https://example.com/seg-3-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls,applehttp @ 0x2634700] Opening 'crypto+https://example.com/seg-3-v1-a1.ts?x=AVCoPj...' for reading
[https @ 0x2c930e0] request: GET /seg-3-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 0x2c92c20] Statistics: 135736 bytes read, 0 seeksate= 175.1kbits/s speed=8.37x
[hls,applehttp @ 0x2634700] HLS request for url 'https://example.com/seg-4-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls,applehttp @ 0x2634700] Opening 'crypto+https://example.com/seg-4-v1-a1.ts?x=AVCoPj...' for reading
[https @ 0x2c85260] request: GET /seg-4-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a

:
:
:

[AVIOContext @ 0x26cccc0] Statistics: 144760 bytes read, 0 seeksate= 172.4kbits/s speed=8.08x
[hls,applehttp @ 0x2634700] HLS request for url 'https://example.com/seg-75-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls,applehttp @ 0x2634700] Opening 'crypto+https://example.com/seg-75-v1-a1.ts?x=AVCoPj...' for reading
[https @ 0x2c836a0] request: GET /seg-75-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 0x26ccec0] Statistics: 123704 bytes read, 0 seeksate= 170.0kbits/s speed=8.08x
[hls,applehttp @ 0x2634700] HLS request for url 'https://example.com/seg-76-v1-a1.ts?x=AVCoPj...', offset 0, playlist 0
[hls,applehttp @ 0x2634700] Opening 'crypto+https://example.com/seg-76-v1-a1.ts?x=AVCoPj...' for reading
[https @ 0x2c85da0] request: GET /seg-76-v1-a1.ts?x=AVCoPj... HTTP/1.1
Accept: */*
Connection: close
Host: example.com
Icy-MetaData: 1
User-Agent: a


[AVIOContext @ 0x26cccc0] Statistics: 84600 bytes read, 0 seeksrate= 172.4kbits/s speed=8.08x
No more output streams to write to, finishing.
frame= 6813 fps=122 q=-1.0 Lsize=    9873kB time=00:07:34.13 bitrate= 178.1kbits/s speed=8.14x
video:2506kB audio:7255kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.141788%
Input file #0 (https://example.com/index.m3u8?x=AVCoPj...):
  Input stream #0:0 (video): 6813 packets read (2566107 bytes);
  Input stream #0:1 (audio): 19556 packets read (7429357 bytes);
  Input stream #0:2 (data): 0 packets read (0 bytes);
  Total: 26369 packets (9995464 bytes) demuxed
Output file #0 (video.mp4):
  Output stream #0:0 (video): 6813 packets muxed (2566107 bytes);
  Output stream #0:1 (audio): 19556 packets muxed (7429357 bytes);
  Total: 26369 packets (9995464 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x2c91480] Statistics: 2 seeks, 41 writeouts
[AVIOContext @ 0x2c2d240] Statistics: 24167 bytes read, 0 seeks

Why I can not download it on windows with ffmpeg and how can I resolve it?
EDIT 1: I tried ffmpeg N-54874-ga1553b0cfb-static (latest) on linux and get same error! Then tried ffmpeg 3.4.2 on windows and works well!
So seem this is not related to the operating system. And seem this is a bug in newer version of ffmpeg!
EDIT 2: I tried many versions of ffmpeg for windows:
ffmpeg-1.0.1-win64-static           Error in the pull function.
ffmpeg-1.2-win64-static             Error in the pull function.
ffmpeg-2.0.1-win64-static           Error in the pull function.
ffmpeg-2.2.3-win64-static           Error in the pull function.
ffmpeg-3.0-win64-static             OK
ffmpeg-3.1.5-win64-static           OK warning...
ffmpeg-3.2.4-win64-static           OK
ffmpeg-3.3.4-win64-static           OK
ffmpeg-3.4.2-win64-static           OK
ffmpeg-4.0.2-win64-static           OK
ffmpeg-4.1.4-win64-static           OK
ffmpeg-4.2.3-win64-static           OK
ffmpeg-4.3-win64-static             Error when loading first segment
ffmpeg-4.3.1-win64-static           Error when loading first segment
ffmpeg-2020-11-18-git-e3081d6f4f    Error when loading first segment

Seem after >=4.3 there is a bug in ffmpeg!
EDIT 3:
I'm not sure if this is relevant; but apparently in all the cases where the test of versions failed, this skip warning appeared in the output:
[hls @ 000002794d99dcc0] Skip ('#EXT-X-ALLOW-CACHE:YES')
[hls @ 000002794d99dcc0] Skip ('#EXT-X-VERSION:3')

**Tags:** ffmpeg, windows, linux

> **Comments:**
> **username_1**: First check with a current version on linux. get a git master build from https://johnvansickle.com/ffmpeg/  
> **username_0**: @username_1 I try `ffmpeg N-54874-ga1553b0cfb-static (latest)` on `linux` and get same error! Then try `ffmpeg 3.4.2` on `windows` and works well! So seem this is not related to the operating system. And seem is a bug in newer version of ffmpeg!  
> **username_1**: Open a ticket at trac.ffmpeg.org  
> **username_0**: @username_1 Sure, I opened it: http://trac.ffmpeg.org/ticket/8998  

---

## 0 answers

