Node-taglib read AudioProperties

40 views
Skip to first unread message

Ali Reza

unread,
Apr 5, 2015, 8:17:42 AM4/5/15
to nod...@googlegroups.com
I try to read AudioProperties (bitrate) with Node-taglib , here's my code :

var taglib = require('taglib');

taglib.tag("./love-me-like-you-do.mp3", function(err, tag, audioProperties) {
    console.log(tag);
    console.log(audioProperties);
});

here's my output :

{ genre: null,
  year: 0,
  track: 0,
  artist: 'Love Me Like You Do - Ellie Goulding',
  comment: null,
  album: 'Love Me Like You Do - Ellie Goulding',
  title: 'Love Me Like You Do - Ellie Goulding' }
undefined

As you can see there is undefined for audioProperties

I be appreciated if tell me where i am wrong.


Aria Stewart

unread,
Apr 5, 2015, 8:25:53 AM4/5/15
to nod...@googlegroups.com
On Sunday, April 5, 2015 at 8:17:42 AM UTC-4, Ali Reza wrote:
I try to read AudioProperties (bitrate) with Node-taglib , here's my code :

[snip]
 

As you can see there is undefined for audioProperties

I be appreciated if tell me where i am wrong

From the documentation:

If no audio properties could be read, audioProperties will be an empty object (falsy). The following fields are available in audioProperties, all are integers:

 

Ali Reza

unread,
Apr 5, 2015, 9:16:11 AM4/5/15
to nod...@googlegroups.com
i tried for multiple files , all of them was empty ? 

 there is other library other than taglib for extracting mp3 files bitrate ?  i tested id3js , musicmetadata non of them show birate. 

Jimb Esser

unread,
Apr 6, 2015, 7:38:50 PM4/6/15
to nod...@googlegroups.com
It's a little heavy handed, but if you don't need absolutely the best performance and are okay with requiring software other than just vanilla Node.js to be installed to run your program, just shelling out to another command line utility that can get this data is probably the simplest.  There are a number of tools that can get bitrate from an mp3 file, this page [1] suggests ExifTool (for Linux or Mac), and it looks like someone already wrote an NPM module that wraps doing that for you [2].


  Jimb Esser
Reply all
Reply to author
Forward
0 new messages