简体   繁体   English

在JavaScript中压缩包含音频PCM数据的Blob

[英]compress blob containing audio PCM data in javascript

I have made a program that generates a blob (containing PCM data) from a recording using the new HTML5 getusermedia api however; 我已经编写了一个程序,使用新的HTML5 getusermedia api从记录生成斑点(包含PCM数据); these recordings can get pretty big and I hoped that the files could be compressed before sending them to the server. 这些录音可能会很大,我希望可以将文件压缩后再发送到服务器。 I know that mp3/ogg compression is way out of what a browser can handle (i think) so I looked elsewhere. 我知道mp3/ogg compression超出了浏览器的处理能力(我认为),因此我在其他地方查找。

Some people talk about http compression (that would also use Gzip) but isn't that a browser-server decision when setting up communication? 有人谈论过http compression (也将使用Gzip),但这不是浏览器服务器在设置通信时做出的决定吗?

I found https://github.com/olle/lz77-kit ; 我发现https://github.com/olle/lz77-kit ; it has a javascript implementation for the client and php for the server but would this even make sensor for audio? 它具有用于客户端的javascript实现和用于服务器的php,但这是否会使音频传感器?

Does anybody have any experience with compressing audio on the client side (without using flash) 是否有人在压缩客户端音频方面有任何经验(不使用Flash)

Since you are using getUserMedia , I suppose that you want to record speech from a user's microphone. 由于您使用的是getUserMedia ,因此我假设您想记录用户麦克风的语音。

Audio-specific compression algorithms should be much more efficient than general data compression algorithms. 音频特定的压缩算法应比常规数据压缩算法高效得多。 The downside of audio codes, such as MP3, are, that they are lossy. 音频代码(例如MP3)的缺点是它们有损。

Now, Speex might be a good codec for you. 现在, Speex可能是适合您的编解码器。 And as it happens, there is a full JavaScript Speex encoder/decoder, complete with example: speex.js . 碰巧的是,有一个完整的JavaScript Speex编码器/解码器,并带有示例: speex.js

I know I am answering quite late, here is my attempt at client side audio compression without using flash : https://github.com/Mido22/recordOpus , 我知道我回答得很晚,这是我不使用Flash进行客户端音频压缩的尝试: https : //github.com/Mido22/recordOpus

I am sending the encoded opus packets to server(nodejs) using opus packets through socket, where I convert it to whatever format requested by user and provide him the link... 我正在通过套接字使用opus数据包将编码的opus数据包发送到服务器(nodejs),在这里我将其转换为用户请求的任何格式,并为他提供链接...

Raw (or compressed) audio is very hard to compress and I would highly suggest either writing a browser plugin that compresses the audio or doing it server side. 原始(或压缩)音频很难压缩,我强烈建议编写一个压缩音频的浏览器插件或在服务器端进行压缩。 A general compression algorithm, zip, gz, etc. will not be able to give you any worthwhile amount of bandwidth savings. 通用压缩算法zip,gz等将无法为您节省任何有价值的带宽。

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

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