Do you know a class to merge two MP3 files using PHP?
I did not find anything on Google.
If by merging you mean placing one sound over another, then please do not pay any answer to it.
If you do not want to transcode MP3s, you can simply add them. I know this worked for MPEG movies, so I think it can work for MP3s too. Another option is to add audio files to the Zip archive without compression, and then rename the extension to .mp3.
I did a quick test and this
file_put_contents('combined.mp3', file_get_contents('file1.mp3') . file_get_contents('file2.mp3'));
. ID3 , . . .
, googling
. PHP MP3. . (, , PHP, @ceejayoz.)
. :
MP3 Linux Debian PHP
mp3 ?
.mp3 MPEG-1 MPEG-2 Layer III, . . , , , . , .. , . , , .
ID3- ( ) .
MPEG-1 MPEG-2 . , . , , .
ID3 , , , , , .
getID3() (http://getid3.sourceforge.net/) . , , MP3 ID3 .
:
Content-length
"-". 1- MP3-, :
$output_audio = textToMP3("Hello World"); // Original audio $silent_audio = file_get_contents("silence.mp3"); // 1 second silence $content_length = strlen($output_audio) + strlen($silent_audio); // Output the audio stream header('Content-type: audio/mpeg'); header('Content-length: ' . $content_length); header('Cache-Control: no-cache'); header("Pragma: no-cache"); header("Expires: 0"); echo $audio . $silent_audio;
, , , : https://github.com/falahati/PHP-MP3
composer require falahati/php-mp3
MP3:
$audio1 = \falahati\PHPMP3\MpegAudio::fromFile("1.mp3"); $audio2 = \falahati\PHPMP3\MpegAudio::fromFile("2.mp3"); $audio1->append($audio2)->saveFile("3.mp3");
Source: https://habr.com/ru/post/1770825/More articles:Android: changing wallpaper for drawing - javaInteresting compiler projects - compiler-constructionCalling a function from a function pointer in Delphi - multithreadingcorrect idiom for character string (not std :: string) constants in C ++ - c ++Bash: Finally (Exclude) Exception - bashЭффект обрезки дерева решений - artificial-intelligenceModular CSS Methods - performanceRecommend a web service that processes a location within a certain radius? - phpTest-based development for SQL code - tddArtificial Intelligence and Chat Filters - filterAll Articles