简体   繁体   English

哪里可以获得纯C ++ Lame MP3编码器 - PCM到MP3的例子?

[英]Where to get pure C++ Lame MP3 encoder - PCM to MP3 example?

So all I need is a simple function that sets it up (eating incoming PCM RATE (for example: rate near to 44100) It's channels (for example: 2) and -bits (for example: 16) and desirable 128 kb\\s rate) and another one that takes PCM data and encodes it into pure MP3 frames. 所以我只需要一个简单的功能来设置它(吃掉传入的PCM速率(例如:速率接近44100)它的通道(例如:2)和-bits(例如:16)和所需的128 kb \\ s速率另一个采用PCM数据并将其编码为纯MP3帧的数据。

I know it looks like a silly homework task but I assure you - it is not. 我知道这看起来像是一项愚蠢的家庭作业,但我向你保证 - 事实并非如此。

I hope it will be of help to all C++ developers starting with MP3s. 我希望它能帮助所有从MP3开始的C ++开发人员。

So can anybody please help me with that? 所以有人可以帮助我吗?

See the example I gave in your other question for the basic usage of Lame. 有关Lame的基本用法,请参阅我在您的其他问题中给出的示例。 It should contain everything you need. 它应该包含你需要的一切。

这是很长一段时间以来我搞砸了,但是Lame lib包含你需要做的所有事情,查看lame.h ,你可以查看一些测试代码

Personally, I'd be looking at ffmpeg's libavcodec . 就个人而言,我会关注ffmpeg的libavcodec There's an example file containing an audio_encode_example which ought to be more or less what you're looking for. 有一个包含audio_encode_example的示例文件,它应该或多或少地符合您的要求。

See also this question . 另见这个问题

Note that not all ffmpeg packagings include mp3 codec support (patent issues) by default, although there's usually some simple way of enabling it. 请注意,默认情况下并非所有ffmpeg包装都包含mp3编解码器支持(专利问题),尽管通常有一些简单的启用它的方法。

GStreamer should definitely be able to handle this. GStreamer绝对应该能够解决这个问题。 If you are on Windows you can use the GStreamer Winbuilds to get started. 如果您使用的是Windows,则可以使用GStreamer Winbuilds开始使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM