Extracting ID3 Grouping GRP1 from audio files

Started by MrCee, May 05, 2020, 10:12:14 PM

Previous topic - Next topic

MrCee

Hi Phil,

I was hoping to extract GROUPING from ID3 tags as set by iTunes/Music.app and many others.
Currently, the tag shows up as ID3_GRP1 in verbose output on both mp3 and aiff files. It also shows up as unknown using -u as binary.
I can send you a file example.

exiftool -v Wasback,\ DJ\ Junior\ \(TW\)\ -\ Alive\ \(Extended\ Mix\).aiff
  ExifToolVersion = 11.85
  FileName = Wasback, DJ Junior (TW) - Alive (Extended Mix).aiff
  Directory = .
  FileSize = 45123036
  FileModifyDate = 1588431082
  FileAccessDate = 1588431088
  FileInodeChangeDate = 1588431082
  FilePermissions = 33225
  FileType = AIFF
  FileTypeExtension = AIFF
  MIMEType = audio/x-aiff
AIFF 'NAME' chunk (20 bytes of data): 20
  Name = Alive (Extended Mix)
AIFF 'COMM' chunk (18 bytes of data): 48
  Common (SubDirectory) -->
  + [BinaryData directory, 18 bytes]
  | NumChannels = 2
  | NumSampleFrames = 11245500
  | SampleSize = 16
  | SampleRate = 44100
AIFF 'SSND' chunk (44982008 bytes of data): 74
AIFF 'ID3 ' chunk (140945 bytes of data): 44982090
  ID3 (SubDirectory) -->
  | ID3Size = 140945
ID3v2.4.0:
  | + [ID3v2_4 directory, 140935 bytes]
  | | Artist = Wasback, DJ Junior (TW)
  | | Title = Alive (Extended Mix)
  | | PictureMIMEType = image/jpeg
  | | PictureType = 3
  | | PictureDescription = Album cover
  | | Picture = .....JFIF......C.......................................................[snip]
  | | Band = Various Artists
  | | Compilation = 1
  | | Genre = .
  | | Album = 2020.01 - PEAK HOUR TRACKS ELECTRO HOUSE JANUARY 2020
  | | InitialKey = 4m
  | | Comment = .
  | | BeatsPerMinute = 128
  | | Private (SubDirectory) -->
  | | + [PRIV directory, 86804 bytes]
  | | | TRAKTOR4 = DMRT.P..RDH 0.SKHC..Z.DOMF.....NSRV..ATAD.P..BDNA.-.>WTRAq..}} 078/O[snip]
  | | RecordingTime = 2222
  | | ID3_GRP1 = [DJ Charts] TEST!!!!!!!!!!!!!!!!

[edit: I should note the GROUPING tag is currently working well with flac and m4a files]
Thanks!

Phil Harvey

Sure.  Send me a file and I'll add support for this.  My email is philharvey66 at gmail.com

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

I got the samples, thanks.

Apparently Apple introduced this new ID3 tag sometime in 2016.  I can't find any details about the format specification, but I will decode it based on the examples you sent.  In the examples it is stored as standard text, with a leading null and a trailing null added for some reason.  I don't know what these nulls are for, or if they are always nulls, or why Apple didn't just write this as text in using a normal Txxx frame, but there you go.  ExifTool 11.99 will remove the nulls and return the remaining text as "Grouping".

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

...continuing down this rabbit hole, I have found these other new tags now also written by iTunes:

ID3 "MVNM" - MovementName
ID3 "MVIN" - MovementNumber

QuickTime "©mvn" - MovementName
QuickTime "©mvi" - MovementNumber
QuickTime "©mvc" - MovementCount
QuickTime "shwm" - ShowMovement
QuickTime "©wrk" - Work

I'll add support for these as well.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

milchtaich

Quote from: Phil Harvey on May 06, 2020, 10:11:41 AM
...continuing down this rabbit hole, I have found these other new tags now also written by iTunes:

ID3 "MVNM" - MovementName
ID3 "MVIN" - MovementNumber

QuickTime "©mvn" - MovementName
QuickTime "©mvi" - MovementNumber
QuickTime "©mvc" - MovementCount
QuickTime "shwm" - ShowMovement
QuickTime "©wrk" - Work


As you go down the rabbit hole, observe that iTunes now maps ID3 "TIT1" to Work rather than Grouping. See https://github.com/beetbox/mediafile/issues/15

Phil Harvey

Yes, thanks.   I did see a few reports mentioning that Apple changed their mappings at some point.  Luckily ExifTool isn't affected by these.  (Mappings are typically handled by ExifTool argfiles, but I haven't yet included an argfile in the distribution for mapping ID3 to QuickTime tags.)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

MrCee

I really appreciate using ExifTool in all tag extraction scripting adventures with Applescript/iTunes/Music.app.
Thanks so much in advance.