Audio/video stream recording forums (http://stream-recorder.com/forum/index.php)
-   Video stream recording (http://stream-recorder.com/forum/forumdisplay.php?f=4)
-   -  

Decrypting ts files from m3u8

(http://stream-recorder.com/forum/showthread.php?t=16686)

No_Miaus 10-28-2013 01:59 PM

Decrypting ts files from m3u8


 
Hello! I'm trying to decrypt a m3u8 that contains a lot ts files. The key (m3u8 files says it's AES 128) is on a php and the content looks like this and there isn't IV (so..?):



The content of that php page change each time I refresh it so i imagine it uses some clock to encrypt it but... What kind of key is it? Should I use wget to get that key to a txt file and then use openssl to decrypt it? Would It be enough to decrypt it or how can I do it?

Thank you :)

peterpan 10-28-2013 09:15 PM

Re: Decrypting ts files from m3u8


 
Post the actual link and someone may be able to help you out...Also provide a better description of what you're trying to do? Are trying to play or record this stream on VLC? What do you mean by "trying to decrypt a m3u8"?! Why?!

No_Miaus 10-29-2013 05:20 PM

Re: Decrypting ts files from m3u8


 
Quote:

Originally Posted by peterpan (Post 63752)
Post the actual link and someone may be able to help you out...Also provide a better description of what you're trying to do? Are trying to play or record this stream on VLC? What do you mean by "trying to decrypt a m3u8"?! Why?!

I mean ts files are encrypted.
http://www.atresplayer.com/televisio...102500011.html
m3u8 contains..

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:12
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-KEY:METHOD=AES-128,URI="https://pulse.atresplayer.com/key.php"
#EXTINF:12.0,
media_b1348000_0.ts
#EXTINF:12.0,
media_b1348000_1.ts
etc...

peterpan 10-29-2013 11:02 PM

Re: Decrypting ts files from m3u8


 
Sorry Bro, I can't do much :( This one will need a REAL PRO ;)

Primero, the stream is geo-blocked! I had to proxy to Spain, and only then was able to view the vid :)



Segundo, looks like they use some "bad-ass" encryption with multiple key types :( Moreover, the final token is constantly changing, which leads me to believe you will eventually need to regex this baby :)

================================================== ==============
AtresPlayer-1/com/hurlant/crypto/%prng/ARC4.class.asasm:332: trait method QName(PackageNamespace(""), "decrypt")
AtresPlayer-1/com/hurlant/crypto/%prng/ARC4.class.asasm:334: refid "com.hurlant.crypto.prng:ARC4/decrypt"
AtresPlayer-1/com/hurlant/crypto/rsa/RSAKey.class.asasm:210: trait method QName(PackageNamespace(""), "decrypt")
AtresPlayer-1/com/hurlant/crypto/rsa/RSAKey.class.asasm:212: refid "com.hurlant.crypto.rsa:RSAKey/decrypt"
AtresPlayer-1/com/hurlant/crypto/rsa/RSAKey.class.asasm:237: callpropvoid QName(PrivateNamespace("*", "com.hurlant.crypto.rsa:RSAKey#0"), "_decrypt"), 6
AtresPlayer-1/com/hurlant/crypto/rsa/RSAKey.class.asasm:305: callpropvoid QName(PrivateNamespace("*", "com.hurlant.crypto.rsa:RSAKey#0"), "_decrypt"), 6
AtresPlayer-1/com/hurlant/crypto/rsa/RSAKey.class.asasm:411: trait method QName(PrivateNamespace("*", "com.hurlant.crypto.rsa:RSAKey#0"), "_decrypt")
AtresPlayer-1/com/hurlant/crypto/rsa/RSAKey.class.asasm:413: refid "com.hurlant.crypto.rsa:RSAKey/_decrypt"
AtresPlayer-1/com/hurlant/crypto/symmetric/AESKey.class.asasm:478: trait method QName(PackageNamespace(""), "decrypt")
AtresPlayer-1/com/hurlant/crypto/symmetric/AESKey.class.asasm:480: refid "com.hurlant.crypto.symmetric:AESKey/decrypt"
AtresPlayer-1/com/hurlant/crypto/symmetric/BlowFishKey.class.asasm:62: trait method QName(PackageNamespace(""), "decrypt")
AtresPlayer-1/com/hurlant/crypto/symmetric/BlowFishKey.class.asasm:64: refid "com.hurlant.crypto.symmetric:BlowFishKey/decrypt"
AtresPlayer-1/com/hurlant/crypto/symmetric/BlowFishKey.class.asasm:84: callpropvoid QName(PrivateNamespace("*", "com.hurlant.crypto.symmetric:BlowFishKey#0"), "decryptBlock"), 4
AtresPlayer-1/com/hurlant/crypto/symmetric/BlowFishKey.class.asasm:847: trait method QName(PrivateNamespace("*", "com.hurlant.crypto.symmetric:BlowFishKey#0"), "decryptBlock")
AtresPlayer-1/com/hurlant/crypto/symmetric/BlowFishKey.class.asasm:849: refid "com.hurlant.crypto.symmetric:BlowFishKey/decryptBlock"
AtresPlayer-1/com/hurlant/crypto/symmetric/CBCMode.class.asasm:134: trait method QName(PackageNamespace(""), "decrypt")
AtresPlayer-1/com/hurlant/crypto/symmetric/CBCMode.class.asasm:136: refid "com.hurlant.crypto.symmetric:CBCMode/decrypt"
AtresPlayer-1/com/hurlant/crypto/symmetric/CBCMode.class.asasm:183: callpropvoid QName(Namespace("com.hurlant.crypto.symmetric:ISym metricKey"), "decrypt"), 2
AtresPlayer-1/com/hurlant/crypto/symmetric/CFB8Mode.class.asasm:145: trait method QName(PackageNamespace(""), "decrypt")
AtresPlayer-1/com/hurlant/crypto/symmetric/CFB8Mode.class.asasm:147: refid "com.hurlant.crypto.symmetric:CFB8Mode/decrypt"
AtresPlayer-1/com/hurlant/crypto/symmetric/CFBMode.class.asasm:157: trait method QName(PackageNamespace(""), "decrypt")
AtresPlayer-1/com/hurlant/crypto/symmetric/CFBMode.class.asasm:159: refid "com.hurlant.crypto.symmetric:CFBMode/decrypt"
AtresPlayer-1/com/hurlant/crypto/symmetric/CTRMode.class.asasm:67: trait method QName(PackageNamespace(""), "decrypt")
AtresPlayer-1/com/hurlant/crypto/symmetric/CTRMode.class.asasm:69: refid "com.hurlant.crypto.symmetric:CTRMode/decrypt"
AtresPlayer-1/com/hurlant/crypto/symmetric/DESKey.class.asasm:70: trait method QName(PackageNamespace(""), "decrypt")
AtresPlayer-1/com/hurlant/crypto/symmetric/DESKey.class.asasm:72: refid "com.hurlant.crypto.symmetric:DESKey/decrypt"
AtresPlayer-1/com/hurlant/crypto/symmetric/ECBMode.class.asasm:175: trait method QName(PackageNamespace(""), "decrypt")
AtresPlayer-1/com/hurlant/crypto/symmetric/ECBMode.class.asasm:177: refid "com.hurlant.crypto.symmetric:ECBMode/decrypt"
AtresPlayer-1/com/hurlant/crypto/symmetric/ECBMode.class.asasm:244: callpropvoid QName(Namespace("com.hurlant.crypto.symmetric:ISym metricKey"), "decrypt"), 1
AtresPlayer-1/com/hurlant/crypto/symmetric/ICipher.class.asasm:22: trait method QName(Namespace("com.hurlant.crypto.symmetric:ICip her"), "decrypt")
AtresPlayer-1/com/hurlant/crypto/symmetric/ICipher.class.asasm:24: refid "com.hurlant.crypto.symmetric:ICipher:decrypt"
AtresPlayer-1/com/hurlant/crypto/symmetric/ISymmetricKey.class.asasm:25: trait method QName(Namespace("com.hurlant.crypto.symmetric:ISym metricKey"), "decrypt")
AtresPlayer-1/com/hurlant/crypto/symmetric/ISymmetricKey.class.asasm:27: refid "com.hurlant.crypto.symmetric:ISymmetricKey:decryp t"
AtresPlayer-1/com/hurlant/crypto/symmetric/IVMode.class.asasm:374: pushstring "an IV must be set before calling decrypt()"
AtresPlayer-1/com/hurlant/crypto/symmetric/OFBMode.class.asasm:63: trait method QName(PackageNamespace(""), "decrypt")
AtresPlayer-1/com/hurlant/crypto/symmetric/OFBMode.class.asasm:65: refid "com.hurlant.crypto.symmetric:OFBMode/decrypt"
AtresPlayer-1/com/hurlant/crypto/symmetric/SimpleIVMode.class.asasm:143: trait method QName(PackageNamespace(""), "decrypt")
AtresPlayer-1/com/hurlant/crypto/symmetric/SimpleIVMode.class.asasm:145: refid "com.hurlant.crypto.symmetric:SimpleIVMode/decrypt"
AtresPlayer-1/com/hurlant/crypto/symmetric/SimpleIVMode.class.asasm:188: callpropvoid QName(Namespace("com.hurlant.crypto.symmetric:ICip her"), "decrypt"), 1
AtresPlayer-1/com/hurlant/crypto/symmetric/TripleDESKey.class.asasm:301: trait method QName(PackageNamespace(""), "decrypt") flag OVERRIDE
AtresPlayer-1/com/hurlant/crypto/symmetric/TripleDESKey.class.asasm:303: refid "com.hurlant.crypto.symmetric:TripleDESKey/decrypt"
AtresPlayer-1/com/hurlant/crypto/symmetric/XTeaKey.class.asasm:202: trait method QName(PackageNamespace(""), "decrypt")
AtresPlayer-1/com/hurlant/crypto/symmetric/XTeaKey.class.asasm:204: refid "com.hurlant.crypto.symmetric:XTeaKey/decrypt"
=====================================

I think only KSV and few others on this forum may be able to help!

I couldn't even record it using RTMPDumpHelper :( Probably due ton the proxy!

Good Luck!

chap 11-10-2013 11:19 PM

Re: Decrypting ts files from m3u8


 

No_Miaus 11-12-2013 04:45 PM

Re: Decrypting ts files from m3u8


 
How did you do it? Explain it please!

chap 11-12-2013 11:20 PM

Re: Decrypting ts files from m3u8


 
Code:

ffmpeg -i "http://geodeswowa3player.antena3.com/vcg/_definst_/smil:assets2/2013/10/25/08D874B3-4B0D-4DB8-844B-1C29D70B1B31/free_es.smil/chunklist_b1348000.m3u8?pulse=assets2%2F2013%2F10%2F25%2F08D874B3-4B0D-4DB8-844B-1C29D70B1B31%2F%7C1384334301%7C4047eaf34d8f8b54a2f3277cc8f4ff44 " -c copy t.ts

hallucinogen 11-13-2013 11:22 PM

Re: Decrypting ts files from m3u8


 
Quote:

Originally Posted by chap (Post 63921)
Code:

ffmpeg -i "http://geodeswowa3player.antena3.com/vcg/_definst_/smil:assets2/2013/10/25/08D874B3-4B0D-4DB8-844B-1C29D70B1B31/free_es.smil/chunklist_b1348000.m3u8?pulse=assets2%2F2013%2F10%2F25%2F08D874B3-4B0D-4DB8-844B-1C29D70B1B31%2F%7C1384334301%7C4047eaf34d8f8b54a2f3277cc8f4ff44 " -c copy t.ts

Chap, how do you get that syntax? How to properly use ffmpeg dumping?

skyDude14 05-20-2014 06:26 PM

Re: Decrypting ts files from m3u8


 
chap thanks for your useful post. can you tell me instead of merging all those decrypted .ts to one big ts we just decrypt each ts file and copy the decrypted ts to diffrent folder ? in another word i want to all those .ts decrypted one by one without joining them .

furthermore after you merged the .ts to one big file why there is not duration shown while playing those .ts ?how to add duration to it?

Hope you help me with it.Thanks



Quote:

Originally Posted by chap (Post 63921)
Code:

ffmpeg -i "http://geodeswowa3player.antena3.com/vcg/_definst_/smil:assets2/2013/10/25/08D874B3-4B0D-4DB8-844B-1C29D70B1B31/free_es.smil/chunklist_b1348000.m3u8?pulse=assets2%2F2013%2F10%2F25%2F08D874B3-4B0D-4DB8-844B-1C29D70B1B31%2F%7C1384334301%7C4047eaf34d8f8b54a2f3277cc8f4ff44 " -c copy t.ts


surya987 05-20-2014 10:26 PM

Re: Decrypting ts files from m3u8


 
SKY... why you want to decrypt one by one.... its useless and really time consuming....FFMPEG download all ts files and than join auto to one ts playable file.....

skyDude14 05-21-2014 04:18 AM

Re: Decrypting ts files from m3u8


 
Quote:

Originally Posted by surya987 (Post 67725)
SKY... why you want to decrypt one by one.... its useless and really time consuming....FFMPEG download all ts files and than join auto to one ts playable file.....

Thanks for reply. i want to stream the hls chunks again but this time without encryption and it would be faster that is why i want to keep the .ts chunks! is there away to decrypt the chunks without merging them ?

surya987 05-21-2014 05:24 AM

Re: Decrypting ts files from m3u8


 
no need to decrupt all dear.. just download with ffmpeg and than again ffmpeg creates multiple ts files for you if you want without encryption..... so chill dear no need to waste lot of time,.......

skyDude14 05-21-2014 05:41 AM

Re: Decrypting ts files from m3u8


 
Quote:

Originally Posted by surya987 (Post 67730)
no need to decrupt all dear.. just download with ffmpeg and than again ffmpeg creates multiple ts files for you if you want without encryption..... so chill dear no need to waste lot of time,.......

How it creates multiple ts files for me without encryption? Can you write the ffmpeg command for doing so?thanks

surya987 05-21-2014 08:43 AM

Re: Decrypting ts files from m3u8


 
1st download encrypted with ffmpeg and than use this commnd to crete multiple files and m3u8 playlist by FFMPEG...

Code:

ffmpeg -re -i source.ts -codec copy -map 0 -f segment -segment_list foo.m3u8 -segment_list_flags +live -segment_time 10 out%03d.ts

skyDude14 05-21-2014 10:52 AM

Re: Decrypting ts files from m3u8


 
Quote:

Originally Posted by surya987 (Post 67740)
1st download encrypted with ffmpeg and than use this commnd to crete multiple files and m3u8 playlist by FFMPEG...

Code:

ffmpeg -re -i source.ts -codec copy -map 0 -f segment -segment_list foo.m3u8 -segment_list_flags +live -segment_time 10 out%03d.ts

Thanks . The segmenting process is very slow! does this command transcode too(changing quality of orginal .ts )?

surya987 05-21-2014 11:07 AM

Re: Decrypting ts files from m3u8


 
no transcode... orignal quality

skyDude14 05-21-2014 12:09 PM

Re: Decrypting ts files from m3u8


 
surya987 .Thanks for teaching me to create segments in ffmpeg.
so ffmpeg can't decrypt m3u8 by keeping the segments intact so we don't waste time re segmenting again ?

Furthermore, when i first merged all the .ts files to one big .ts(using the posted command below) the resulting .ts was not showing video length in vlc player! is there any solution so the big .ts show video length as well ?

Code:

ffmpeg -i "http://www.somesite.com/test.m3u8" -c copy decryptedOutput.ts

surya987 05-21-2014 01:29 PM

Re: Decrypting ts files from m3u8


 
simple output to mp4...

Code:

ffmpeg  -i "link.m3u8" -vcodec copy -acodec copy -absf aac_adtstoasc  output.mp4

jkg 05-22-2014 11:48 AM

Re: Decrypting ts files from m3u8


 
Quote:

Originally Posted by skyDude14 (Post 67749)
the resulting .ts was not showing video length in vlc player! is there any solution so the big .ts show video length as well ?

In VLC, .ts files never show the length of the video. That's how it's always been, at least unless it's been changed in a recent update (doubtful). It's one of the various errors/disadvantages that come with using VLC, if it's a problem then you can always remux or better yet just switch to using MPC.

christam02 08-28-2014 10:29 PM

Re: Decrypting ts files from m3u8


 
I have trouble with m3u8 file. Please help me download this video.
http://movies.hdviet.com/phim-tan-ba...r-kingdom.html
File m3u8: https://www.mediafire.com/?935z8o5q59o30w1
I think it was secured with token:
EXT-X-KEY:METHOD=AES-128,URI="https://api.hdviet.com/token/drm?movieid=7874&token=f55232d9ea6f3577719d33b0b79 12f61"


All times are GMT -6. The time now is 03:43 PM.