7

Apple's Music App shows meta data like "℗ 2007 Deutsche Grammophon GmbH, Hamburg". I would like to get this field.I do not see a copyright field in MPMediItem properties. There is an AV constant AVMetadataiTunesMetadataKeyCopyright which I tried to find by making an AVURLAsset with the item, but I do not see that key in any of the items AVAsset.metadata arrays.

The question is, how do I get that field?

Axel Guilmin
  • 11,454
  • 9
  • 54
  • 64
  • I tried going low level, using AudioFileGetProperty. On my test device I have about 27 albums. For most of them, the Music App shows a copyright. But I only see a copyright key in one of the albums even with AudioFileGetProperty. –  Apr 29 '15 at 06:28
  • If I look at the m4a binary, I see the copyright field. It is beginning to look like the call I need is not exposed in the iOS APIs. –  Apr 29 '15 at 06:29
  • Can you please provide a link to an example audio file? This would be useful to concretely see/verify what you're seeing. – ruoho ruotsi May 04 '15 at 17:27
  • Not easily: these are all files that have a genuine copyright: i can't copy them to a website, since I would violate the copyright! –  May 04 '15 at 18:57
  • What is the 1) container (file) format? 2) audio codec? – ruoho ruotsi May 04 '15 at 22:06
  • I am using MP to get the assetURLs of items in a music library. MPMediaItem does not have a copyright property, so I tried creating an AVAsset with the URL. In one case in my tests, I was able to find a copyright. In all other cases, there was no copyright, even thought the Music app using the same albums showed it. –  May 05 '15 at 15:10

1 Answers1

1

I think you need to look into non-iTunes metadata keys, as there are many kinds of metadata in media files depending on the container & codec. For example, Apple advertises these keys:

  • Common Metadata Keys
  • ID3 Metadata Keys
  • iTunes Metadata Keys
  • QuickTime User Data Keys
  • QuickTime Metadata Keys

If your codec is MP3, then the copyright information may live in an ID3 tag in the header of the MP3 file itself. In this case, it may be useful to use ID3_Metadata_Keys:

AVMetadataID3MetadataKeyCopyright: String
AVMetadataID3MetadataKeyDate: String

UPDATE: Since the files are .m4a, one solution is to use a command-line-tool like mp4v2 to view the metadata for .m4a apple lossless (ALAC) files, then you'll know if and where the metadata exists and what keys make sense to use.

ruoho ruotsi
  • 1,283
  • 14
  • 13
  • The files are .m4a - all Apple lossless. –  May 04 '15 at 23:49
  • Have you looked at values from other keys? .m4a is MPEG-4, so another idea is to try ffmpeg in the console to print out the metadata (http://jonhall.info/how_to/dump_and_load_metadata_with_ffmpeg). This may give a hint about what keys to use programmatically. – ruoho ruotsi May 05 '15 at 19:27