title: Decrypt .m3u8 playlist and merge it into single .mp4 file with ffmpeg
body: <p>I have a folder which contains <code>.key</code> file, <code>.m3u8</code> file and a bunch of <code>.ts</code> files.</p>
  <p>My <code>.m3u8</code> looks like this:</p>
  <pre><code>#EXTM3U
  #EXT-X-VERSION:3
  #EXT-X-MEDIA-SEQUENCE:0
  #EXT-X-TARGETDURATION:5
  #EXT-X-KEY:METHOD=AES-128,URI=&quot;mykey.key&quot;
  #EXTINF:4.004000,
  000000.ts
  #EXTINF:4.004011,
  000001.ts
  #EXTINF:4.004000,
  000002.ts
  #EXTINF:4.004000,
  000003.ts
  
  ...
  
  #EXT-X-ENDLIST
  </code></pre>
  <p>What I want to do is to decrypt it and merge this playlist into a single .mp4 file</p>
  <p>I tried this ffmpeg command on my Windows machine:</p>
  <pre><code>ffmpeg -i &quot;myvid.m3u8&quot; -codec copy output.mp4
  </code></pre>
  <p>But I get a following error:</p>
  <pre><code>[hls @ 000002780f0a8dc0] Skip ('#EXT-X-VERSION:3')
  [hls @ 000002780f0a8dc0] Filename extension of 'mykey.key' is not a common multimedia extension, blocked for security reasons.
  If you wish to override this adjust allowed_extensions, you can set it to 'ALL' to allow all
  [hls @ 000002780f0a8dc0] Unable to open key file mykey.key
  [hls @ 000002780f0a8dc0] Opening 'crypto:000000.ts' for reading
  [hls @ 000002780f0a8dc0] Opening 'crypto:000001.ts' for reading
  [hls @ 000002780f0a8dc0] Error when loading first segment '000000.ts'
  myvid.m3u8: Invalid data found when processing input
  </code></pre>
  <p>I changed my command to following:</p>
  <pre><code>ffmpeg  -allowed_extensions ALL -i &quot;myvid.m3u8&quot; -codec copy output.mp4
  </code></pre>
  <p>Then I got this error:</p>
  <pre><code>[hls @ 000001a079cf8f80] Skip ('#EXT-X-VERSION:3')
  [hls @ 000001a079cf8f80] Opening 'mykey.key' for reading
  [hls @ 000001a079cf8f80] Opening 'crypto:000000.ts' for reading
  [hls @ 000001a079cf8f80] Opening 'crypto:000001.ts' for reading
  [hls @ 000001a079cf8f80] Error when loading first segment '000000.ts'
  myvid.m3u8: Invalid data found when processing input
  </code></pre>
  <p>At this point I don't really understand what the problem is.
  Any idea how can I fix this?</p>
  <p>I'm open to use any other software if this can't be done with ffmpeg or smth</p>
  <p>Thanks!</p>