一种转换音频文件比特率/格式的方法(在上传和存储到 S3 之间)
目前使用 PHP 5.3.x 和 PHP 5.3.x软呢帽
好的。我会尽量保持简单。我正在开发一个允许上传和下载的工具。在 S3 上存储音频文件以供播放。本质上,用户将文件(目前仅允许 mp3 和 m4a)上传到服务器,然后通过适用于 amazon aws 的 PHP SDK 将文件推送到 S3 进行存储。
缺少的链接是我想执行一个简单的比特率和比特率。在上传文件之前对文件进行格式转换。 (确保所有文件均为 160kbs 且为 .mp3)。
我研究过 ffmpeg,尽管 PHP 库似乎只允许读取比特率和其他元,而不允许实际转换。
有人对解决这个问题的最佳方法有什么想法吗?运行执行转换的 shell_exec() 命令是否足以做到这一点,或者是否有更有效/更好的方法来做到这一点?
提前致谢!非常感谢任何帮助或建议。
Currently using PHP 5.3.x & Fedora
Ok. I'll try to keep this simple. I'm working on a tool that allows the upload & storing of audio files on S3 for playback. Essentially, the user uploads a file (currently only allowing mp3 & m4a) to the server, and the file is then pushed to S3 for storage via the PHP SDK for amazon aws.
The missing link is that I would like to perform a simple bitrate & format conversion of the file prior to uploading the file. (ensuring that all files are 160kbs and .mp3).
I've looked into ffmpeg, although it seems that the PHP library only allows for reading bitrates and other meta, not for actual conversion.
Does anyone have any thoughts on the best way to approach this? Would running a shell_exec() command that performs the conversion be sufficient to do this, or is there a more efficient/better way of doing this?
Thanks in advance! Any help or advice is much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要执行转换并上传到 PHP 应用程序“外部”的 S3,因为用户需要在页面上停留很长时间。这可能是一个从命令行使用 ffmpeg 的简单应用程序。
我不熟悉linux,所以也许其他人可以提供更具体的答案,但这是基本前提:
You need to perform the conversion and upload to S3 'outside' of the PHP application as it'll take to long for the user to hang around on the page. This could be a simple app that uses ffmpeg from the command line.
I'm not familar with linux, so perhaps someone else can provide a more specific answer, but here is the basic premise: