cordova-plugin-media:Parse“.amr” nodejs服务器上的音频文件 [英] cordova-plugin-media: Parse ".amr" Audio File on nodejs server

查看:886
本文介绍了cordova-plugin-media:Parse“.amr” nodejs服务器上的音频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 cordova-plugin-media 插件录制来自Android和ios设备的音频文件。
然而,android只允许在.amr结尾记录文件,另一方面,iOS只支持.wav。
在Android设备上播放.wav,但是iOS不支持.amr文件。



由于我找不到任何cordova插件转换客户端上的.amr文件,除了这一个(这是基于外部API和extreeeemly慢+不完全工作 - 除了我'我不是在客户端执行文件转换的风扇),我在服务器端寻找一个解决方案:



是否有任何javascript库(最好是nodejs友好)允许我轻松地将.amr文件转换为.wav或.mp3(或类似 - 只是可以在iOS上播放)?
尽管ffmpeg(我无法正确安装),我找不到任何解决方案...:(



(设置mime-类型为audio / wav在cordova-plugin-media中创建一个损坏的wav文件,仍然使用工具进行分析时进行编码...)

我真的很感谢您的帮助!

解决方案

我没有任何线索为什么我的问题downvoted-成为一个大问题...



然而,我想出了一个解决方案,我与你分享,如果有人正在运行的同样的问题, did:



www.cloudconvert.com提供了一个非常简单的api for即时转换视频/音频/ img文件。



对于node.js,有一个我可以推荐的节点包: https: //github.com/cloudconvert/cloudconvert-node



我决定将.amr转换为.mp3,现在是.wav(iOSstandard)因为.mp3较小。为了能够在iOS设备上播放它,但是必须从github上描述的(手动)示例稍微调整一点比特率。
确保通过以下选项到您的转换过程:

  ccprocess.start({
outputformat :'mp3',
input:'download',
file:'path-to-your-file',
converteroptions:{
audio_bitrate:721,
audio_frequency:44100,
audio_qscale:-1
}
},function(err,ccprocess){...
pre>

快乐编码/转换所有人; - )


I'm using the cordova-plugin-media plugin to record audio-files from android and ios devices. However, android only allows to record the file in ".amr" ending, iOS on the otherside only supports ".wav". Playing the ".wav" from the iOS device on Android works, however, iOS doesn't support ".amr" files. That's why I have to convert them somehow.

Since I couldn't find any cordova-plugin converting the ".amr" file on the clientside besides this one (which is based on an external API and extreeeemly slow + not fully working - in addition that I'm not a fan of doing file-conversions on the client-side), I'm looking for a solution on the server-side:

Is there any javascript-library (best if it's "nodejs-friendly") allowing me to easily convert an ".amr" file to a ".wav" or ".mp3" (or similiar - just playable on iOS)? Despite ffmpeg (which I couldn't manage to install properly), I couldn't find ANY solutions... :(

(setting the mime-type to 'audio/wav' in the cordova-plugin-media creates a "corrupt" wav file, still amr-encode when analyzing it further with a tool...)

I really appreciate your help!

解决方案

I don't have any clue why my question got downvoted - this audio problem seems to be a big issue...

Nevertheless, I came up with a "solution", which I share with you if someone else is running in the same problems as I did:

www.cloudconvert.com offers a very simple api for "on-the-fly" converting video/audio/img files.

For node.js there is a node package for that I can recommend: https://github.com/cloudconvert/cloudconvert-node

I decided to convert the .amr to .mp3 and now .wav (iOS "standard") since .mp3 is smaller. To be able to play it on an iOS device though one has to adjust the bitrate a little bit from the (manual) example described on github. Make sure to pass the following options to your converting process:

  ccprocess.start({
    outputformat: 'mp3',
    input: 'download',
    file: 'path-to-your-file',
    converteroptions: {
      audio_bitrate: "721",
      audio_frequency: "44100",
      audio_qscale: -1
    }
  }, function (err, ccprocess) { ...

Happy coding/converting everyone ;-)

这篇关于cordova-plugin-media:Parse“.amr” nodejs服务器上的音频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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