Audio/video stream recording forums

Attention Visitor:
You may have to register or log in before you can post:
  • Click the register link to sign up.
  • Registered members please fill in the form below and click the "Log in" button.
To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Audio/video stream recording forums > Streaming media recording forum > Video stream recording
Register FAQ Members List Calendar Mark Forums Read

Reply Post New Thread
 
Thread Tools Display Modes
  #1  
Old 01-25-2017, 04:12 AM
bloodhand bloodhand is offline
Junior Member
 
Join Date: Sep 2016
Posts: 11
bloodhand is on a distinguished road
Default

Download key protected m3u8


Hello!

This is the original link for the video: http://protvplus.ro/produs/apropo-tv...decembrie-2016.

I tried the following ffmpeg batch with no success:
Code:
ffmpeg -i http://cdn.drm.protv.ro/protvplus.ro/2017/01/12/43c7a0a664d7d0fa805d26a047feda05.ism/43c7a0a664d7d0fa805d26a047feda05.m3u8 -c copy -absf aac_adtstoasc video.mp4
The error I get is:
Quote:
HTTP ERROR 403 Forbidden
Unable to open key file http://drmapi.protv.ro/keys/get/protvplus.ro/61307737
I guess I have to download the key file and put it into the folder along with ffmpeg.exe, but I have no idea how to do this...

Thanks in advance.
Reply With Quote
  #2  
Old 01-25-2017, 08:15 PM
bloodhand bloodhand is offline
Junior Member
 
Join Date: Sep 2016
Posts: 11
bloodhand is on a distinguished road
Default

Re: Download key protected m3u8


Nothing, anyone? I tried parsing cookies with various methods, none of them worked... If someone could only guide me what I should start with... maybe I could accomplish it myself after that.
Reply With Quote
  #3  
Old 01-25-2017, 11:32 PM
Irritant4 Irritant4 is offline
Junior Member
 
Join Date: Jan 2017
Posts: 9
Irritant4 is on a distinguished road
Default

Re: Download key protected m3u8


I tried everything I know about but nothing worked


Code:
"E:\video\livestreamer-v1.12.2\livestreamer.exe" "hlsvariant://http://cdn.drm.protv.ro/protvplus.ro/2017/
01/12/43c7a0a664d7d0fa805d26a047feda05.ism/43c7a0a664d7d0fa805d26a047feda05.m3u8" best -o "c:\temp\TEST_1.ts"
[cli][info] Found matching plugin stream for URL hlsvariant://http://cdn.drm.protv.ro/protvplus.ro/2017/01/12/43c7a0a664
d7d0fa805d26a047feda05.ism/43c7a0a664d7d0fa805d26a047feda05.m3u8
[cli][info] Available streams: 136k (worst), 480p (best)
[cli][info] Opening stream: 480p (hls)
[stream.hls][error] Failed to create decryptor: Unable to open URL: http://drmapi.protv.ro/keys/get/protvplus.ro/6130773
7 (403 Client Error: Forbidden)
[cli][error] No data returned from stream
Reply With Quote
  #4  
Old 01-26-2017, 03:11 PM
bloodhand bloodhand is offline
Junior Member
 
Join Date: Sep 2016
Posts: 11
bloodhand is on a distinguished road
Default

Re: Download key protected m3u8


Someone from videohelp forum gave me the solution I already knew about: modify m3u8 to load a local key file instead of url, update every .ts part with full link and place the key file, m3u8 file and ffmpeg in the same folder, then issue -c copy command for that m3u8. But I don't know how he managed to get the key file, as entering key url in browser gives nothing.
Reply With Quote
  #5  
Old 02-09-2017, 07:32 PM
bloodhand bloodhand is offline
Junior Member
 
Join Date: Sep 2016
Posts: 11
bloodhand is on a distinguished road
Default

Re: Download key protected m3u8


I made the guide as requested in PM, hoping it would help others too:

How to:
1) Install Firefox and AdBlock Plus plugin. Then, open the page with the video: http://protvplus.ro/produs/apropo-tv...decembrie-2016 and click ABP icon in upper-right corner and choose Open blockable items.
2) A menu will appear on the bottom and search there for "m3u8". You are interested in this link http://cdn.drm.protv.ro/protvplus.ro...o=1994000.m3u8. Right click on it and choose open in new tab. A download prompt will appear with the m3u8, save it, rename it to "1994000.m3u8" and start editing it with notepad (make sure to have format -> word wrap activated).
3) Click edit -> replace and replace "43c7a0a664d7d0fa805d26a047feda05" with "http://cdn.drm.protv.ro/protvplus.ro/2017/01/12/43c7a0a664d7d0fa805d26a047feda05.ism/43c7a0a664d7d0fa805d26a047feda05" and make sure to replace all.
4) Then, look for "URI="http://drmapi.protv.ro/keys/get/protvplus.ro/61307737"" and replace "http://drmapi.protv.ro/keys/get/protvplus.ro/61307737" with "61307737.key". After this, save the modified m3u8 file.
5) Now, to have the correct key, you need to install Fiddler 2 Portable from here: https://downloads.sourceforge.net/pr...e_mirror=netix. Install it and run it.
6) Now, go to Mozilla and refresh the page with the video: http://protvplus.ro/produs/apropo-tv...decembrie-2016. Keep it running until the video starts playing, then close the tab.
7) Go to Fiddler and look in the list for the key url: "http://drmapi.protv.ro/keys/get/protvplus.ro/61307737". Right click on it and choose decode selected session. Then, right click again and choose inspect in new window. Select Response from top, then go to HexView tab, and select all blue bytes (from F9 to 10), right-click on the selction and choose save selected bytes and save as "61307737.key".
8) Now make a folder an place "61307737.key" and "1994000.m3u8", but also a copy of ffmpeg.exe. Then, create a new batch file with this command without the quote marks: "ffmpeg -protocol_whitelist "file,http,https,tcp,tls,crypto" -i "1994000.m3u8" -c copy 1994000.mp4" and run it and you should see the video downloading successfully.

P.S. When I said select all blue bytes I meant to select the bytes written in blue (dark-blue) font at the end. Select them directly in the hex (don't bother to select the text from the right part) as it's easier.

Also, be careful that the video we talk about is broken (missing segments somewhere in the middle of the video), so it will eventually stop downloading and the video will be unplayable. You have to look and note the last present segment and reedit the m3u8 to stop downloading at that segment. Then, you have to find the first working segment after the missing ones by trial and error, make a new m3u8 and download the second part separately. After that, I had to merge them with ffmpeg concatenate option, because they didn't fix the stream yet and I wanted to keep the working part of the video.
Reply With Quote
  #6  
Old 03-07-2017, 11:05 AM
bloodhand bloodhand is offline
Junior Member
 
Join Date: Sep 2016
Posts: 11
bloodhand is on a distinguished road
Default

Re: Download key protected m3u8


As requested, I uploaded a picture which better explains the "select bytes from F9 to 10" part when saving the key file:
Reply With Quote
  #7  
Old 03-09-2017, 04:12 AM
kumop4 kumop4 is offline
Junior Member
 
Join Date: Mar 2017
Posts: 1
kumop4 is on a distinguished road
Default

Quote:
Originally Posted by bloodhand View Post
Hello! This is the original link for the video: http://protvplus.ro/produs/apropo-tv...decembrie-2016. I tried the following ffmpeg batch with no success:
Code:
ffmpeg -i http://cdn.drm.protv.ro/protvplus.ro/2017/01/12/43c7a0a664d7d0fa805d26a047feda05.ism/43c7a0a664d7d0fa805d26a047feda05.m3u8 -c copy -absf aac_adtstoasc video.mp4
The error I get is: I guess I have to download the key file and put it into the folder along with ffmpeg.exe, but I have no idea how to do this... Thanks in advance.
C??m ??n v?¬ b?*i viá??t hay v?* bổ ?*ch
Reply With Quote
  #8  
Old 03-09-2017, 01:32 PM
troller12 troller12 is offline
Senior Member
 
Join Date: Sep 2013
Posts: 433
troller12 is on a distinguished road
Default

Re: Download key protected m3u8


Hi,

ok I tried it again today and found the problem I had before.So Firefox did output a wrong ASCII string sign.Now it works using the right ASCII string.

greetz
Reply With Quote
  #9  
Old 03-13-2017, 02:58 AM
bloodhand bloodhand is offline
Junior Member
 
Join Date: Sep 2016
Posts: 11
bloodhand is on a distinguished road
Default

Re: Download key protected m3u8


The ASCII characters displayed in Firefox are wrong, this is why you have to use Fiddler to save the key file directly, so no copy/paste involved that might wreck the special characters the key file has.

About reading key file from disk directly without editing the m3u8... Unfortunately, even if ffmpeg/livestreamer had such a parameter, you still have to save the key file using Fiddler, because the key file is generated after some complex cookie send/receive within the http coding, so you can't get the key file any other way. This is why if you leave the original key link into the m3u8 it won't work, because ffmpeg/livestreamer cannot parse cookies. I also tried in the first place to parse special cookies to the m3u8 before editing, but I did not succeed. Also, like I said above, copying and pasting the key code from Firefox might not work if there are special characters involved. You can test this by comparing the key characters from Firefox with the ones from the key file saved with Fiddler and you'll understand what I mean.
Reply With Quote
  #10  
Old 03-13-2017, 12:57 PM
troller12 troller12 is offline
Senior Member
 
Join Date: Sep 2013
Posts: 433
troller12 is on a distinguished road
Default

Re: Download key protected m3u8


Hi again,

yes I see that FF does show wrong ASCII chars so that the problem.Also there is no hex view in FF or Chrome where you could see the right hex bytes you could copy and convert to ASCII.Anyway.

So I checked the site again to see how you get access to the keyfile site and there are only 2 sites called.The first site to prepair the access / allowing to the keyfile site.The first site you can call always successfully and from there you only need to grab the PHPSESSID=* value and the SERVERID=* which you now can use with the keyfile site to make a new request.So this you have to do very quick (just have 3 seconds time) to get successfully access and response = keyfile bytes instead to get status 403 forbidden. Thats all.
Code:
http://drmapi.protv.ro/hlsengine/prepare/
http://drmapi.protv.ro/keys/get/protvplus.ro/61307737
So I am not very common with ffmpeg tool but somehow it should be maybe possible to tell ffmpeg or set paramaters what to do and how to access and prepair the keylink from the playlist.Something like this....
Code:
ffmpeg -i "playlist_link.m3u8" -prelink "http://drmapi.protv.ro/hlsengine/prepare/" (PHPSESSID=*),(SERVERID=*)
...just a idea you know so I dont know whether ffmpeg has such features or not to build something like this.But if so then ffmpeg could read the prepair link first to grab the set cookie paramters from response and to use it if it does access the keyfile link from playlist to get a successfully access to this link to prevent a forbidden access.

greetz
Reply With Quote
Reply Post New Thread
Tags: , , , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -6. The time now is 02:25 AM.


Powered by All-streaming-media.com; 2006-2011
vB forum hacked with Zoints add-ons