Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couldn't fetch DOLBY ATMOS track. #5

Open
shahzoorali opened this issue Jan 19, 2020 · 45 comments
Open

Couldn't fetch DOLBY ATMOS track. #5

shahzoorali opened this issue Jan 19, 2020 · 45 comments

Comments

@shahzoorali
Copy link

TIDAL has some new content with DOLBY ATMOS processed tracks. I tried to fetch that but always gets the LOSSLESS file.

Test URL - https://tidal.com/browse/track/125155092
OR
Search for Blinding Lights and select the 3rd one.

@evan-goode
Copy link
Owner

Good catch, thanks for the report! Should be fixed in 3b321e1. TIDAL is full of these annoying edge cases unfortunately.

@shahzoorali
Copy link
Author

That means, we cant download the DOLBY ATMOS file? As I see, you are redirecting to LOSSLESS quality if DOBLY_ATMOS. Am I right?

@evan-goode
Copy link
Owner

Ah I totally misunderstood the issue. I'm having a little trouble getting the official client to stream/download a DOLBY_ATMOS track, but once I can see what the API call looks like, this shouldn't be hard to do.

@evan-goode evan-goode reopened this Jan 24, 2020
@shahzoorali
Copy link
Author

Its only playable from Dolby supported device, my Android is. How can I "fiddler" my device?

@evan-goode
Copy link
Owner

I use mitmproxy: https://mitmproxy.org/

@shahzoorali
Copy link
Author

I tried capturing the network, but instead of browser, it cannot capture any app traffic. It seems I need to download the TIDAL apk, decompile, make some changes that it accepts USER installed certificats into its build and compile. I dont think I can do all that.

If I get TIDAL modified apk, I can help with further traffic report to fetch DOLBY ATMOS stream.

@evan-goode
Copy link
Owner

Just got MQA support working, and I'd like to figure out Dolby audio as well. Still willing to help out?

Yes, you can patch the APK manually to disable cert pinning, but this Xposed module works great with TIDAL: https://github.com/ViRb3/TrustMeAlready. If you're on Android 9 or 10, you can use https://github.com/ElderDrivers/EdXposed instead of the original Xposed.

@112RG
Copy link

112RG commented May 16, 2020

Either MITM it being weird or the Dolby Atmos tracks are tiny. Are you telling me that a track with 3d audio is <7MB ?. + I don't think there is a file format for Atmos is there?

@shahzoorali
Copy link
Author

Just got MQA support working, and I'd like to figure out Dolby audio as well. Still willing to help out?

Yes, you can patch the APK manually to disable cert pinning, but this Xposed module works great with TIDAL: https://github.com/ViRb3/TrustMeAlready. If you're on Android 9 or 10, you can use https://github.com/ElderDrivers/EdXposed instead of the original Xposed.

Oh yes.

@112RG
Copy link

112RG commented May 16, 2020

It looks like the only difference in getting a Atmos track is "audioMode": "DOLBY_ATMOS" Which does result in a different flac file then without it

Track with DOLBY_ATMOS in the request is 16.3mb (But seems to just be an MQA file)
Track without it is 16.5mb

@shahzoorali
Copy link
Author

shahzoorali commented May 16, 2020

@Dniel97 said:

"Tidal uses according to a German website
https://www.heise.de/newsticker/meldung/3D-Musikformat-Dolby-aeussert-sich-zur-Zukunft-von-Dolby-Atmos-Music-4630101.html Dolby AC-4 which is a proprietary format from Dolby Laboratories. Even when you can download the Dolby AC-4 file, there is (currently) no way to playback these files, read more here:
https://en.wikipedia.org/wiki/Dolby_AC-4. Here is an example ac-4 file: https://github.com/google/ExoPlayer/blob/release-v2/library/core/src/test/assets/ts/sample.ac4 where you can try playing this file."

What I think, the 16MB request could be the audio file without the AC-4 filter and it requests AC-4 filter file separately and process while streaming.

@112RG
Copy link

112RG commented May 16, 2020

Will have to look into it. Currently when playing a Atmos track on mobile the request is for an mp4 file like this

    "assetPresentation": "FULL",
    "audioMode": "DOLBY_ATMOS",
    "audioQuality": "LOW",

I see no option in the app to change the audio quality to anything else

@112RG
Copy link

112RG commented May 16, 2020

So the mp4 from tidal seems to be a AC-4 file its just how to play it is the problem

Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42 (mp42/isom)
File size                                : 6.53 MiB
Duration                                 : 3 min 32 s
Overall bit rate                         : 257 kb/s
Encoded date                             : 
Tagged date                              : 

Audio
ID                                       : 1
Format                                   : AC-4
Format/Info                              : Audio Coding 4
Commercial name                          : Dolby AC-4
Format version                           : Version 2
Codec ID                                 : ac-4
Duration                                 : 3 min 32 s
Bit rate                                 : 256 kb/s
Sampling rate                            : 48.0 kHz
Frame rate                               : 23.438 FPS (2048 SPF)
Compression mode                         : Lossy
Stream size                              : 6.50 MiB (100%)
Default                                  : Yes
Alternate group                          : 2
Encoded date                             : UTC 2020-03-02 19:33:12
Tagged date                              : UTC 2020-03-02 19:33:12
I-Frame interval                         : 24 frames
Number of presentations                  : 1
Number of substreams                     : 1
Presentation #1                          : Immersive Stereo Main (English)
 Presentation ID                         : 0
 Dolby Atmos                             : Yes
 Dialogue normalization                  : -17.00
 Language                                : English
 Loudness                                : Yes
  Integrated loudness (speech gated)     : -26.0 LKFS
  Integrated loudness (level gated)      : -16.5 LKFS
  Audio Loudness Standard                : ATSC A/85
  Realtime loudness corrected            : No
  Dialogue corrected                     : No
 Dynamic Range Control                   : Yes
  E-AC-3 DRC profile                     : Music light
  Home theater AVR                       : Music light
  Flat panel TV                          : Music light
  Portable speakers                      : Music light
  Portable headphones                    : Music light
 Group #s                                : 1
Group #1                                 : Main
 Content classifier                      : Main
 Language                                : English
 Channel coded                           : Yes
 Immersive stereo                        : Dolby Atmos Content
 Number of substreams                    : 1
 Substream #s                            : 1
Substream #1                             : Stereo
 Channel mode                            : Stereo
 Immersive stereo                        : Dolby Atmos Content
 Channel layout                          : L R

@112RG
Copy link

112RG commented May 16, 2020

I would like to see support for getting atmos files. I have been playing around and I can't seem to figure out how or why a "audioMode": "DOLBY_ATMOS" is returning for the stream. I just keep getting flac files

The request for atmos files to tidal is

https://api.tidal.com/v1/tracks/125155092/playbackinfopostpaywall?playbackmode=STREAM&assetpresentation=FULL&audioquality=HI_RES&streamingsessionid=xxx&playlistuuid=xxx&prefetch=false&countryCode=US

Response is

    "assetPresentation": "FULL",
    "audioMode": "DOLBY_ATMOS",
    "audioQuality": "LOW",
    "manifest": "xxx",
    "manifestMimeType": "application/vnd.tidal.bts",
    "streamingSessionId": "xxx",
    "trackId": 125155092
}

The manifest for me at least always returns with a .flac and not the .mp4 file

I also suspect that files ending in 2101.mp4 are atmost files since every I have seen ending in that is an atmos file

@shahzoorali
Copy link
Author

Amazing find! If someone could teach me a little, I can spare time on this.

@fabriguzden
Copy link

@112madgamer try HIGH instead of HIGH_RES
that is, don't use HIGH_RES, just use HIGH

@112RG
Copy link

112RG commented May 17, 2020

Thanks. But I have managed to to download them. I have rigged RedSea to pull them. You need the authorization header to be set. While still having audioquality as HI_RES. Suspect you also need to mimic the newer client as I have changed my header versions to 2.25.1 as well as User-Agent to TIDAL_ANDROID/992 okhttp/3.13.1. I don't see any support for any windows app to decode ac4 even ffmpeg has closed all the stuff with ac4

@fabriguzden
Copy link

fabriguzden commented May 17, 2020

@112RG
Copy link

112RG commented May 17, 2020

I have seen that but its only for android. Which I can listen to the songs with Google Music app. Still no support for the Sony 3D audio MPEG-h mha1

@112RG
Copy link

112RG commented May 17, 2020

Also according to ffmpeg irc thats
ExoPlayer only implements demuxing, decoding is handed off to some external decoder component, so alone those changes dont mean much

@112RG
Copy link

112RG commented May 17, 2020

ffmpeg has a WIP for AC-4 it works but its a way off being implemented https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=451

The work is sponsored by VLC so maybe be the end of the year AC-4 decoding might be a thing

@shahzoorali
Copy link
Author

Does this help in anyway?

https://developer.dolby.com/forms/dolby-atmos-conversion-tool/

@joseph39
Copy link

joseph39 commented Jun 4, 2020

@112madgamer Mind sharing the payload that you used to fetch the Atmos MP4 file? It might still be worth adding support for it even if they can't be played back atm.

@frankkk1013
Copy link

Can anyone explain to me how to download the Atmos or 360RA files or add support to the code? Thank you very much

@fabriguzden
Copy link

fabriguzden commented Jun 5, 2020

I have seen that but its only for android. Which I can listen to the songs with Google Music app. Still no support for the Sony 3D audio MPEG-h mha1

@112madgamer wait a moment, I don't know if I misunderstood, can this file atmos be played on google play music or youtube music?

@112RG
Copy link

112RG commented Jun 5, 2020

The atmos tracks can be played with Google music app. So I guess the Youtube music app would work also haven't tested. @joseph39 All you need is the "authorization" header set. Which you can get your code by using the MITM proxy. Currently I have found no easy way to download them.

It might be possible if we worked on the logging in via oauth but thats alot of work

@zpoo32
Copy link

zpoo32 commented Jun 8, 2020

I just followed what you said and made my own fork of RedSea to download Dolby Atmos here: https://github.com/zpoo32/RedSea
Thanks for the help @112madgamer

@Dniel97
Copy link

Dniel97 commented Jun 8, 2020

Tidal uses according to a German website
https://www.heise.de/newsticker/meldung/3D-Musikformat-Dolby-aeussert-sich-zur-Zukunft-von-Dolby-Atmos-Music-4630101.html Dolby AC-4 which is a proprietary format from Dolby Laboratories. Even when you can download the Dolby AC-4 file, there is (currently) no way to playback these files, read more here:
https://en.wikipedia.org/wiki/Dolby_AC-4. Here is an example ac-4 file: https://github.com/google/ExoPlayer/blob/release-v2/library/core/src/test/assets/ts/sample.ac4 where you can try playing this file.

What I think, the 16MB request could be the audio file without the AC-4 filter and it requests AC-4 filter file separately and process while streaming.

Could you please tag me if you are copying my reply from yaronzz/Tidal-Media-Downloader#252 (comment)?

EDIT: Thanks!

@Dniel97
Copy link

Dniel97 commented Jun 8, 2020

I just followed what you said and made my own fork of RedSea to download Dolby Atmos here: https://github.com/zpoo32/RedSea
Thanks for the help @112madgamer

Thank you @zpoo32 for the repo. I tried your RedSea version and manually added my
TIDALSESSION and AUTHHEADER to settings.py. Then I executed python redsea.py -p best_available https://tidal.com/browse/album/XXXXXXX and python redsea.py https://tidal.com/browse/album/XXXXXXX without any success. It downloaded just a AAC 96 kbit/s .mp4 file instead of a AC-4 .mp4 file - The Album is obviously availbable in Dolby Atmos.

@zpoo32
Copy link

zpoo32 commented Jun 8, 2020

Are you certain you are using the exact same URLs that play Dolby Atmos on the Tidal app?

@Dniel97
Copy link

Dniel97 commented Jun 8, 2020

Does my device need to support Dolby Atmos inside the Tidal app? My mobile doesn't support Dolby Atmos so I thought it would not matter because I only need the token and authorization header. I tried the same with python redsea.py -p best_available https://tidal.com/browse/track/125155092 which is the Test URL from @shahzoorali but also no success.

@zpoo32
Copy link

zpoo32 commented Jun 8, 2020

Does my device need to support Dolby Atmos inside the Tidal app? My mobile doesn't support Dolby Atmos so I thought it would not matter because I only need the token and authorization header. I tried the same with python redsea.py -p best_available https://tidal.com/browse/track/125155092 which is the Test URL from @shahzoorali but also no success.

That's strange, it was working for me yesterday... I'm going to have to test it again this afternoon but the phone's Dolby Atmos support shouldn't affect the downloder's ability to download it... are you using the Hi-Fi subscription?

@zpoo32
Copy link

zpoo32 commented Jun 8, 2020

Also, don't use -p best available because it's always going to be Low for Atmos tracks anyway so it's unnecessary

@Dniel97
Copy link

Dniel97 commented Jun 8, 2020

Yes I'm using the Hi-Fi subscription and could obtain a Flac file with our repo without any problems but Dolby Atmos files won't load.

@zpoo32
Copy link

zpoo32 commented Jun 9, 2020

Bad news... the Tidal session actually sends the Dolby Atmos support of the device used to the server somehow and this determines if the user can request an Atmos track... unless the Tidal app's login system is reversed, only people with phones that support Atmos and AC-4 are supported for now

@zpoo32
Copy link

zpoo32 commented Jun 9, 2020

I already mentioned this in the Tidown issue thead but I need the help of someone with one of these devices: Fire TV Stick 4K, Fire TV Cube, Fire TV Stick (2nd/3rd gen), the Nvidia Shield TV or Nvidia Shield TV Pro (2019 or newer models) or a Dolby Atmos-enabled Android TV from Sony or Philips for EAC3 downloading

@shahzoorali
Copy link
Author

I have Fire TV stick 3rd gen and Razer 2 (with dolby atmos support). What can I help?

@112RG
Copy link

112RG commented Jun 10, 2020

My guess it maybe doing a system lib check or possibly a HWID check on the device to check atmos support. The token would rotate often. Doing there oauth login is easy its just the captcha part thats a pain

@zpoo32
Copy link

zpoo32 commented Jun 10, 2020

If anyone wants to help, I have a Telegram group t.me/DolbyDL which is currently a work in progress, but I need help, @112madgamer if you can, please join, your help will be greatly appreciated

@112RG
Copy link

112RG commented Jun 10, 2020

Have you tested this with a authorization token from a device that doesn't support Dolby Atmos? Watching the token exchange traffic the only thing I can see being sent to identify the device is the device name in the client.name

@zpoo32
Copy link

zpoo32 commented Jun 10, 2020

I need help working out how the Tidal server is informed that Dolby is supported. I cannot see anything obvious, so it might be encoded in something

@Dniel97
Copy link

Dniel97 commented Jun 10, 2020

Have you tested this with a authorization token from a device that doesn't support Dolby Atmos? Watching the token exchange traffic the only thing I can see being sent to identify the device is the device name in the client.name

Thats exactly what I did. @zpoo32 wasn't able to download any Dolby Atmos content with my token.

@zpoo32
Copy link

zpoo32 commented Aug 9, 2020

If anyone stumbles across this issue, if you're curious about this sort of thing, the group me and the others actively talk about this sort of stuff is at https://t.me/joinchat/JmWCRRjDhWSkmj7EiUPbXQ for Dolby Atmos Music specifically. Also, if anyone here hasn't found out, Dniel97's fork of redsea is able to download Dolby Atmos Music, and pretty much everything else Tidal provides

@BSElu
Copy link

BSElu commented Sep 10, 2022

For anyone dropping in here and still trying to figure out how to download Atmos stuff from Tidal: Head over to https://github.com/Dniel97/orpheusdl-tidal.

@OrfiDev
Copy link

OrfiDev commented Sep 10, 2022

Also, the official Telegram group for the program that module runs on (and also for all of the modules including that one as well) is https://t.me/orpheusdl (also zpoo32 is my old account, I still have access to that account but I use this one mainly now), please ignore the earlier link I sent ages ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants