Drm-Dash-stream-downloader icon indicating copy to clipboard operation
Drm-Dash-stream-downloader copied to clipboard

Wiki

Open AlvaroBeiro opened this issue 3 years ago • 25 comments

A bit more info on a how to would be great. Even if it's a one line example of usage.

AlvaroBeiro avatar Apr 19 '21 17:04 AlvaroBeiro

Please look at the updated readme for clarity.

Jayapraveen avatar Apr 20 '21 15:04 Jayapraveen

Hi! I spent the whole day trying to make it work, with different video sources, with the multisegment and the single segment... always the same error. I am very new to phyton so hopefully it´s an easy-to-solve issue?

This is the message I keep getting: C:\Users\luis\DRM\dashdownloader.py:77: SyntaxWarning: "is" with a literal. Did you mean "=="? if video.status_code is 200: Traceback (most recent call last): File "C:\Users\luis\DRM\dashdownloader.py", line 142, in video_url,video_keyid,audio_url,audio_keyid = manifest_parser(mpd) File "C:\Users\luis\DRM\dashdownloader.py", line 65, in manifest_parser for prot in adapt_set.content_protections: TypeError: 'NoneType' object is not iterable

Any idea? Thanks!

forhobbie avatar Apr 22 '21 15:04 forhobbie

Looking at the error, I suspect that the manifest has either no Content protection mentioned or is using cbcs or other cipher suites. If you could attach the manifest link, I could suggest you the modification needed.

Jayapraveen avatar Apr 22 '21 16:04 Jayapraveen

Thanks! 2 examples I am after: https://shift72d-131.akamaized.net/50ca514a-f3a8-4fdf-a16f-9d5ee04fe4a2/236617/reel_rock_15.mpd https://dmf9cnjua2s32.cloudfront.net/media/AV2AW6FPZiChQ/ad38062f/stream.mpd I can also send you the links with the KEY in private if that helps

forhobbie avatar Apr 22 '21 17:04 forhobbie

You can try the quickfix commit (d5fbdf1) for the mpd on cloudfront. For the other you'll have to use the multisegmented one. Before running the multisegment, modify the mpd parser for that manifest. You'll probably need to look at mp4box packaging (gpac) for info on how to modify the mpd parser.

Jayapraveen avatar Apr 22 '21 18:04 Jayapraveen

Thanks. For the cloudfront, video and audio are downloaded (but encrypted?) , and I get on cmd the message "Key not found". Something I have to adapt on the keyfile.json? Elsewhere?

forhobbie avatar Apr 22 '21 19:04 forhobbie

The script needs the key that was used to encrypt them in the first place. If you have the key and the keyID, you'll need to insert them in the keyfile.json without changing the format.

Jayapraveen avatar Apr 23 '21 03:04 Jayapraveen

Yes, thanks. I did and it works perfectly. Great work, and thanks for sharing!

forhobbie avatar Apr 23 '21 11:04 forhobbie

Hi. I'm having this error:

Traceback (most recent call last):
  File "D:\Downloads\Drm-Dash-stream-downloader-master\Drm-Dash-stream-downloader-master\dashdownloader_multisegment.py", line 213, in <module>
    media_info = manifest_parser(mpd)
  File "D:\Downloads\Drm-Dash-stream-downloader-master\Drm-Dash-stream-downloader-master\dashdownloader_multisegment.py", line 176, in manifest_parser
    running_time = durationtoseconds(mpd.media_presentation_duration)
  File "D:\Downloads\Drm-Dash-stream-downloader-master\Drm-Dash-stream-downloader-master\dashdownloader_multisegment.py", line 61, in durationtoseconds
    second = seconds.match(period).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

Do you know by any chance what's wrong?

AlvaroBeiro avatar Apr 23 '21 15:04 AlvaroBeiro

The regex pattern for seconds failed to extract seconds information. I'm really unsure why it failed, Ill rollout a fix for this.

Jayapraveen avatar Apr 23 '21 17:04 Jayapraveen

So did you find what was causing it? Because I have no clue.

AlvaroBeiro avatar Apr 30 '21 07:04 AlvaroBeiro

Fixed in the latest release.

Jayapraveen avatar Apr 30 '21 13:04 Jayapraveen

Now I'm closer, thanks! But still it throws an error:

0 2 8 1.920
audio/mp4
Traceback (most recent call last):
  File "D:\Descargas\Drm-Dash-stream-downloader\dashdownloader_multisegment.py", line 212, in <module>
    media_info = manifest_parser(mpd)
  File "D:\Descargas\Drm-Dash-stream-downloader\dashdownloader_multisegment.py", line 177, in manifest_parser
    for segment in repr.segment_templates:
TypeError: 'NoneType' object is not iterable

Thank you so much.

AlvaroBeiro avatar May 01 '21 22:05 AlvaroBeiro

It is because you havent modified the mpd parser according to your manifest.

Jayapraveen avatar May 02 '21 09:05 Jayapraveen

It is because you havent modified the mpd parser according to your manifest.

I am having a similar issue:

Total time: 0 days 0 hours 44 minutes and 26.530312 seconds Processing audio/mp4 Media segments are of equal timeframe Traceback (most recent call last): File "dashdownloader_multisegment.py", line 212, in <module> media_info = manifest_parser(mpd) File "dashdownloader_multisegment.py", line 197, in manifest_parser for prot in repr.content_protections: TypeError: 'NoneType' object is not iterable

Can you help me understand what are some example moidfications to the mpd parser?

miztertea avatar Jun 01 '21 19:06 miztertea

The MPD or Manifest contains the media information for Playback, We have to extract the Media information especially how the media is segmented , timeframe details , encryption scheme used and the url for the segments. The mpd parser function is used to grab those information. I have not used third party downloaders for downloading and merging the media segments as some vendors have made changes to the manifest to make thirdparty tools fail downloading properly, thats why we need to customize the function to every usecase.

  1. The best way to make the customizations yourself is get the sample of the manifest.
  2. Try to compare the iteration operation done by the mpdparser function on various attributes of the Manifest.
  3. Once you have an idea on what each step of the function is doing, recreate the same according to your manifest file.

Jayapraveen avatar Jun 03 '21 11:06 Jayapraveen

i m getting this error File "dashdownloader_multisegment.py", line 204, in media_info = manifest_parser(mpd) File "dashdownloader_multisegment.py", line 163, in manifest_parser running_time = durationtoseconds(mpd.media_presentation_duration) File "dashdownloader_multisegment.py", line 50, in durationtoseconds if(period[:2] == "PT"): TypeError: 'NoneType' object has no attribute 'getitem'

my mpd url hav this publishTime="2021-06-04T11:51:54Z" minimumUpdatePeriod="PT30S" availabilityStartTime="2021-06-02T14:02:08Z" minBufferTime="PT6S" suggestedPresentationDelay="PT20S" timeShiftBufferDepth="PT10M0S" profiles="urn:mpeg:dash:profile:isoff-live:2011"> <Period start="PT0S" id="1"> <AdaptationSet mimeType="video/mp4" frameRate="25/1" segmentAlignment="true"

steamupeu avatar Jun 04 '21 11:06 steamupeu

@fijo33, The mpd link should be replaced with the sample one in the driver code found at https://github.com/Jayapraveen/Drm-Dash-stream-downloader/blob/1d2d2edc6d7b87f08744cb7979e6e7843a90231c/dashdownloader_multisegment.py#L209

Jayapraveen avatar Jun 09 '21 18:06 Jayapraveen

i m getting this error File "dashdownloader_multisegment.py", line 204, in media_info = manifest_parser(mpd) File "dashdownloader_multisegment.py", line 163, in manifest_parser running_time = durationtoseconds(mpd.media_presentation_duration) File "dashdownloader_multisegment.py", line 50, in durationtoseconds if(period[:2] == "PT"): TypeError: 'NoneType' object has no attribute 'getitem'

my mpd url hav this publishTime="2021-06-04T11:51:54Z" minimumUpdatePeriod="PT30S" availabilityStartTime="2021-06-02T14:02:08Z" minBufferTime="PT6S" suggestedPresentationDelay="PT20S" timeShiftBufferDepth="PT10M0S" profiles="urn:mpeg💨profile:isoff-live:2011"> <AdaptationSet mimeType="video/mp4" frameRate="25/1" segmentAlignment="true"

steamupeu avatar Jun 09 '21 22:06 steamupeu

@fijo33, Need stack trace. Looks like the request to your manifest needs some authentication.

Jayapraveen avatar Jun 10 '21 17:06 Jayapraveen

@steamupeu, You will need to modify the script as mentioned.

The MPD or Manifest contains the media information for Playback, We have to extract the Media information especially how the media is segmented , timeframe details , encryption scheme used and the url for the segments. The mpd parser function is used to grab those information. I have not used third party downloaders for downloading and merging the media segments as some vendors have made changes to the manifest to make thirdparty tools fail downloading properly, thats why we need to customize the function to every usecase.

  1. The best way to make the customizations yourself is get the sample of the manifest.
  2. Try to compare the iteration operation done by the mpdparser function on various attributes of the Manifest.
  3. Once you have an idea on what each step of the function is doing, recreate the same according to your manifest file.

Jayapraveen avatar Jun 10 '21 17:06 Jayapraveen

@fijo33, I can help you, if you give a better understanding of what youre trying to do, what you did and what didnt work out.

Jayapraveen avatar Jun 13 '21 13:06 Jayapraveen

Does this work with dynamic mpd? Thanks

andrewzhong1122 avatar Jul 04 '21 09:07 andrewzhong1122

I am getting Traceback (most recent call last): File "dashdownloader_multisegment.py", line 212, in <module> media_info = manifest_parser(mpd) File "dashdownloader_multisegment.py", line 170, in manifest_parser mpd = MPEGDASHParser.parse("./manifest.mpd") File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\mpegdash\parser.py", line 31, in parse return parse_child_nodes(xml_root_node, 'MPD', MPEGDASH)[0] TypeError: 'NoneType' object is not subscriptable while trying from https://edgecastcdnsecure.hbogo.eu/d919b023-606c-6b89-f4e3-45ac1567acef_m125765_hbo/COMP/139896597_pol_comp_2e7ef8a5-dc90-4bfc-99ea-f2247ac75e50_3400000_v2.ism/manifest

Masterbasterx avatar Aug 10 '21 16:08 Masterbasterx

can you plz make a video how you use it , we are not that techy

manafn avatar Sep 08 '21 00:09 manafn