0

I need to put an MP3 file over another one in a specific time slice of whole file.

Is it possible to do this? If so, is there any library or method?

I dont want to put them one after another. Such as;

file_put_contents('combined.mp3',
    file_get_contents('file1.mp3') .
    file_get_contents('file2.mp3'));
  • I don't think that if you split in half a mp3 you get two working track.. and viceversa. – Federkun Oct 04 '15 at 13:00
  • 2
    Can't be done *"in"* PHP. But of course, PHP can invoke `ffmpeg`, which is suitable to merge/slice audio files. – mario Oct 04 '15 at 13:08

1 Answers1

0

PHP has limited functionality and it will be slow. i recommend using a native library for such purpose. and execute it using shell_exec().

this one may help. https://trac.ffmpeg.org/wiki/Concatenate . that example uses ffmpeg. but make sure shell calls are secure.

haseeb
  • 682
  • 5
  • 16