Reputation: 152
I have a folder which contains .key
file, .m3u8
file and a bunch of .ts
files.
My .m3u8
looks like this:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:5
#EXT-X-KEY:METHOD=AES-128,URI="mykey.key"
#EXTINF:4.004000,
000000.ts
#EXTINF:4.004011,
000001.ts
#EXTINF:4.004000,
000002.ts
#EXTINF:4.004000,
000003.ts
...
#EXT-X-ENDLIST
What I want to do is to decrypt it and merge this playlist into a single .mp4 file
I tried this ffmpeg command on my Windows machine:
ffmpeg -i "myvid.m3u8" -codec copy output.mp4
But I get a following error:
[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
I changed my command to following:
ffmpeg -allowed_extensions ALL -i "myvid.m3u8" -codec copy output.mp4
Then I got this error:
[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
At this point I don't really understand what the problem is. Any idea how can I fix this?
I'm open to use any other software if this can't be done with ffmpeg or smth
Thanks!
Upvotes: 1
Views: 5112
Reputation: 31
From your manifest,I could see that you have downloaded the necessary streams and key. The issue here is that ffmpeg could not decrypt the stream files '.ts' using the key you mentioned in the manifest. This issue may be due to your key file. The aes key file is encrypted and should be in binary only. If your 'content-type' response header is 'application/octet-stream' then handle the response as a binary file.
Upvotes: 1