Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Video result in green or gray screen / DRM encrypted #438

Open
ricoloic opened this issue Jun 19, 2024 · 51 comments
Open

Video result in green or gray screen / DRM encrypted #438

ricoloic opened this issue Jun 19, 2024 · 51 comments
Labels
bug Something isn't working

Comments

@ricoloic
Copy link

Describe the bug
When using the commands download and archive the resulting video output is a green or gray screen, have tried on both windows and mac. FYI I have used the crunchy-cli earlier this week without issues.

I also tried different shows and different seasons without success. I also tried with and without ffmpeg-preset to (h264-apple-lossless, h264) and lastly tried saving to mp4 and mkv with no success

The resulting video is the expected size (if not reencoding) which is weird

Also the audio and/or sublitle would work properly even if the tracks are there.

To Reproduce
Steps / command to reproduce the behavior:

ccrunchy-cli --speed-limit 25MB --credentials 'email:password' --experimental-fixes download --audio ja-JP --universal-output --output "{series_name} - {season_number}x{episode_number} - {title}.mp4" https://www.crunchyroll.com/series/G4PH0WJPN/the-banished-former-hero-lives-as-he-pleases\[E1\]

Expected behavior
I expect the output not to be a video where the background is green or gray and the audio to work along with the subtitles

Screenshots
If applicable, add screenshots to help explain your problem.

2024-06-18.21-29-34.mov

Client (please complete the following information):

  • OS: mac (also tried on windows)
  • Version: crunchy-cli 3.6.6

Additional context
Add any other context about the problem here.

@ricoloic ricoloic added the bug Something isn't working label Jun 19, 2024
@Elwador
Copy link

Elwador commented Jun 19, 2024

Crunchyroll updated the switch endpoint that it uses drm protection - i guess that is the problem here

@ricoloic
Copy link
Author

Crunchyroll updated the switch endpoint that it uses drm protection - i guess that is the problem here

thanks for letting me know, will be following the thread in yt-dlp repo

@bytedream bytedream changed the title Video result in green or gray screen Video result in green or gray screen / DRM encrypted Jun 19, 2024
@bytedream
Copy link
Member

bytedream commented Jun 19, 2024

From what I've heard, the switch app got updated recently. Unfortunately I'm unable to get the new version and see what exactly changed.
The fact that the switch doesn't support DRM hasn't changed (I can't find any source that claims that any switch app uses widevine or playready), so my guess is that all streams which aren't requested by the latest version/credentials of the switch app are now DRM encrypted

@hazy-kun
Copy link

From what I've heard, the switch app got updated recently. Unfortunately I'm unable to get the new version and see what exactly changed. The fact that the switch doesn't support DRM hasn't changed (I can't find any source that claims that any switch app uses widevine or playready), so my guess is that all streams which aren't requested by the latest version/credentials of the switch app are now DRM encrypted

Changin user agent to switch version 18.1.0 and latest version of Crunchyroll app (I don't know waht is) will solve the problem?

@bytedream
Copy link
Member

Already tried that, doesn't work

@bytedream bytedream pinned this issue Jun 19, 2024
@bytedream
Copy link
Member

According to #439 and from what I can see by analyzing the requests done by the switch app, they used DRM system is OMA DRM

@Nichokas
Copy link

Yesterday there wasn´t any problem but today the videos are corrupt by the DRM

@Nichokas
Copy link

I was able to get a wideview request of the desktop version (https://cr-license-proxy.prd.crunchyrollsvc.com/v1/license/widevine)

image
response.json

@bytedream
Copy link
Member

bytedream commented Jun 20, 2024

Decrypting the widevine drm stream with the matching keys is doable in theory. But I won't add it, it's in a legal grayzone and might lead to a DMCA takedown of the whole project.
Idk how the OMA DRM works, if it doesn't require some sort of private keys like widevine does, I might add decrypting

@dok1100
Copy link

dok1100 commented Jun 20, 2024

As far as I know, it doesn't work without keys. I can't say whether the Switch has a different solution.
We won't know until someone finds out or we have to wait until there's a drm-free stream again...
But bytedream, is it possible to only load the subs, fonts and chapters?

@Nichokas
Copy link

Decrypting the widevine drm stream with the matching keys is doable in theory. But I won't add it, it's in a legal grayzone and might lead to a DMCA takedown of the whole project. Idk how the OMA DRM works, if it doesn't require some sort of private keys like widevine does, I might add decrypting

What if the program did not have the keys in it, but the user or the program had to obtain them when it was running, would that also be illegal?

@Nichokas
Copy link

Nichokas commented Jun 20, 2024

Decrypting the widevine drm stream with the matching keys is doable in theory. But I won't add it, it's in a legal grayzone and might lead to a DMCA takedown of the whole project. Idk how the OMA DRM works, if it doesn't require some sort of private keys like widevine does, I might add decrypting

I will try to get the switch network trafic for see how it works

@Nichokas
Copy link

Nichokas commented Jun 20, 2024

on iOS uses fairPlay DRM but also it has key to decrypt

@ghost
Copy link

ghost commented Jun 20, 2024

OMA DRM is not documented well, so I doubt there will be a way to bypass it for now.

@hajimekun
Copy link

hajimekun commented Jun 20, 2024

OMA encryption is based on license object and AES encrypted video and encrypted key using RSA with private and public key, if s/he don't wanna fall in the "grey zone" (actually It never been gray) the development of this software ends here.
In my view supporting self-provided cdm is not a big matter, there are other softwares on GH that supports this.
I like the rust implementation, better than nodejs or others.

@bashonly
Copy link

are you sure it's OMA?

from an mpd to served to the switch client:

      <ContentProtection xmlns:mspr="urn:microsoft:playready" schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">

@hajimekun
Copy link

hajimekun commented Jun 20, 2024

are you sure it's OMA?

from an mpd to served to the switch client:

      <ContentProtection xmlns:mspr="urn:microsoft:playready" schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">

Trusted source said that but I can't verify 'cause i donno how to inspect Switch traffic, as said before ByteDance checked it using switch

@ghost
Copy link

ghost commented Jun 20, 2024

are you sure it's OMA?

from an mpd to served to the switch client:

      <ContentProtection xmlns:mspr="urn:microsoft:playready" schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">

Are you inspecting the switch traffic rn?

@bashonly
Copy link

that's what yt-dlp gets when making a request to the switch stream endpoint w/ switch UA

@ghost
Copy link

ghost commented Jun 20, 2024

that's what yt-dlp gets when making a request to the switch stream endpoint w/ switch UA

Yeah but we don't know if crunchyroll sends different mpds if you don't have the correct headers

@Nichokas
Copy link

Nichokas commented Jun 20, 2024

Will you consider implementing L3 Widevine keys or will you continue to investigate the DRM of the enpoint of the switch?

@bytedream
Copy link
Member

are you sure it's OMA?

The switch does a request to cr-license-proxy.prd.crunchyrollsvc.com/v1/license/omaV3 to get the oma license

@Nichokas
Copy link

are you sure it's OMA?

The switch does a request to cr-license-proxy.prd.crunchyrollsvc.com/v1/license/omaV3 to get the oma license

Most likely, if it's oma DRM, did you find any documentation?

@bytedream
Copy link
Member

Most likely, if it's oma DRM, did you find any documentation?

The official spec

@Nichokas
Copy link

Most likely, if it's oma DRM, did you find any documentation?

The official spec

thanks

@bytedream
Copy link
Member

What if the program did not have the keys in it, but the user or the program had to obtain them when it was running, would that also be illegal?

That's a good question.
I'm in Germany and according to the laws here it's forbidden to distribute or even create a program whose main use is circumventing technical measures for the protection of media (DRM) (§ 95a Abs. 3 UrhG is the exact law). The US law, where Crunchyroll/Sony is based, also forbids it: "It criminalizes production and dissemination of technology, devices, or services intended to circumvent measures that control access to copyrighted works" (according to Wikipedia).
So, is the main purpose of crunchy-cli decrypting? I would say no, but Sony might have a different view. And even if it's not illegal, I do not have the (financial) resources to do anything against a takedown of the repo/project

@bytedream
Copy link
Member

bytedream commented Jun 20, 2024

GitHub has a repo where all DCMA takedown requests are listed. When searching for major platforms like Netflix or Amazon it gives plenty of results.
One takedown is related to "NETFLIX-DL-6.1.0" and some other projects. When searching up the name on google there are some backups on private gitea repos, and according to them they also need externally provided DRM keys

@Hartie95
Copy link

Hartie95 commented Jun 20, 2024

What if the user needs to provide an application/script to get the keys themself, which then gets called with specific input parameters and is expected to output in a specific format?
In that case something else would do the drm handling to get the key for the decryption, while crunchycli would only use the resulting AES key, would that maybe be better?

@bytedream
Copy link
Member

I thought of this too, like a plugin system. cloudstream does that too

@hama3254
Copy link

GitHub has a repo where all DCMA takedown requests are listed. When searching for major platforms like Netflix or Amazon it gives plenty of results. One takedown is related to "NETFLIX-DL-6.1.0" and some other projects. When searching up the name on google there are some backups on private gitea repos, and according to them they also need externally provided DRM keys

DRM or not CR already made DMCA takedowns years ago.
I am still not sure why they stopped?

@ghost
Copy link

ghost commented Jun 21, 2024

DRM or not CR already made DMCA takedowns years ago. I am still not sure why they stopped?

Maybe they don't care anymore

@bytedream
Copy link
Member

Or maybe they had hardcoded credentials? Sadly I can't find a backup to check

@Ziedelth
Copy link

Ziedelth commented Jun 21, 2024

@babupakkakivellu
Copy link

babupakkakivellu commented Jun 21, 2024

I only found one backup, if needed: https://web.archive.org/web/20191209023630/https://github.com/ThePBone/CrunchyrollDownloader

Can You Please Tell To How To Execute This ?

@Ziedelth
Copy link

My mistake, I thought I could navigate through the files.

@smile-2023
Copy link

Maybe you can try this Crunchyroll-Downloader-v4.0

Not tested!

@hazy-kun
Copy link

Maybe you can try this Crunchyroll-Downloader-v4.0

Not tested!

It works flawlessy

@ricoloic
Copy link
Author

So even if the video downloading is not supported due to legal reason, would there be a way to still download the subtitles as files (ass or srt) with a flag?

crunchy-cli --credentials 'email:password' download --subtitle-only --subtitle all \
    --output "{series_name} - {season_number}x{episode_number} - {title} - {language}.ass" https://www.crunchyroll.com/series/G4PH0WJPN/the-banished-former-hero-lives-as-he-pleases

or

crunchy-cli --credentials 'email:password' subtitle-download --subtitle all \
    --output "{series_name} - {season_number}x{episode_number} - {title} - {language}.ass" https://www.crunchyroll.com/series/G4PH0WJPN/the-banished-former-hero-lives-as-he-pleases

@smile-2023
Copy link

smile-2023 commented Jun 21, 2024

So even if the video downloading is not supported due to legal reason, would there be a way to still download the subtitles as files (ass or srt) with a flag?

I do this:

yt-dlp --username "[email protected]" --password "XYZ" --user-agent "Crunchyroll/1.8.0 Nintendo Switch/12.3.12.0 UE4/4.27" --sub-langs "de-DE" --write-description --write-thumbnail --write-subs --skip-download --allow-unplayable-formats --extractor-args "crunchyrollbeta:hardsub=de-DE" http...

With this, you get *.ass, *.jpe and *.description.

For "de-DE" set your own Country.

@ricoloic
Copy link
Author

ricoloic commented Jun 21, 2024

So even if the video downloading is not supported due to legal reason, would there be a way to still download the subtitles as files (ass or srt) with a flag?

I do this:

yt-dlp --username "[email protected]" --password "XYZ" --user-agent "Crunchyroll/1.8.0 Nintendo Switch/12.3.12.0 UE4/4.27" --sub-langs "de-DE" --write-description --write-thumbnail --write-subs --skip-download --allow-unplayable-formats --extractor-args "crunchyrollbeta:hardsub=de-DE" http...

With this, you get *.ass, *.jpe and *.description.

Awesome thanks for sharing will be trying this out, didn't though of just using yt-dlp. But I'm surprise to see that you don't provide a cookie file ?

@smile-2023
Copy link

But I'm surprise to see that you don't provide a cookie file ?

Its ok. Since --user-agent "Crunchyroll/1.8.0 Nintendo Switch/12.3.12.0 UE4/4.27" Cookies no longer used.

@ricoloic
Copy link
Author

Its ok. Since --user-agent "Crunchyroll/1.8.0 Nintendo Switch/12.3.12.0 UE4/4.27" Cookies no longer used.

Good to know thank you for sharing

@hazy-kun
Copy link

The latest UA is Crunchyroll/1.9.0 Nintendo Switch/18.1.0.0 UE4/4.27 but i can't confirm for UE4

@smile-2023
Copy link

The latest UA is Crunchyroll/1.9.0 Nintendo Switch/18.1.0.0 UE4/4.27 but i can't confirm for UE4

Thanks.

@p47-6
Copy link

p47-6 commented Jun 26, 2024

What if the user needs to provide an application/script to get the keys themself, which then gets called with specific input parameters and is expected to output in a specific format? In that case something else would do the drm handling to get the key for the decryption, while crunchycli would only use the resulting AES key, would that maybe be better?

Thats maybe a stupid question because i do not realy know how drm works: Wouldn't it be possible to download the encrypted files with crunchy-cli and then get something like a post-processing hook and decrpyt the files with ffmpeg or so ? As far as i understood Tools like wvdumper get you the private keys to decrypt the stuff.

@bytedream
Copy link
Member

This may still count as help to download protected media, which is illegal in my country

@ghost
Copy link

ghost commented Jun 26, 2024

This may still count as help to download protected media, which is illegal in my country

You could pass the project to someone that doesn't live in a country where its illegal to bypass it

@Hartie95
Copy link

This may still count as help to download protected media, which is illegal in my country

You could pass the project to someone that doesn't live in a country where its illegal to bypass it

That would not protect the project from a dmca takedown.

@p47-6
Copy link

p47-6 commented Jun 26, 2024

That's a tricky problem to solve then.
What prevents similar projects from a DMCA takedown? They obviously are trying to prevent people from downloading their content so i cannot believe that they are just ignoring it. Maybe they are letting us do the work searching unprotected endpoints or other loopholes but then they should take down all the other projects that are using encrypted endpoints.

@ghost
Copy link

ghost commented Jun 28, 2024

That would not protect the project from a dmca takedown.

There are crunchyroll downloader repositories with widevine bypass integration that are years old, they never got dmca'd, because they don't provide the device keys needed to do the widevine request.

@Ziedelth
Copy link

Another project works with DRM downloads; the procedure is a little time-consuming, but works very well. However, I don't know if it's legal: https://github.com/OpenSTDL/CrunchyDL/discussions/23

@bytedream bytedream mentioned this issue Jul 1, 2024
@bytedream bytedream unpinned this issue Jul 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests