PCM转换为MP3 / OGG [英] Convert PCM to MP3/OGG

查看:1635
本文介绍了PCM转换为MP3 / OGG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要转换的PCM的连续流,或编码的音频(ADPCM,ULAW,作品),成MP3 / OGG格式,以便它可以(使用HTML的音频标签)流传输到一个浏览器。我有一部分工作,现在我需要开发的转换层流MP3 /使用音频标签OGG-

I need to convert a continuous stream of PCM, or encoded audio (ADPCM, uLaw, Opus), into MP3/OGG format so that it can be streamed to a browser (using html's audio tag). I have the "stream-mp3/ogg-using-audio-tag" part working, now I need to develop the conversion layer.

我有两个问题:


  1. 如何使用n音讯和/或其他一些C#库/框架我转换成PCM MP3 / OGG?我认为有一个在n音讯演示应用程序可能这样做的代码片段或两个,但我一直没能找到它。

  2. 请我一定要编码的数据转换(ADPCM,ULAW,OPUS)成PCM(我可以)之前,我把它转换成MP3 / OGG,或MP3 / OGG'集装箱'可以接受的编码数据?

请注意:。据我所知,我是授权与MP3的问题,所以我们是开放的,使用OGG

NOTE: I understand there my be licensing issues with MP3 so we are open to using OGG.

感谢

推荐答案

要回答你的第一个问题,去创造你需要一个编码MP3或OGG。 n音讯不包括MP3或OGG编码器。它所做的就是给你的方法来访问已安装在您的计算机(如ACM或媒体基础变换)的编码器。然而,随着MP3和OGG你会发现,最简单的办法是找到一个非托管的DLL或命令行实用程序和访问,从.NET。我写这篇文章,您链接到上面包括如何使用LAME.exe与stdin和stdout来PCM转换成MP3上飞的简要说明。

To answer your first question, to create MP3 or OGG you need an encoder. NAudio does not include an MP3 or an OGG encoder. All it does is give you ways to access encoders that are already installed on your computer (such as ACM or Media Foundation Transforms). However, with both MP3 and OGG you'll find that the easiest way is to find an unmanaged DLL or a command line utility and access that from .NET. The article I wrote which you linked to above includes a brief explanation of how you can use LAME.exe with stdin and stdout to convert PCM to MP3 on the fly.

由于关于第二个问题,答案是肯定的。每当你转码,你首先要解码PCM,然后重新编码目标的编解码器。我认为理论上就可以把音频编码以任何格式转换成一个OGG容器,但在实践中,在一个OGG容器音频通常与Vorbis格式编码。 FLAC和OPUS可能的选择,但再次你需要找到一个应用程序或库,可以为你写的OGG容器格式,因为我不知道有任何完全托管OGG作家。

As for your second question, the answer is yes. Whenever you transcode, you first decode to PCM, then re-encode in the target codec. I think theoretically you can put audio encoded in any format into an OGG container, but in practice, audio in an OGG container is usually encoded with Vorbis. FLAC and OPUS may be options, but once again you'd need to find an application or library that can write the OGG container format for you, as I'm not aware of any fully managed OGG writers.

这篇关于PCM转换为MP3 / OGG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆