ID3, MP4 and OGG/FLAC metadata parsing in Go
Go to file
Xavier Henner be3da62488 Add more tags to mp4
1) correct a bug with the mdat atom.
Sometimes, the metadata can be at the end, after the audio
Demo :
   get any music file and strip the metadata
   convert it to m4a with ffmpeg
   analyse it with MusicBrainz Picard
   et voila, you have the metadata at the end.

Example of structure of a m4a created that way;
https://www.dropbox.com/s/602yivdstan7506/atom.txt?dl=0

2) add support for the "----" tag
See http://atomicparsley.sourceforge.net/mpeg-4files.html
It gives access to the tags created by MusicBrainz Picard
2015-05-25 00:33:47 +02:00
check Added tool for checking tags over iTunes Library or path 2015-05-24 09:52:44 +10:00
sum Refactored Hash -> Sum and fixed infinite loop issue with SumAtoms 2015-04-03 15:13:39 +11:00
tag Added Genre() to Metadata interface 2015-05-24 22:37:21 +10:00
.editorconfig Add a basic editorconfig file 2015-05-01 22:44:59 +10:00
.travis.yml Added .travis.yml 2015-03-20 09:02:27 +11:00
flac.go Reorganised Vorbis Comment parsing into own type 2015-05-24 10:44:45 +10:00
id3v1.go Reorganised Vorbis Comment parsing into own type 2015-05-24 10:44:45 +10:00
id3v2_test.go Add license comment to unsynchroniser tests 2015-05-03 09:58:40 +10:00
id3v2.go Refactor readTFrame and added readWFrame 2015-05-24 12:23:30 +10:00
id3v2frames.go Remove append no-op! 2015-05-24 13:13:43 +10:00
id3v2metadata_test.go Initial commit 2015-03-19 23:21:53 +11:00
id3v2metadata.go Reorganised Vorbis Comment parsing into own type 2015-05-24 10:44:45 +10:00
LICENSE Initial commit 2015-03-19 23:21:53 +11:00
mp4.go Add more tags to mp4 2015-05-25 00:33:47 +02:00
ogg.go Reorganised Vorbis Comment parsing into own type 2015-05-24 10:44:45 +10:00
README.md Added Lyrics() to README 2015-05-24 22:49:06 +10:00
sum.go Fixed godoc 2015-04-27 22:53:37 +10:00
tag.go Added Genre() to Metadata interface 2015-05-24 22:37:21 +10:00
util_test.go Add some basic tests for utils 2015-05-03 09:59:03 +10:00
util.go Implemented basic FLAC support (no artwork, yet!) 2015-04-15 00:12:37 +10:00
vorbis.go Reorganised Vorbis Comment parsing into own type 2015-05-24 10:44:45 +10:00

MP3/MP4/OGG/FLAC metadata parsing library

Build Status GoDoc

This package provides MP3 (ID3v1,2.{2,3,4}) and MP4 (ACC, M4A, ALAC), OGG and FLAC metadata detection, parsing and artwork extraction.

Parsed metadata is exported via a single interface (giving a consistent API for all supported metadata formats).

// Metadata is an interface which is used to describe metadata retrieved by this package.
type Metadata interface {
	Format() Format
	FileType() FileType

	Title() string
	Album() string
	Artist() string
	AlbumArtist() string
	Composer() string
	Genre() string
	Year() int

	Track() (int, int) // Number, Total
	Disc() (int, int) // Number, Total

	Picture() *Picture // Artwork
	Lyrics() string

	Raw() map[string]interface{} // NB: raw tag names are not consistent across formats.
}

Audio Data Checksum (SHA1)

This package also provides a metadata-invariant checksum for audio files: only the audio data is used to construct the checksum.

http://godoc.org/github.com/dhowden/tag#Sum

Example Usage

There are a simple command-line tools which demonstrate basic tag extraction and summing:

$ go get github.com/dhowden/tag/...
$ cd $GOPATH/bin
$ ./tag 11\ High\ Hopes.m4a
Metadata Format: MP4
 Title: High Hopes
 Album: The Division Bell
 Artist: Pink Floyd
 Composer: Abbey Road Recording Studios/David Gilmour/Polly Samson
 Year: 1994
 Track: 11 of 11
 Disc: 1 of 1
 Picture: Picture{Ext: jpeg, MIMEType: image/jpeg, Type: , Description: , Data.Size: 606109}

$ ./sum 11\ High\ Hopes.m4a
2ae208c5f00a1f21f5fac9b7f6e0b8e52c06da29