使用ruby读取音频文件元数据。

时间:2021-03-08 19:45:05

I need to read metadata (song name, artist, etc.) from various audio files with ruby, mainly MP3 and Apple's AAC. I've googled and found no library that supported both formats.

我需要用ruby从各种音频文件中读取元数据(歌曲名、歌手等),主要是MP3和苹果的AAC。我搜索了一下,发现没有支持两种格式的库。

How do you guys read audio metadata with ruby? I would prefer a solution with minimal dependencies possible.

你们怎么用ruby读音频元数据?我更喜欢一种可能具有最小依赖性的解决方案。

Thanks.

谢谢。

3 个解决方案

#1


4  

Taglib has Ruby bindings and does what you want.

Taglib有Ruby绑定,并执行您想要的操作。

#2


2  

AAC files are standard QuickTime files with everything stored as Atoms which can be parsed if you can read the raw byte stream.

AAC文件是标准的QuickTime文件,所有文件都存储为原子,如果可以读取原始字节流,就可以解析这些原子。

#3


1  

There is id3lib-ruby gem, but I had some issue with this and some specific MP3s, some worked, some crashed the app entirely. But if you can get it to work, it's nice.

有id3lib-ruby gem,但是我有一些问题,一些特定的mp3,一些有用,一些完全崩溃了应用程序。但如果你能让它工作,那就太好了。

This RubyQuiz http://rubyquiz.com/quiz136.html might help you get started if you want to write your own simple parser.

这个RubyQuiz http://rubyquiz.com/quiz136.html可能帮助您开始编写自己的简单解析器。

#1


4  

Taglib has Ruby bindings and does what you want.

Taglib有Ruby绑定,并执行您想要的操作。

#2


2  

AAC files are standard QuickTime files with everything stored as Atoms which can be parsed if you can read the raw byte stream.

AAC文件是标准的QuickTime文件,所有文件都存储为原子,如果可以读取原始字节流,就可以解析这些原子。

#3


1  

There is id3lib-ruby gem, but I had some issue with this and some specific MP3s, some worked, some crashed the app entirely. But if you can get it to work, it's nice.

有id3lib-ruby gem,但是我有一些问题,一些特定的mp3,一些有用,一些完全崩溃了应用程序。但如果你能让它工作,那就太好了。

This RubyQuiz http://rubyquiz.com/quiz136.html might help you get started if you want to write your own simple parser.

这个RubyQuiz http://rubyquiz.com/quiz136.html可能帮助您开始编写自己的简单解析器。