Convert wav to ogg on app engine (or in javascript?)

99封情书 提交于 2019-12-22 00:25:56

问题


I've built a little app engine app that lets users upload short recordings. Some of the recordings are done in-browser with https://github.com/mattdiamond/Recorderjs, which creates wav files. To save space, I'd like to convert those to ogg before writing them to the app engine datastore, so that I use less of my outgoing bandwidth when I play the audio recordings back to users.

How can I do this? I googled around, and apparently there's a command line tool called oggenc that encodes to ogg -- but I'm pretty sure I can't install that (or, even if I could install it, make calls to it) on app engine.

I found a similar question at Encode audio from getUserMedia() to a .OGG in JavaScript -- this links to https://github.com/jpemartins/speex.js, a project that looks like it might eventually be able to convert from wav to ogg in javascript (which would be great), but, as far as I can tell, does not do so at the moment. At https://github.com/jpemartins/speex.js/issues/4 the authors mentions that WAV -> ... -> OGG is not yet possible.

What else should I try?

Edit: My app engine code is written in Python, so another possibility would be to do the conversion there, with a python module that can convert wav to ogg. I think http://pymedia.org/ can do this, but I'd have to somehow install it on app engine -- is that possible?


回答1:


Pymedia isn't pure python so you won't be able to use it on app engine.

You probably want to build something on Compute Engine to do this.




回答2:


Provided it's possible to replace Matt Diamond's recorderjs with its fork, chris-rudmin/Recorderjs (demo page) in AppEngine, this should be feasible. Or first encode to WAV and use opusenc.js (demo page), which is an Emscripten port of the Opusenc tool, to convert a temporary WAV file to Ogg-Opus client side.



来源:https://stackoverflow.com/questions/17507799/convert-wav-to-ogg-on-app-engine-or-in-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!