问题描述
这是一个分为两部分的问题.首先,是否可以独立于ID3标签访问MP3中的音频数据,其次,可以使用可用的库来进行访问吗?
this is a 2 part question. First off, is it possible to access the audio data in an MP3 independently of the ID3 tags, and secondly, is there any way to do so using available libraries?
最近,我从3台计算机整合了我的音乐收藏,最后制作了更改了ID3标签的歌曲,但音频数据本身未作修改.由于使用ID3标签更改了文件更改,因此搜索重复文件失败了,但是我认为,只要我使用音频数据进行重复数据删除以进行比较,就可以识别重复文件.
I recently consolidated my music collection from 3 computers and ended up with songs which had changed ID3 tags, but the audio data itself was unmodified. Running a search for duplicate files failed because the file changed with the ID3 tag change, but I think it should be possible to identify duplicate files if I just run a deduplication using the audio data for comparison.
我知道可以找到文件中ID3标头之后的特定位置,然后直接读取数据,但是我想知道是否有一个库可以公开音频数据,所以我可以提取数据,然后运行校验和,并将计算结果存储在某个地方,然后查找相同的校验和. (另外,当您考虑可变长度标头时,我可能不得不使用某种类型的库.)
I know that it's possible to seek to a particular position past the ID3 header in the file, and directly read the data, but was wondering if there's a library that would expose the audio data so I could just extract the data, run a checksum on it, and store the computed result somewhere, then look for identical checksums. (Also, I'd probably have to use some kind of library when you take into account variable length headers.)
推荐答案
巧合的是,我前几天想做类似的事情.
Coincidentally I wanted to do something similar the other day.
这是我整理的一个Ruby脚本:
Here is a Ruby script that I whipped up:
http://code.google.com /p/kodebucket/source/browse/trunk/bin/mp3dump.rb
它将mpeg帧转储到stdout,这样人们就可以像这样抓取校验和:
It dumps mpeg frames to stdout, so one could grab a checksum like so:
# mp3dump.rb file.mp3 | md5sum
这篇关于独立于ID3标签访问MP3音频数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!