2

我的项目将要求用户上传未压缩的 WAV 音频文件,一旦上传,服务器将需要将其编码为 MP3 以在网站上提供服务。我在这个项目中使用 Django,它将托管在 Linux VPS(来自 Linode)上。由于空间和带宽,我想使用 Amazon S3。

我不是这方面的专家,这个项目将为我涵盖许多新事物。但是这方面的任何指导对我来说都是一件好事。

我很可能会使用 django-storages 应用程序与 Amazon S3 对话。但我不确定在什么时候我会为 FFmpeg 运行服务器命令来进行转换。如果用户正在上传音频文件,django-storages 会将其放置在 Amazon S3 上。但是,然后,我应该在哪里以及如何让 FFmpeg 在刚刚上传的文件上运行它的命令行以对 MP3 进行编码,然后我的网站来提供和使用该 MP3(此时它也应该在 Amazon S3 上)?

我对如何去做有点困惑。就像我说的,我不是专家!有人可以指导我吗?

4

2 回答 2

2

您可能会考虑编写自定义存储后端。这应该可以插入 django-storages,但我从未使用过该应用程序,也不能肯定地说。您可以在此处找到有关编写自定义存储后端的一些指导:http: //docs.djangoproject.com/en/dev/howto/custom-file-storage/

在您的后端,您可以使用 Python 的subprocess命令运行 ffmgpeg 来处理 mp3 转换:http ://docs.python.org/library/subprocess.html#subprocess.call

于 2010-07-20T01:52:47.493 回答
0

May be don't use django-storage for such files, You can convert the audio to a temp mp3 file on server (Linux VPS) and using boto or command line S3 tool or some other way upload mp3 to S3.

于 2010-07-18T12:46:13.797 回答