mp3inspect
This library is still in the alpha phase, and in need of documentation (I'm working on it!). It has been tested against
a decent number of CBR files but needs more testing against VBR files. Additionally it does not currently scan for Xing
or iVBR headers.
To use simply install the mp3inspect
utility:
go get github.com/betamike/mp3inspect
go install github.com/betamike/mp3inspect
Or mp3inspect can be used as a library by importing github.com/betamike/mp3inspect/mp3
. The Scanner
type can be used
to scan an mp3 frame by frame, or the convenience method InspectFile
will scan an entire file and provide a condensed
MP3Info
struct.
Running tests
Dependencies
- ffmpeg
- ffprobe (should come with ffmpeg)
- lame
- gxargs (if running on Mac) - can be installed with
brew install findutils
- fq
There are two bash scripts that generate the files needed for testing.
First there is generate_mp3s.sh
which generates a bunch of MP3s in the
test/files
directory. It generates an MP3 of every possible type, according to wikipedia.
After generating all MP3s, you need to generate the golden files.
This is done using the generate_golden_files.sh
script. The golden files
contain the "expected" output of mp3inspect. This is generated by using ffprobe to get the
sampling rates, bit rates, and to see if it is VBR or CBR.
Also, we use fq
to try to count the number of mp3 frames in the file.
After all files have been generated, you can simply run go test
or make test
to run tests.
Todo
- Add tests for all currently implemented features
- Handle Xing and iVBR headers
- Detect APE tags
- Parse metadata from tags ?
- Allow editing of tags ?
License
This package is distributed under the MIT license. See the LICENSE file for more details.