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.
我正在使用cordova-plugin-media插件来记录来自android和ios设备的音频文件。但是,android只允许以“.amr”结尾记录文件,而另一方面的iOS仅支持“.wav”。但是,Android上的iOS设备播放“.wav”时,iOS不支持“.amr”文件。这就是为什么我必须以某种方式转换它们。
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:
因为我找不到任何cordova-plugin转换客户端上的“.amr”文件除了这个(基于外部API并且极其缓慢+不完全工作 - 此外我不喜欢做客户端的文件转换),我正在寻找服务器端的解决方案:
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... :(
是否有任何javascript库(最好是“nodejs-friendly”)允许我轻松地将“.amr”文件转换为“.wav”或“.mp3”(或类似 - 只能在iOS上播放)?尽管ffmpeg(我无法正确安装),我找不到任何解决方案...... :(
(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...)
(在cordova-plugin-media中将mime-type设置为'audio / wav'会创建一个“损坏的”wav文件,在使用工具进一步分析时仍然是amr-encode ...)
I really appreciate your help!
我非常感谢你的帮助!
1 个解决方案
#1
3
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.
www.cloudconvert.com为“即时”转换视频/音频/ img文件提供了一个非常简单的API。
For node.js there is a node package for that I can recommend: https://github.com/cloudconvert/cloudconvert-node
对于node.js,我可以推荐一个节点包: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:
我决定将.amr转换为.mp3和现在.wav(iOS“标准”),因为.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) { ...
Happy coding/converting everyone ;-)
快乐编码/转换每个人;-)
#1
3
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.
www.cloudconvert.com为“即时”转换视频/音频/ img文件提供了一个非常简单的API。
For node.js there is a node package for that I can recommend: https://github.com/cloudconvert/cloudconvert-node
对于node.js,我可以推荐一个节点包: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:
我决定将.amr转换为.mp3和现在.wav(iOS“标准”),因为.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) { ...
Happy coding/converting everyone ;-)
快乐编码/转换每个人;-)