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

2022-01-24 00:00:00 mp3 linux debian php

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

What's the easiest way to merge the contents of several MP3 files into one using PHP 5.2 on Linux Debian system? I found some scripts that are supposed to do in PHP only, but they seem to be buggy. Perhaps there is a way to accomplish this task using command line programs, that I could install on my Linux Debian machine?

推荐答案

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

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

first you have to install 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 执行所有这些命令.

you can execute all these commands from php with exec().

相关文章