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-08-2017, 02: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,

nice infos and step by step tut bloodhand,thank you for this.So I tried it to check whether it works but ffmpeg makes trouble and gives me a error message about "error when loading first segment ...invalid data found...".So it does stop on first ts segment.Also dosent work if I add header datas.Also get same error infos if I just use the playlist http link.Something is going wrong.

About the keyfile.Did you save the content of this as ASCII sting or in hex bytes?In browser console you can find the ASCII key.In my case...
Code:
??Ä×±?ZEb¦n÷\ ]

F93FC4D7B1CA5A4562A66EF75C205D10
Is there no option paramters for ffmpeg / livestreamer to to use keyfile from disk instead to read it from the playlist?Then you wouldnt need to download & edit the playlist anymore.

greetz
Reply With Quote
  #8  
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
  #9  
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
  #10  
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
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 12:56 PM.


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