Streaming music metadata parser for node and the browser.
Install via npm:
npm install musicmetadata
You can also download a pre packaged browser release from
example/index.html for usage.
- mp3 (1.1, 2.2, 2.3, 2.4)
- m4a (mp4)
- vorbis (ogg, flac)
- asf (wma, wmv)
var fs = ;var mm = ;// create a new parser from a node ReadStreamvar parser =;
This will output the standard music metadata:
artist : 'Spor'album : 'Nightlife, Vol 5.'albumartist : 'Andy C' 'Spor'title : 'Stronger'year : '2010'track : no : 1 of : 44disk : no : 1 of : 2genre : 'Drum & Bass'picture : format : 'jpg' data : <Buffer>duration : 30241 // in seconds
Note, the stream is not closed by default. To prevent leaks, you must close it yourself:
var readableStream = fs;var parser =;
musicmetadata also emits all metadata it discovers during parsing. For example if you wanted to read the
TLEN frame from an id3v2.x file you can do this:
You can also read the duration; to calculate the duration
musicmetadata may need to parse the entire file
so only enable this if you need the functionality.
Note that in order to read the duration for streams that are not file streams, you must also pass the size of the file in bytes.
(The MIT License)
Copyright (c) 2016 Lee Treveil firstname.lastname@example.org
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.