3

A few days ago, I dragged some Apple Music songs to my MP3 player. When I played it, there was no sound.

I googled to find a solution, but people all said that the files are DRM-encrypted on Apple Music to prevent piracy, and I could find no more information. Can anyone help me?

  • Considering the files are encrypted, I doubt you can easily convert them, that's the point of the encryption after all. But I have another idea... – Xen2050 Nov 28 '17 at 6:34
  • 2
    Long ago, when the iTunes store was the only one in the market, the song were encrypted AAC. If you bought the songs many, many years ago, they could have DRM. Then delete them and download them again to retrieve them without DRM. But it's more likely that your mp3 player doesn't support the AAC format, so use an AAC to mp3 converter first. – Philippos Nov 28 '17 at 6:53
  • 6
    SuperUser would be a better fit for this question, as it has nothing to do with Unix/Linux. – dr_ Nov 28 '17 at 9:33
  • What's the output of file /path/to/song and ffprobe /path/to/song? – David Foerster Nov 28 '17 at 13:01
  • @dr01: I think we can imply that OP wants to achieve this on a UNIX system. – David Foerster Nov 28 '17 at 13:02
11

Apple music files have not been encrypted for a decade! So, unless you bought them ten years ago, they are not encrypted, your MP3 player simply does not support the format (AAC).

You can tell by the extension:

  • m4p -> encrypted
  • m4a -> standard AAC or Apple Lossless

You can convert AAC to MP3, however, you will get slight loss of quality.

You could use ffmpeg:

ffmpeg -i inputfile.m4a -c:a libmp3lame -ac 2 -b:a 320k outputfile.mp3

To remove DRM: You can simply burn DRM-encumbered files to a CD and rip the CD to remove the DRM. The burn-rip is the easiest method, yet, you have quality loss.

There are multiple other ways you can remove the DRM, such as using Audacity, you can google for the exact steps.

I do not know how this is possible, but there are also commercial software solutions that at best are doing exactly what Audacity does. Audacity is "GPL software" that is free of charge.

|improve this answer|||||
  • 3
    I believe the question is about Apple Music, the streaming service, which does use a DRM-protected format. Files can be cached for playback offline and extracted from iTunes but the DRM remains. The iTunes Store, the music purchasing service, indeed does not use DRM. – CallumA Nov 28 '17 at 11:40
  • “Apple music files have not been encrypted for a decade!” I just now—in June 2018—downloaded an album I paid for on iTunes on macOS, dowloaded as usual and then went to transcode the files to MP3; no lecturing audiophile bitrate weenies. Anyway, 9 of the 18 tracks were .m4a files and the remaining 9 were .m4p files. Simply changing the extension from .m4p to .m4a solved the issue for me. – JakeGould Jun 18 '18 at 1:26
1

If you have any program that can play the apple songs, you could try re-recording them with another program while they're playing, ("loopback" style).

If you've got some pulseaudio packages installed (pulseaudio-utils) you could use
pacmd list-source
to find your output device - it's usually the one with ".monitor" at the end of it's "name:" entry.

Then, record it's output to a file using parec and it's --file-format[=FORMAT] option. Check with --list-file-formats & see man parec ("It understands all audio file formats supported by libsndfile.") Something like this:

parec -d alsa_output.pci-...analog-stereo.monitor --file-format=wav output.wav

Or pipe to lame to record mp3's:

parec -d alsa_output.pci-...analog-stereo.monitor | lame -r -V0 - output.mp3
  • -r tells lame that the input is raw pcm.
  • - tells lame to input from stdin
  • -V0 says "Enable VBR (Variable BitRate) and specifies the value of VBR quality (default = 4). 0 = highest quality."

The only tricky part is getting the timing of each song & output file. If your Apple playback program supports terminal playback that would be easier, you might even be able to combine ID3 tag reading to transfer some data (if the Apple files support it, I'm not actually sure)


You could also use another GUI program called audio-recorder, it's basically "click to record", and then convert to mp3.

Or even audacity and some GUI pavucontrol software if you really wanted. See this Ubuntu Q on How to record output to speakers?.

|improve this answer|||||
  • Why the downvote? It's not a disagree button, and this would still be useful for actually encrypted files, or any other audio in general, encrypted or not – Xen2050 Nov 28 '17 at 7:17
  • 1
    I didn't downvote, but your answer is a good answer to a different question, but not for this question, because the OP misunderstood the problem. – Philippos Nov 28 '17 at 9:08
  • @Philippos Thanks, I just accepted the premise that the files really are encrypted and only playable with one program (assuming something would play them), and the OP's google search would have shown them results newer than 10 years old. Maybe they are old files & can't be re-downloaded. As of now there's no reply from the OP, so can't really tell yet. – Xen2050 Nov 28 '17 at 10:03
  • But that one program – iTunes – is only for Windows & macOS; it's pretty unlikely that it would be Pulseaudio-compatible. – user1686 Nov 28 '17 at 11:42
  • @grawity Touche, but this is Unix & Linux, perhaps I assumed too much about the situation, perhaps the OP doesn't know what they're talking about, or perhaps a virtual PC is involved. At the very least PulseAudio has works on MacOS X, so it should work like it's supposed to. I didn't think it needed specially designed software to grab the sound output, but in case it does apparently you can use Soundflower &/or esound. – Xen2050 Nov 28 '17 at 12:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.