View Full Version : Decoding Apple Music audio tracks (sample provided)
FranceBB
24th September 2021, 22:48
Hi there,
as you know, there are not so many paid services offering lossless audio but one of those is Apple Music.
Now, I don't really like Apple nor OSX so I'd like to listen to the music on other devices and I tried to take the audio tracks out of the Mac to listen to them in other devices, however I was puzzled when I found out how Apple Music stores files as I couldn't find a way to... uhm... open them. I thought it was gonna be just 1 track in whatever codec and that's it but there were several files, so, low and behold, here is a file taken directly from the Apple Music folder in which downloaded files are stored: https://we.tl/t-ED5xnDmGAV
Have fun with the sample and let me know if you find a way to listen to it...
nevcairiel
25th September 2021, 00:03
The format its stored in is HLS with fragmented MP4 segments, probably for streaming, and they don't bother to change the format on disc.
However, the real problem is that its DRM protected - eg. encrypted. The reference to the key is something only Apple Music will understand and provide the key from its store.
junh1024
25th September 2021, 03:18
Deezer & TIDAL have lossless streaming on applicable plans too.
SeeMoreDigital
25th September 2021, 09:28
Deezer & TIDAL have lossless streaming on applicable plans too.
Are they lossless or are they 'lossy' MQA (Master Quality Authenticated (https://en.wikipedia.org/wiki/Master_Quality_Authenticated)) encoded?
junh1024
25th September 2021, 10:22
Are they lossless or are they 'lossy' MQA (Master Quality Authenticated (https://en.wikipedia.org/wiki/Master_Quality_Authenticated)) encoded?
TIDAL has some MQA according to https://github.com/yaronzz/Tidal-Media-Downloader/issues/549#issuecomment-748567962 , but it should be clearly marked.
Deezer has some (https://en.deezercommunity.com/features-feedback-44/352-8-khz-and-mqa-titles-on-deezer-67273) , titles (https://en.deezercommunity.com/deezer-catalogue-45/finding-mqa-titles-on-deezer-184)in MQA , but I'm guessing the majority isn't MQA.
I guess there's no guarantee that there's no MQA on AM, since MQA can be stored in most lossless codecs.
Anyway, although MQA is lossy, you'll barely be able to hear it.
FranceBB
26th September 2021, 20:11
Ok, then, backup plan: it's lossless so I can just play the song and record the 5.1 output from the speakers in PCM 24bit little endian and get away with it, however when I tried I failed 'cause the sound was crackling and unusable. I gotta say that I didn't put much effort into this attempt, so, do you have any command line for FFMpeg (or anything else really) to capture the speaker in a Mac and save to PCM?
Or even something to stream the audio over the internal network so that I can listen to it from Windows? eheheheheh
For the records, this is what I used:
ffmpeg -f avfoundation -i ":1" -acodec copy -f wav -y "output.wav"
while when I tried to stream it over the network I used something like:
ffmpeg -f avfoundation -i ":1" -acodec pcm_s16be -ar 44100 -ac 2 -f rtp rtp://192.168.178.29:5555
but unfortunately it's just stereo because of the -ac 2.
If I try to get rid of -ac and output a 5.1 with 6 channels it says that it ain't supported by rtp... :(
jlw_4049
26th September 2021, 21:40
What about Plex?
Sent from my SM-G986U1 using Tapatalk
SeeMoreDigital
27th September 2021, 08:56
It's a different ball game capturing multi-channel audio as apposed to 2-channel audio...
tormento
27th September 2021, 10:31
Ok, then, backup plan
Try this (https://vb-audio.com/Cable/).
FranceBB
27th September 2021, 21:56
Try this (https://vb-audio.com/Cable/).
I'm gonna try it in the next few days.
I see that it accepts 5.1 input however I haven't seen anything about recording 5.1 on the Website.
I'll reach out to you on telegram though since we're friends. :)
FranceBB
27th September 2021, 22:07
Ok, I tested it cause I was excited, but... it doesn't record anything. What it is is a replacement for the mac speaker. Like: A virtual sound card. I configured it and I put two of those: one is the output of the system and the input of TeamTalk, the other one is the input of the system and the output of TeamTalk. This way it is basically as if I had the microphone and speakers of my primary desktop connected to the mac. I can even do facetime-calls from Windows 10 this way xD
The problem is that TeamTalk isn't 5.1 but stereo, and it's not lossless but opus, so it's not good.
Anyway we're losing the point here: the program you gave me is a virtual sound card and it doesn't record anything... :(
tormento
27th September 2021, 22:25
Anyway we're losing the point here: the program you gave me is a virtual sound card and it doesn't record anything... :(
AFAIK there is a way to redirect output to audio in.
FranceBB
5th October 2021, 20:05
Nope, it acts as a virtual sound card and that's it.
I feel like FFMpeg is the key here.
Anything better than this?
ffmpeg -f avfoundation -i ":1" -acodec copy -f wav -y "output.wav"
FranceBB
6th October 2021, 19:41
New test using this:
ffmpeg -f avfoundation -i ":1" -acodec copy -f wav -y "output.wav"
https://wetransfer.com/downloads/7e45d7c5bbc36f6ab8a363564b7dc67220211006182652/3372e1/preview/80fafca91e12928e5d0a62a9c3f2210720211006182705
https://we.tl/t-HZN7BrSudc
and you can hear the cracking sound... -.-
Balling
7th October 2021, 12:23
It's a different ball game capturing multi-channel audio as apposed to 2-channel audio...
Same multichannel wav container.
richardpl
7th October 2021, 13:06
Look at ffmpeg avfoundation device input options, perhaps you could use something out of it.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.