在客户端 JavaScript 中将 WAV 转换为任何压缩音频格式 [英] Converting WAV to any compressed audio format in client-side JavaScript

查看:35
本文介绍了在客户端 JavaScript 中将 WAV 转换为任何压缩音频格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Recorder.js<在浏览器中录制来自 getUserMedia({audio:true}); 的音频/a> 然后将其导出为 WAV 文件,因为这是该库提供的唯一选项.

I am recording audio from getUserMedia({audio:true}); in the browser using Recorder.js and then exporting it as a WAV file because that's the only option the library provides.

一个 1 分 20 秒的文件大小为 14.1 MB.我需要将音频上传到服务器,并且需要快速完成.如何将 WAV 音频转换为任何其他压缩格式以减小文件大小?

A 1 minute 20 seconds file is 14.1 MB large. I need to upload the audio to a server and I need to do it fast. How do I convert the WAV audio in any other compressed format to lower the file size?

我不介意转换为:

  • MP3
  • 作品
  • WebM
  • 奥格
  • FLAC
  • 您知道的任何其他格式

如果目前还没有办法转换为这些格式中的任何一种,我该如何在客户端上压缩 WAV 文件?

If there is no way as of now to convert to any of these formats, how can I compress the WAV file on the client?

PS:我搜索了很多可以在 JS 中转换 WAV 的东西,但一无所获.libmp3lame.js 在 Chrome 中不起作用.

PS: I did a lot of searches to find anything that converts WAV in JS, but found nothing. libmp3lame.js isn't working in Chrome.

谢谢!

推荐答案

我已经制作了一个录音机,它可以直接从浏览器结合 RecorderJS 和 libmp3lame.js 录制到 mp3

I've made an audio recorder that records to mp3 directly from the browser combining RecorderJS and libmp3lame.js

您可以在这里找到 gitHub 项目:https://github.com/nusofthq/Recordmp3js

You can find the gitHub project here: https://github.com/nusofthq/Recordmp3js

以及更详细的实现说明:http://nusofthq.com/blog/Recording-mp3-using-only-html5-and-javascript-recordmp3-js/

and a more detailed explanation of the implementation: http://nusofthq.com/blog/recording-mp3-using-only-html5-and-javascript-recordmp3-js/

这篇关于在客户端 JavaScript 中将 WAV 转换为任何压缩音频格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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