如何以编程方式比较 mp3

发布于 2024-07-14 04:59:31 字数 66 浏览 4 评论 0原文

我喜欢能够以编程方式比较 mp3。 问题我不知道是什么。 标头? 直方图? 渠道? 有人有这方面的经验吗?

I like to be able to compare mp3’s programmatically. The problem I don’t know by what.
Header? Histogram? channels? Does anyone have experience with this subject?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

扛刀软妹 2024-07-21 04:59:31

我写了关于音频指纹识别的我的硕士论文。 本文列出了一些针对比较音乐听起来的问题的开源解决方案,并提供了它们之间的性能比较。 可能有点矫枉过正,但是有一些非常不错的应用程序。

如果您只想通过标记数据进行比较,则要查看的标准是ID3。 基本上有两个版本,第一个版本非常简单 (ID3v1),由 MP3 末尾的 128 字节块组成。 ID3v2 在 MP3 的开头放置了一个较大的、可变大小的块。

I wrote my master's thesis on audio fingerprinting. The thesis lists a few open source solutions to the problem of comparing what the music sounds like, and provides performance comparisons between them. Might be overkill, but there are some really decent applications out there.

If you only want to compare by tagged data, the standard to look into is ID3. There are basically two versions, the first is very simple (ID3v1) and consists of a 128 byte block at the end of an MP3. ID3v2 puts a larger, variable sized block at the beginning of the MP3.

仙女山的月亮 2024-07-21 04:59:31

<块引用>

我希望能够以编程方式比较 mp3

我有同样的问题。 我发现 itunes 改变了我的许多 Amazon MP3 下载,改变了时间/日期戳、文件大小以及 MD5 签名。 我的备份突然有许多几乎重复的文件。

当我进行 VIM diff 时,我可以看到更改仅限于文件的很小一部分。 即使在近距离缩放时,这些文件并排在 Audacity 中看起来也是相同的。

我的解决方案是创建 mp3 的无头 WAV 转储,然后比较每个 WAV 的 MD5 签名。 FFMPEG 可以很容易地完成转换。

ffmpeg -y -i $mp3 $mp3.wav;
md5sum $mp3.wav

我创建了一个以 MD5 作为指向原始 MP3 文件规范的密钥的哈希值。 将 wav 文件放在 SSD 上以提高速度。

蛮力,但有效。

I like to be able to compare mp3’s programmatically

I had the same question. I found that itunes had altered many of my Amazon MP3 downloads, changing the time/date stamps, the file sizes and therefore the MD5 signatures. My backups suddenly had many near duplicate files.

When I did a VIM diff, I could see that the changes were limited to very small parts of the files. The files looked identical side by side in Audacity even at a close zoom.

My solution is to create a headerless WAV dump of the mp3 and then compare the MD5 signatures of each WAV. FFMPEG can do the translation quite easily.

ffmpeg -y -i $mp3 $mp3.wav;
md5sum $mp3.wav

I created a hash with MD5 as key pointing to the original MP3 file spec. Put the wav file on an SSD for speed.

Brute force, but it works.

影子的影子 2024-07-21 04:59:31

我想您可以采取多种方法来实现此目的:

1. 比较标签

您可以比较 mp3 标签中保存的数据。 标签以 ID3 格式保存。 有许多库可以帮助您访问标签,tagLib 是一个流行的库选择(对于 .net 应用程序,TagLib Sharp

2声学指纹

这是迄今为止最可靠的方法,无论压缩甚至格式如何,您都可以找到匹配项。 根据文件中的实际音频创建唯一的指纹,允许识别echoprint歌曲 > 是一个开源示例。

3. 从文件创建哈希

这是一种更快的方法,可让您找到内容完全匹配的文件。


一些进一步的阅读:

  • 这里有一篇关于管理 mp3 集合(包括读取标签)的有趣的 MSDN 文章:
    链接文本 (它是 Visual Basic 语言,但可能仍然有用。)

  • 这里有一些文件格式的描述:
    链接文本

I guess there are a number of approaches you could take to this:

1. Compare tags

You could compare the data held in mp3's tags. The tags are held in the ID3 format. There are a number of libraries to help you access the tags, tagLib is a popular choice (TagLib Sharp for .net apps)

2. Acoustic fingerprint

This is by far the most robust method, allowing you to find matches regardless of the compression or even format. A unique fingerprint is created from the actual audio from the file allowing the song to be identified echoprint is an opensource example of this.

3. Creating a hash from the file

This is a quicker method allowing you to find file with content that matches exactly.


Some further reading:

  • There's an interesting MSDN article about managing an mp3 collection (including reading the tags) here:
    link text (It's in visual basic but might still be useful.)

  • There's a little description of the file format here:
    link text

夏至、离别 2024-07-21 04:59:31

你说的比较是什么意思? 元数据(作者、标题等)、音频数据? 出于什么目的 ?

比较音频数据的流行和基本方法是计算某些频谱特征的某种距离,例如 MFCC

: >http://en.wikipedia.org/wiki/Mel_Frequency_cepstral_coefficient

What do you mean by comparing ? The meta-data (author, title, etc...), the audio data ? For what purpose ?

On popular and basic way to compare audio data is to compute some kind of distance on some spectral features, such as MFCC:

http://en.wikipedia.org/wiki/Mel_frequency_cepstral_coefficient

凉世弥音 2024-07-21 04:59:31

为了更好地回答您的问题,我认为我们需要确切地知道您想要做什么。

如果您想比较实际的歌曲,musicDNS 有一个能够创建音频指纹的库。 可以在此处找到名为 libOFA 的库。 musicbrainz 等公司使用该指纹识别系统将数字音频文件与其数据库进行匹配。 理论上,您可以使用它来比较两个不同的数字文件。

如果您想要比较标签数据(id3v1/id3v2),有很多库可以为您做到这一点,其中提到了 taglib,并且 libmpg123 也有自己的函数来提取标签数据。

libOFA 方法的好处是您可以相互比较不同的格式,因为指纹识别是在音频本身上完成的。

To answer your question better I think we need to know exactly what you are looking to do.

If you are looking to compare the actual song, musicDNS have a library that are able to create audio fingerprints. The library called libOFA can be found here. This fingerprinting system is used by for example musicbrainz to match digital audiofiles to their database. In theory you can use this to compare two different digital files.

If you are looking to compare tag data (id3v1/id3v2) there are a lot of libraries that can do that for you, taglib is mentioned and also libmpg123 have their own functions to extract tag data.

The good thing about the libOFA approach is that you can compare different formats to each other since the fingerprinting is done on the audio itself.

尘曦 2024-07-21 04:59:31

看起来 Chromaprint 会满足您的要求。 它将 PCM 数据转换为音频指纹,然后您可以用它来进行比较。

他们有一个 C API 库(实际上是用 C++ 编写的)、一个 Python 前端,以及一些用于将结果转换为 JSON 的实用程序,这意味着您可以使用另一种语言来操作数据。 不过,我认为它们本身并不提供比较功能。

另外,如果您使用的是 Linux 系统,您很可能会找到适用于它的软件包。

It looks like Chromaprint would do what you're looking for. It transforms PCM data in audio fingerprints which you can then use to compare.

They have a C API library (it's actually written in C++, though), a python front end, and also some utilities to convert the results in JSON which means you could use another language to manipulate the data. I don't think that they provide the compare function itself, though.

Also if you're using a Linux system, it's likely that you will find a package for it.

避讳 2024-07-21 04:59:31

如果您只是想根据标签比较 mp3,我建议 taglib。

If you're just looking to compare mp3s based on the tags, I'd recommend taglib.

不知在何时 2024-07-21 04:59:31

我编写了一个 php 程序来比较音频——忽略所有标头、gfx 和其他信息。
基本上来自文件列表 foreach 作为 $src:
/usr/bin/ffmpeg -hide_banner -y -i "$src" -f s16le -acodec pcm_s16le output.raw 2> /dev/null

您可以 md5 output.raw 文件(您必须记录该文件)并将其与其他原始文件进行比较。

转换后的文件是原始输出音频,除了创建哈希之外不会使用。 我预见到我的脚本的唯一问题是在转换/散列后保留较低质量的文件,或者保留具有较少 ID3 标签的文件...尽管我移动文件,而不是删除它们,所以仍然保留旧文件。

I wrote a php program to just compare the audio --ignoring all the headers, gfx, and other info.
Basically from a file list foreach as $src:
/usr/bin/ffmpeg -hide_banner -y -i "$src" -f s16le -acodec pcm_s16le output.raw 2> /dev/null

You can md5 the output.raw file (you have to record that file) and compare it with other raw files.

The converted file is a raw output audio and is not used except for creating the hash. The only problems I foresee with my script is keeping a file of lower quality after conversion/hashing, or keeping a file with less ID3 tags... although I move files, rather than delete them, so still have the old files.

小镇女孩 2024-07-21 04:59:31

我经常在 Linux 上使用 fdupes 来查找重复文件。 fdupes 使用 md5 校验和。

I frequently use fdupes on linux to locate duplicate files. fdupes uses md5 checksums.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文