2018-03-23 17:37:29 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Tests\FFMpeg\Functional;
|
|
|
|
|
|
|
|
|
|
class AudioConcatenationTest extends FunctionalTestCase
|
|
|
|
|
{
|
|
|
|
|
public function testSimpleAudioFileConcatTest()
|
|
|
|
|
{
|
|
|
|
|
$ffmpeg = $this->getFFMpeg();
|
2021-03-04 19:17:34 +01:00
|
|
|
|
2022-02-09 14:32:43 +01:00
|
|
|
$files = [
|
2021-03-04 19:17:34 +01:00
|
|
|
realpath(__DIR__ . '/../files/Jahzzar_-_05_-_Siesta.mp3'),
|
|
|
|
|
realpath(__DIR__ . '/../files/02_-_Favorite_Secrets.mp3'),
|
2022-02-09 14:32:43 +01:00
|
|
|
];
|
2018-03-23 17:37:29 +02:00
|
|
|
|
2018-03-26 18:25:50 +03:00
|
|
|
$audio = $ffmpeg->open(reset($files));
|
2018-03-23 17:37:29 +02:00
|
|
|
|
|
|
|
|
$this->assertInstanceOf('FFMpeg\Media\Audio', $audio);
|
2021-03-04 19:17:34 +01:00
|
|
|
|
2018-03-26 19:03:38 +03:00
|
|
|
clearstatcache();
|
|
|
|
|
$filename = __DIR__ . '/output/concat-output.mp3';
|
2018-03-23 17:37:29 +02:00
|
|
|
|
2022-02-09 14:32:43 +01:00
|
|
|
$audio->concat($files)->saveFromSameCodecs($filename, true);
|
2021-03-04 19:17:34 +01:00
|
|
|
|
2018-03-23 17:37:29 +02:00
|
|
|
$this->assertFileExists($filename);
|
|
|
|
|
unlink($filename);
|
|
|
|
|
}
|
2021-03-04 19:17:34 +01:00
|
|
|
}
|