如何从 PCM 数据写入 mp3 帧(C/C++)?

发布于 2024-08-11 23:44:16 字数 208 浏览 3 评论 0原文

如何从 PCM 数据写入 mp3 帧(不是带有 ID3 等的完整 mp3 文件)?

我有类似 PCM 数据(例如 100mb)的数据,我想从该数据创建一个 mp3 帧数组。如何进行这样的操作呢? (例如使用lame或任何其他开源编码器)

我需要什么:

  • 用于编码的开源库。
  • 有关如何操作、关于等的教程和博客文章。

How to write mp3 frames (not full mp3 files with ID3 etc) from PCM data?

I have something like PCM data (for ex 100mb) I want to create an array of mp3 frames from that data. How to perform such operation? (for ex with lame or any other opensource encoder)

What do I need:

  • Open Source Libs for encoding.
  • Tutorials and blog articles on How to do it, about etc.

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

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

发布评论

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

评论(2

一个人的夜不怕黑 2024-08-18 23:44:16

您应该能够使用 LAME。它有一个 -t 命令行开关 关闭输出中的 INFO 标头(否则出现在帧 0 中)。如果仍然留下太多簿记数据,您应该能够编写一个单独的工具来删除它们。

You should be able to use LAME. It has a -t command line switch that turns off the INFO header in the output (otherwise present in frame 0). If that still leaves too much bookkeeping data, you should be able to write a separate tool to strip that away.

北城半夏 2024-08-18 23:44:16

您已经走在正确的道路上:使用 LAME 外部可执行文件或任何其他 shell 调用的编码器。

要构建 MP 框架,如果您感兴趣的层是 3,从头开始并不容易。有压缩步骤、快速傅立叶变换和量化,这些都是复杂且冗长的解释。开发人员从头开始构建它所需的工作量非常大。
有编程式 C 和 C++ MP 编码库,但您要么被要求付费,要么得到非常有限的支持,要么只有非常有限的接口选项。

去 LAME,研究他们的 wiki

You are already on the right track: use LAME external executable, or any other shell-invoked encoder.

To build MP frames, were your layer of interest is 3, is not easy to do from scratch. There are compression steps, Fast-fourier transforms followed by quantization, which are of complex and tediously long explanation. The amount of work required for a developer to build it from scratch is very big.
There are programmatic C and C++ MP encoding libs, but you will be either asked for fees, be left with very limited support, or have very limited interfacing options.

Go LAME, study their wiki.

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