使用 Ruby MP4Info gem 等工具确定 Apple AAC 与无损格式?

发布于 2024-10-03 05:59:00 字数 444 浏览 4 评论 0原文

我正在尝试为广播电台组织音乐,并拥有一个包含大量音乐文件的 iTunes 库。文件有多种格式(Flac、MP3、AAC 等)。我需要按格式分解所有文件。

我有一个简单的 Ruby 脚本,它遍历目录树并可以通过扩展拉取,因此我可以将所有 .mp3 文件移动到 MP3 目录中。但是,我对 m4a 文件有疑问,因为有些 .m4a 文件是 Apple Lossless 格式,有些是 Apple 的 AAC 格式。

我遇到的问题是 MP4Info gem 似乎只有“编码器”,它返回类似 iTunes 9.0.2 的内容,这对于确定无损格式与有损格式没有帮助。

因此,我的想法是获取文件的 SIZE 属性并将其除以 SECS 属性。看来我应该能够以无损格式和有损格式提出一个不错的字节/秒的标准,因为它们大约相差一个数量级。我不确定我正在寻找什么数量级(我猜这取决于比特率)。

有没有更好、更简单的方法来做到这一点?

I'm trying to organized music for a radio station and have an iTunes library with a huge number of music files. The files are in various formats (Flac, MP3, AAC, etc.). I need to break all the files up by format.

I have a simple Ruby script that walks the directory tree and can pull by extension, so I can move all .mp3 files into an MP3 directory. However, I have a problem with m4a files, because some .m4a files are Apple Lossless format and some are Apple's AAC format.

The problem I have is that the MP4Info gem seems only to have "Encoder," which returns something like iTunes 9.0.2, which is not helpful in determining lossless vs lossy formatting.

So, my thought is to take the SIZE attribute of the file and divide that by the SECS attribute. It seems that I should be able to come up with a decent rubric for bytes/second in a lossless vs a lossy format, since they will be roughly an order of magnitude off. I'm not sure what order of magnitude I'm looking for (it depends on bitrate, I'd guess).

Are there better, easier ways to do this?

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

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

发布评论

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

评论(1

樱花坊 2024-10-10 05:59:00

因此,看起来使用启发式比特率(例如 en.wikipedia.org/wiki/Bit_rate#Audio_.28MP3.29 中给出的值)很有用,但也许更有用的是 iTunes 歌曲列表。

事实证明,iTunes 中有一个可用的比特率列,任何保存为 AAC 的内容都将列为比特率“256(可变)”。因此,人们可以轻松地按比特率对整个音乐库进行排序,并找到所有值为 256 的歌曲。您还可以看到哪些歌曲较低,然后任何高于 600 左右的歌曲都将是无损的。

300-500左右就有问题了。根据音乐的复杂程度,您可能会拥有一首比特率为 400 或 500 的无损歌曲。不知道在那里做什么 - 但它的歌曲总数非常少。

So, it looks like using the heuristics for bitrate (e.g. the values given at en.wikipedia.org/wiki/Bit_rate#Audio_.28MP3.29) is useful, but maybe more useful is the iTunes list of songs.

It turns out that there is a column available in iTunes for bitrate- and anything saves as AAC will be listed as a bitrate of "256 (Variable)." So one can easily sort the entire music library by bitrate and find all songs with a value of 256. You could also see which are lower- and then anything above around 600 is going to be Lossless.

There's an issue around 300-500 or so. Depending on the complexity of the music, you might have a song with a bitrate of 400 or 500 that is lossless. Not sure what to do around there- but it's pretty minimum in total song number.

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