diff --git a/README.md b/README.md index c20d0a3..e1be8aa 100644 --- a/README.md +++ b/README.md @@ -647,3 +647,11 @@ $app->register(new FFMpeg\FFMpegServiceProvider(), array( ## License This project is licensed under the [MIT license](http://opensource.org/licenses/MIT). + +Music: "Favorite Secrets" by Waylon Thornton +From the Free Music Archive +[CC BY NC SA](http://creativecommons.org/licenses/by-nc-sa/3.0/us/) + +Music: "Siesta" by Jahzzar +From the Free Music Archive +[CC BY SA](https://creativecommons.org/licenses/by-sa/3.0/) diff --git a/src/FFMpeg/Media/Audio.php b/src/FFMpeg/Media/Audio.php index 8a74962..124460b 100644 --- a/src/FFMpeg/Media/Audio.php +++ b/src/FFMpeg/Media/Audio.php @@ -139,4 +139,15 @@ class Audio extends AbstractStreamableMedia { return new Waveform($this, $this->driver, $this->ffprobe, $width, $height, $colors); } + + /** + * Concatenates a list of audio files into one unique audio file. + * + * @param array $sources + * @return Concat + */ + public function concat($sources) + { + return new Concat($sources, $this->driver, $this->ffprobe); + } } diff --git a/src/FFMpeg/Media/Concat.php b/src/FFMpeg/Media/Concat.php index 97f5e1e..81c8a7c 100644 --- a/src/FFMpeg/Media/Concat.php +++ b/src/FFMpeg/Media/Concat.php @@ -73,7 +73,7 @@ class Concat extends AbstractMediaType * Saves the concatenated video in the given array, considering that the sources videos are all encoded with the same codec. * * @param string $outputPathfile - * @param string $streamCopy + * @param bool $streamCopy * * @return Concat * diff --git a/tests/Functional/AudioConcatenationTest.php b/tests/Functional/AudioConcatenationTest.php new file mode 100644 index 0000000..f4ca197 --- /dev/null +++ b/tests/Functional/AudioConcatenationTest.php @@ -0,0 +1,31 @@ +getFFMpeg(); + + $files = [ + __DIR__ . '/../files/Jahzzar_-_05_-_Siesta.mp3', + __DIR__ . '/../files/02_-_Favorite_Secrets.mp3', + ]; + + $audio = $ffmpeg->open(reset($files)); + + $this->assertInstanceOf('FFMpeg\Media\Audio', $audio); + + clearstatcache(); + $filename = __DIR__ . '/output/concat-output.mp3'; + + $audio->concat($files)->saveFromSameCodecs($filename, TRUE); + + $this->assertFileExists($filename); + unlink($filename); + } +} \ No newline at end of file diff --git a/tests/files/02_-_Favorite_Secrets.mp3 b/tests/files/02_-_Favorite_Secrets.mp3 new file mode 100644 index 0000000..3f6ef4e Binary files /dev/null and b/tests/files/02_-_Favorite_Secrets.mp3 differ diff --git a/tests/files/Jahzzar_-_05_-_Siesta.mp3 b/tests/files/Jahzzar_-_05_-_Siesta.mp3 new file mode 100644 index 0000000..1db27d7 Binary files /dev/null and b/tests/files/Jahzzar_-_05_-_Siesta.mp3 differ