在javascript中壓縮包含音頻PCM數據的blob (compress blob containing audio PCM data in javascript)


問題描述

在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; 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.

Some people talk about http compression (that would also use Gzip) but isn't that a browser‑server decision when setting up communication?

I found 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? 

Does anybody have any experience with compressing audio on the client side (without using flash)

‑‑‑‑‑

參考解法

方法 1:

Since you are using getUserMedia, I suppose that you want to record speech from a user's microphone.

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.

Now, Speex might be a good codec for you. And as it happens, there is a full JavaScript Speex encoder/decoder, complete with example: speex.js.

方法 2:

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.

方法 3:

I know I am answering quite late, here is my attempt at client side audio compression without using 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... 

(by ThomasCarstenjeremymido)

參考文件

  1. compress blob containing audio PCM data in javascript (CC BY‑SA 3.0/4.0)

#compression #javascript #audio #client-side #html






相關問題

CSS 壓縮和組合 / js 縮小 - 在運行時或構建時更好? (CSS compression & combining / js minification - Better to do at runtime or at build time?)

在javascript中壓縮包含音頻PCM數據的blob (compress blob containing audio PCM data in javascript)

如何提高@font-face 的加載性能 (How to improve loading performance of @font-face)

ServiceStack 流壓縮 (ServiceStack Stream Compression)

有沒有辦法讀取壓縮存檔的屬性? (Is there any way to read the properties of a Compressed Archive?)

德爾福 2009 中的 Zlib (Zlib in Delphi 2009)

SQL 2008開啟頁面壓縮後如何回收空間? (How to reclaim space after turning on page compression in SQL 2008?)

本機 Lua 中的高效可變字節數組 (Efficient mutable byte array in native Lua)

在 JavaScript 中壓縮純文本? (Compressing plaintext in JavaScript?)

如何遞歸壓縮文件夾? (How to zip a folder recursively?)

使用 GZIPOutputStream 壓縮字符串 (Compressing a string using GZIPOutputStream)

壓縮後 1 KB 可以容納多少文本? (How much text I can fit in 1 kilobyte with compression?)







留言討論