问题描述
我需要将 AMR 音频文件转换为 MP3.如何在没有 FFMPEG 的情况下在 PHP 中制作它(我无权在服务器上安装它).请帮帮我.
I need to convert AMR audio file to MP3. How can I make it in PHP without FFMPEG (i have no permissions to install it on the server). Please help me.
推荐答案
使用 SoX - 声音处理的瑞士军刀.非常容易使用.
Use SoX - the Swiss Army knife of sound processing. Very easy to use.
它是一个命令行工具,而不是 PHP 库,因此要从 PHP 使用,您需要执行 shell 命令并在代码中获取结果.我在几个项目中使用过它.
It is a command line tool not a PHP library so to use from PHP you need to execute a shell command and get the result with in your code. I have used it with in few projects.
PHP 示例:
<?php
exec('sox /mypath/my_audio.amr /mypath/my_audio.mp3');
?>
SoX 是一个跨平台(Windows、Linux、MacOS X 等)命令行实用程序,可以将各种格式的计算机音频文件转换为其他格式.它还可以对这些声音文件应用各种效果,此外,SoX 还可以在大多数平台上播放和录制音频文件.
SoX is a cross-platform (Windows, Linux, MacOS X, etc.) command line utility that can convert various formats of computer audio files in to other formats. It can also apply various effects to these sound files, and, as an added bonus, SoX can play and record audio files on most platforms.
SoX 是一个非常成熟的项目!这是链接:http://sox.sourceforge.net/
SoX is very mature project! Here is the link: http://sox.sourceforge.net/
以下是我为您搜索的一些示例:http://www.thegeekstuff.com/2009/05/sound-exchange-sox-15-examples-to-manipulate-audio-files/
Here are some examples I googled for you:http://www.thegeekstuff.com/2009/05/sound-exchange-sox-15-examples-to-manipulate-audio-files/
这篇关于在 PHP 中转换音频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!