在Linux Debian中使用PHP合并MP3文件

在Linux Debian系统上使用PHP 5.2将多个MP3文件的内容合并为一个最简单的方法是什么? 我发现一些脚本只能在PHP中执行,但是它们似乎是bug。 也许有一种方法可以使用命令行程序完成这个任务,我可以在我的Linux Debian机器上安装?

检查这个: http : //lists.mplayerhq.hu/pipermail/ffmpeg-user/2009-September/022171.html

首先你必须安装sox。 sudo apt-get install sox。

$ sox first.mp3 -r 44100 -c 2 -s -w first.raw $ sox second.mp3 -r 44100 -c 2 -s -w second.raw $ cat first.raw second.raw > concatenated.raw $ sox -r 44100 -c 2 -s -w concatenated.raw concatenated.mp3 

你可以用exec()从php执行所有这些命令。

取自此链接的代码

cat first_part.mp3 second_part.mp3 third_part.mp3 > newfile.mp3

他们说你的文件必须有相同的比特率。

你可以使用mpg321的比特率

mpg321 -t first_part.mp3

希望能帮助到你。