Decrypt .m3u8 playlist and merge it into single .mp4 file with ffmpeg
Try using this
ffmpeg -protocol_whitelist file,tls,tcp,https,crypto -allowed_extensions ALL -i myvid.m3u8 -c copy output.mp4
If I open my .key file with text editor it shows weird symbols like Ж‰еН:‘њ w†(„ым;§BgШ0чqо!I”q I don't know if it supposed to look like this or not
Yes, It is supposed to look like that.
kekundel
Updated on September 18, 2022Comments
-
kekundel over 1 year
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
If I open my
.key
file with text editor it shows weird symbols likeЖ‰еН:‘њ w†(„ым;§BgШ0чqо!I”q
I don't know if it supposed to look like this or notAt 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!
-
DavidPostill almost 4 yearsWhile this may answer the question, it would be a better answer if you could provide some explanation why it does so.