SoMuchForSubtlety / f1viewer

🏎️ TUI for F1TV
GNU General Public License v3.0
757 stars 65 forks source link

Widevine DRM enabled for streams #233

Open maturd opened 2 years ago

maturd commented 2 years ago

Please check the FAQ and search existing issues before you submit a new one!

Describe the bug Whatever live feed I try to open (MPV, IINA, VLC) I only get a grey screen with no audio. If I try to copy to clipboard and open the link in Safari I don't get a video there too but it download a .mpd file that is unplayable.

To Reproduce Steps to reproduce the behavior:

  1. Select any live feed 2. Try to open it with any player or copy the link to open it in a browser

Expected behaviour Play feed

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

F1TV account plan Pro Account. No VPN

Desktop (please complete the following information):

Logs If applicable please provide the relevant portion of your logs. You can find them by running f1viewer -logs.

notarobot1337 commented 2 years ago

This is the smallest problem, I would say, Bento4-SDK needs to be integrated into the script, the order of events being download, decrypt, play...

Yes, but that still requires knowing how the mpd segments fall, as this seems different in archive to race day

crisgsm33 commented 2 years ago

The information is in the header, only the decryption key can decipher the order and size of the chunks, which is between 2 and 4 sec for .mpd files. Also, .mpd files do not have a codec, it is set by FFmpeg after the script, so it does not work with a simple video and audio copy.

crisgsm33 commented 2 years ago

There are some dowloader software, like youtube-dl, that works with command prompt, that would know how to download .mpd in chunks, I don't know how much and how it would work live.

maturd commented 2 years ago

Is tvOS (Apple TV) working .mpd files differently (and in an easier way)? VroomTV (F1AppleTV) stopped to work after the token issue first, and re-introduction of DRM after, but @NoahFetz worked out a solution in such short time. Issue 55

NoahFetz commented 2 years ago

Is tvOS (Apple TV) working .mpd files differently (and in an easier way)? VroomTV (F1AppleTV) stopped to work after the token issue first, and re-introduction of DRM after, but @NoahFetz worked out a solution in such short time. Issue 55

All Apple clients (Safari Browser, iPhone, AppleTV etc.) get m3u8 encrypted with Apple's DRM called FairPlay. As far as I know this only works on Apple devices.

anthonylavado commented 2 years ago

Noah is correct. F1TV puts out two DRM streams. One is Widevine, the other is FairPlay. Widevine is used for most clients (web, Android, Android TV, Fire TV devices), and FairPlay is used exclusively for Apple devices/software (Safari, iOS/iPadOS/tvOS app).

On the Apple side, it's a little bit easier to deal with since there are system modules you can call to handle it.

maturd commented 2 years ago

Noah is correct. F1TV puts out two DRM streams. One is Widevine, the other is FairPlay. Widevine is used for most clients (web, Android, Android TV, Fire TV devices), and FairPlay is used exclusively for Apple devices/software (Safari, iOS/iPadOS/tvOS app).

On the Apple side, it's a little bit easier to deal with since there are system modules you can call to handle it.

So right now, it could be possible to let f1viewer users on Mac to use this different DRM stream easily? Could be a possible scenario @SoMuchForSubtlety ? Or is a difficult workaround to introduce just for Mac users?

anthonylavado commented 2 years ago

@maturd Not to respond for the maintainer but, when I say "system modules", I'm referring to an app written in Apple's own Objective-C or Swift languages. VROOM TV is a native app on Apple TV, that's why it can do that. It's not as easy as enabling something for a Mac build. F1Viewer just launches playback though - it's not trying to be the player. It's not the stream URL retrieval that needs DRM support, it's the player.

I wonder if setting the useragent to be the iOS F1TV app will provide a FairPlay stream that could be viewed in QuickTime though.

howlett commented 2 years ago

Is there a branch to test for this weekend?

PostMalone commented 2 years ago

Is there a branch to test for this weekend?

Probably not. DRM is probably extremely hard to bypass

notarobot1337 commented 2 years ago

Is there a branch to test for this weekend?

Probably not. DRM is probably extremely hard to bypass

DRM isn't hard to bypass (WV at least isn't), getting ffmpeg to playback encrypted with the key is where I'm falling down, but I know it will work if someone with FFmpeg knowledge has some time to take a look.

I was able to download an existing mpd, decrypt it, then play it back with no issues.

SamPro910 commented 2 years ago

@notarobot1337 that means good things, no? Not an expert, but I mean we're at least 10% there, surely?

Psidium commented 2 years ago

Can we can use mpv to view it with --demux-lavf-o=decryption_key=<key>? (--mpv-demux-lavf-o=decryption_key=<key> on iina) https://github.com/mpv-player/mpv/issues/8286

notarobot1337 commented 2 years ago

mpv-player/mpv#8286

Not testing, there's been some progress made elsewhere though, perhaps the author could get in touch.

If you wanna test this with key msg me on TG

Vallesuski commented 2 years ago

mpv-player/mpv#8286

Not testing, there's been some progress made elsewhere though, perhaps the author could get in touch.

If you wanna test this with key msg me on TG

This is good news. You should provide more details so author can review it.

notarobot1337 commented 2 years ago

Alternatively, you could use ffplay/ffmpeg to open the stream, then pipe the audio/video output to another player of your choice (see https://stackoverflow.com/questions/44939166/ffmpeg-how-to-produce-mp4-cenc-common-encryption-videos/44949160#44949160 -decryption_key argument).

@synegic please don't suggest this option. From my research, no one has been able to successfully use FFmpeg to decrypt any Widevine, even with a valid key. If you have done it, please post proof.

He’s completely right for this suggestion as it does work with the correct set up.

As for posting proof on a public GitHub… I don’t see that as a good idea….

f1multiviewer commented 2 years ago

disclosure: I'm the developer of MultiViewer for F1, hope this is ok to post here

Since other 3rd-party apps were rendered useless for live broadcasts, I started working on my own application, which uses Electron (with content decryption module, from CastLabs). It uses the same player as F1TV, but it uses a different configuration that leads to a better sync, less stalling/buffering, and a more pleasant viewing experience overall. I was also able to add Live Timing overlays (on live sessions for now) that can be synced with the driver on-boards to show live telemetry on top of the OBC player. Still working on a better sync during replays and to allow live-timing to work on replays.

I hope to open-source it at some point, but it's already available to try (and many have tried last race):

https://beta.f1mv.com/ https://www.reddit.com/r/F1TV/comments/v35muj/sneak_peak_of_f1_multiviewer_a_desktop_app/ https://www.reddit.com/r/F1MultiViewer/

I'm also on Discord (invite on the beta site), to help other 3rd-party apps if they are using the same (web-based) approach.

Vallesuski commented 2 years ago

disclosure: I'm the developer of MultiViewer for F1, hope this is ok to post here

Since other 3rd-party apps were rendered useless for live broadcasts, I started working on my own application, which uses Electron (with content decryption module, from CastLabs). It uses the same player as F1TV, but it uses a different configuration that leads to a better sync, less stalling/buffering, and a more pleasant viewing experience overall. I was also able to add Live Timing overlays (on live sessions for now) that can be synced with the driver on-boards to show live telemetry on top of the OBC player. Still working on a better sync during replays and to allow live-timing to work on replays.

I hope to open-source it at some point, but it's already available to try (and many have tried last race):

https://beta.f1mv.com/ https://www.reddit.com/r/F1TV/comments/v35muj/sneak_peak_of_f1_multiviewer_a_desktop_app/ https://www.reddit.com/r/F1MultiViewer/

I'm also on Discord (invite on the beta site), to help other 3rd-party apps if they are using the same (web-based) approach.

Are you able to download the video right after live session ends with no DRM?

f1multiviewer commented 2 years ago

disclosure: I'm the developer of MultiViewer for F1, hope this is ok to post here Since other 3rd-party apps were rendered useless for live broadcasts, I started working on my own application, which uses Electron (with content decryption module, from CastLabs). It uses the same player as F1TV, but it uses a different configuration that leads to a better sync, less stalling/buffering, and a more pleasant viewing experience overall. I was also able to add Live Timing overlays (on live sessions for now) that can be synced with the driver on-boards to show live telemetry on top of the OBC player. Still working on a better sync during replays and to allow live-timing to work on replays. I hope to open-source it at some point, but it's already available to try (and many have tried last race): https://beta.f1mv.com/ https://www.reddit.com/r/F1TV/comments/v35muj/sneak_peak_of_f1_multiviewer_a_desktop_app/ https://www.reddit.com/r/F1MultiViewer/ I'm also on Discord (invite on the beta site), to help other 3rd-party apps if they are using the same (web-based) approach.

Are you able to download the video right after live session ends with no DRM?

No, MultiViewer is meant to be a viewer only, not to aid downloading, for this, RaceControl and F1Viewer are still both great options :)