From 46394564a5dcc4ff1752d03abc6c0c492450328f Mon Sep 17 00:00:00 2001 From: Patrik Karisch Date: Wed, 2 Mar 2016 03:18:02 +0100 Subject: [PATCH 001/117] Allow usage of evenement v2.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8686027..21ff774 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "php" : ">=5.3.3", "alchemy/binary-driver" : "~1.5", "doctrine/cache" : "~1.0", - "evenement/evenement" : "~1.0", + "evenement/evenement" : "^2.0|^1.0", "neutron/temporary-filesystem" : "~2.1, >=2.1.1" }, "suggest": { From f765864749bbe4b2f319b6eba5d8da7476a28a0b Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Sat, 5 Mar 2016 18:03:41 +0100 Subject: [PATCH 002/117] Fix test URL --- tests/FFMpeg/Functional/FFProbeTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/FFMpeg/Functional/FFProbeTest.php b/tests/FFMpeg/Functional/FFProbeTest.php index 373c24f..5f7bb03 100644 --- a/tests/FFMpeg/Functional/FFProbeTest.php +++ b/tests/FFMpeg/Functional/FFProbeTest.php @@ -24,6 +24,6 @@ class FFProbeTest extends FunctionalTestCase public function testProbeOnRemoteFile() { $ffprobe = FFProbe::create(); - $this->assertGreaterThan(0, count($ffprobe->streams('http://video-js.zencoder.com/oceans-clip.mp4'))); + $this->assertGreaterThan(0, count($ffprobe->streams('http://vjs.zencdn.net/v/oceans.mp4'))); } } From 1fee6fb4be1f0e655f5b7983153510cf815fb853 Mon Sep 17 00:00:00 2001 From: Ha Phan Date: Sun, 6 Sep 2015 13:24:21 +0800 Subject: [PATCH 003/117] Add missing getter $currentTime --- .../Format/ProgressListener/AbstractProgressListener.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/FFMpeg/Format/ProgressListener/AbstractProgressListener.php b/src/FFMpeg/Format/ProgressListener/AbstractProgressListener.php index 93943cd..f92dde1 100644 --- a/src/FFMpeg/Format/ProgressListener/AbstractProgressListener.php +++ b/src/FFMpeg/Format/ProgressListener/AbstractProgressListener.php @@ -120,6 +120,14 @@ abstract class AbstractProgressListener extends EventEmitter implements Listener return $this->totalPass; } + /** + * @return int + */ + public function getCurrentTime() + { + return $this->currentTime; + } + /** * {@inheritdoc} */ From bd61d8d35edf018ad1815e7243f4a0e4daae25b9 Mon Sep 17 00:00:00 2001 From: Ha Phan Date: Sun, 6 Sep 2015 13:24:31 +0800 Subject: [PATCH 004/117] Remove unused statement --- src/FFMpeg/FFProbe/DataMapping/AbstractData.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/FFMpeg/FFProbe/DataMapping/AbstractData.php b/src/FFMpeg/FFProbe/DataMapping/AbstractData.php index 9e75483..ce04e89 100644 --- a/src/FFMpeg/FFProbe/DataMapping/AbstractData.php +++ b/src/FFMpeg/FFProbe/DataMapping/AbstractData.php @@ -11,8 +11,6 @@ namespace FFMpeg\FFProbe\DataMapping; -use FFMpeg\Exception\InvalidArgumentException; - abstract class AbstractData implements \Countable { private $properties; From d4db96662c5a98b6c20e2f8faa8fe71cb9ea5370 Mon Sep 17 00:00:00 2001 From: Patrik Karisch Date: Sun, 6 Mar 2016 23:19:40 +0100 Subject: [PATCH 005/117] Cleanup composer, ignore lock, add me as a maintainer to the authors ;) --- .gitignore | 2 +- composer.json | 45 +++++++++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index f474a5d..c85f162 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,5 @@ /vendor/ /docs/build composer.phar +composer.lock phpunit.xml - diff --git a/composer.json b/composer.json index 21ff774..8fa6a0e 100644 --- a/composer.json +++ b/composer.json @@ -5,31 +5,36 @@ "keywords": ["video processing", "video", "audio processing", "audio", "avconv", "ffmpeg", "avprobe", "ffprobe"], "license": "MIT", "authors": [ - { - "name": "Romain Neutron", - "email": "imprec@gmail.com", - "homepage": "http://www.lickmychip.com/" - }, - { - "name": "Phraseanet Team", - "email": "info@alchemy.fr", - "homepage": "http://www.phraseanet.com/" - } + { + "name": "Romain Neutron", + "email": "imprec@gmail.com", + "homepage": "http://www.lickmychip.com/" + }, + { + "name": "Phraseanet Team", + "email": "info@alchemy.fr", + "homepage": "http://www.phraseanet.com/" + }, + { + "name": "Patrik Karisch", + "email": "patrik@karisch.guru", + "homepage": "http://www.karisch.guru" + } ], "require": { - "php" : ">=5.3.3", - "alchemy/binary-driver" : "~1.5", - "doctrine/cache" : "~1.0", - "evenement/evenement" : "^2.0|^1.0", - "neutron/temporary-filesystem" : "~2.1, >=2.1.1" + "php": ">=5.3.3", + "alchemy/binary-driver": "^1.5", + "doctrine/cache": "^1.0", + "evenement/evenement": "^2.0 || ^1.0", + "neutron/temporary-filesystem": "^2.1.1" }, "suggest": { - "php-ffmpeg/extras" : "A compilation of common audio & video drivers for PHP-FFMpeg" + "php-ffmpeg/extras": "A compilation of common audio & video drivers for PHP-FFMpeg" }, "require-dev": { - "sami/sami" : "~1.0", - "silex/silex" : "~1.0", - "phpunit/phpunit" : "~3.7" + "sami/sami": "~1.0", + "silex/silex": "~1.0", + "phpunit/phpunit": "~3.7" }, "autoload": { "psr-0": { @@ -38,7 +43,7 @@ }, "extra": { "branch-alias": { - "dev-master": "0.5-dev" + "dev-master": "0.6-dev" } } } From f9c6316badaf4eef6d5376d46b498afdf6334cd4 Mon Sep 17 00:00:00 2001 From: Patrik Karisch Date: Sun, 6 Mar 2016 23:38:04 +0100 Subject: [PATCH 006/117] Cleanup phpunit configs and PSR-4 autoloading and namespaces for tests --- composer.json | 7 ++++- phpunit-functional.xml.dist | 27 ------------------- phpunit.xml.dist | 9 ++++--- tests/{FFMpeg => }/Functional/FFProbeTest.php | 4 +-- .../Functional/FunctionalTestCase.php | 2 +- .../Functional/VideoTranscodeTest.php | 10 +++---- .../Functional/output/.placeholder | 0 .../Coordinate/AspectRatioTest.php | 4 +-- .../Coordinate/DimensionTest.php | 4 +-- .../Coordinate/FrameRateTest.php | 4 +-- .../Tests => Unit}/Coordinate/PointTest.php | 4 +-- .../Coordinate/TimeCodeTest.php | 4 +-- .../Driver/FFMpegDriverTest.php | 4 +-- .../Driver/FFProbeDriverTest.php | 4 +-- .../FFMpegServiceProviderTest.php | 2 +- tests/{FFMpeg/Tests => Unit}/FFMpegTest.php | 2 +- .../FFProbe/DataMapping/AbstractDataTest.php | 4 +-- .../DataMapping/StreamCollectionTest.php | 4 +-- .../FFProbe/DataMapping/StreamTest.php | 4 +-- .../Tests => Unit}/FFProbe/MapperTest.php | 8 +++--- .../FFProbe/OptionsTesterTest.php | 6 ++--- .../FFProbe/OutputParserTest.php | 12 ++++----- tests/{FFMpeg/Tests => Unit}/FFProbeTest.php | 2 +- .../Filters/Audio/AudioFiltersTest.php | 4 +-- .../Audio/AudioResamplableFilterTest.php | 4 +-- .../Filters/FiltersCollectionTest.php | 4 +-- .../Frame/DisplayRatioFixerFilterTest.php | 4 +-- .../Filters/Frame/FrameFiltersTest.php | 4 +-- .../Filters/Video/CropFilterTest.php | 4 +-- .../Filters/Video/CustomFilterTest.php | 4 +-- .../Filters/Video/FrameRateFilterTest.php | 4 +-- .../Filters/Video/ResizeFilterTest.php | 4 +-- .../Filters/Video/RotateFilterTest.php | 4 +-- .../Filters/Video/SynchronizeFilterTest.php | 4 +-- .../Filters/Video/VideoFiltersTest.php | 4 +-- .../Filters/Video/WatermarkFilterTest.php | 24 ++++++++--------- .../Tests => Unit}/Format/Audio/AacTest.php | 2 +- .../Format/Audio/AudioTestCase.php | 4 +-- .../Tests => Unit}/Format/Audio/FlacTest.php | 2 +- .../Tests => Unit}/Format/Audio/Mp3Test.php | 2 +- .../Format/Audio/VorbisTest.php | 2 +- .../Tests => Unit}/Format/Audio/WavTest.php | 2 +- .../AudioProgressListenerTest.php | 4 +-- .../VideoProgressListenerTest.php | 4 +-- .../Tests => Unit}/Format/Video/OggTest.php | 2 +- .../Format/Video/VideoTestCase.php | 4 +-- .../Tests => Unit}/Format/Video/WMV3Test.php | 2 +- .../Tests => Unit}/Format/Video/WMVTest.php | 2 +- .../Tests => Unit}/Format/Video/WebMTest.php | 2 +- .../Tests => Unit}/Format/Video/X264Test.php | 2 +- .../Media/AbstractMediaTestCase.php | 4 +-- .../Media/AbstractStreamableTestCase.php | 2 +- .../Tests => Unit}/Media/AudioProg.php | 2 +- .../Tests => Unit}/Media/AudioTest.php | 4 +-- .../Tests => Unit}/Media/FrameTest.php | 2 +- tests/{FFMpeg/Tests => Unit}/Media/Prog.php | 2 +- .../Tests => Unit}/Media/VideoTest.php | 6 ++--- tests/{FFMpeg/Tests => Unit}/TestCase.php | 2 +- tests/bootstrap.php | 9 ++++--- 59 files changed, 128 insertions(+), 144 deletions(-) delete mode 100644 phpunit-functional.xml.dist rename tests/{FFMpeg => }/Functional/FFProbeTest.php (90%) rename tests/{FFMpeg => }/Functional/FunctionalTestCase.php (87%) rename tests/{FFMpeg => }/Functional/VideoTranscodeTest.php (90%) rename tests/{FFMpeg => }/Functional/output/.placeholder (100%) rename tests/{FFMpeg/Tests => Unit}/Coordinate/AspectRatioTest.php (97%) rename tests/{FFMpeg/Tests => Unit}/Coordinate/DimensionTest.php (91%) rename tests/{FFMpeg/Tests => Unit}/Coordinate/FrameRateTest.php (88%) rename tests/{FFMpeg/Tests => Unit}/Coordinate/PointTest.php (77%) rename tests/{FFMpeg/Tests => Unit}/Coordinate/TimeCodeTest.php (95%) rename tests/{FFMpeg/Tests => Unit}/Driver/FFMpegDriverTest.php (95%) rename tests/{FFMpeg/Tests => Unit}/Driver/FFProbeDriverTest.php (95%) rename tests/{FFMpeg/Tests => Unit}/FFMpegServiceProviderTest.php (98%) rename tests/{FFMpeg/Tests => Unit}/FFMpegTest.php (99%) rename tests/{FFMpeg/Tests => Unit}/FFProbe/DataMapping/AbstractDataTest.php (94%) rename tests/{FFMpeg/Tests => Unit}/FFProbe/DataMapping/StreamCollectionTest.php (96%) rename tests/{FFMpeg/Tests => Unit}/FFProbe/DataMapping/StreamTest.php (98%) rename tests/{FFMpeg/Tests => Unit}/FFProbe/MapperTest.php (87%) rename tests/{FFMpeg/Tests => Unit}/FFProbe/OptionsTesterTest.php (95%) rename tests/{FFMpeg/Tests => Unit}/FFProbe/OutputParserTest.php (72%) rename tests/{FFMpeg/Tests => Unit}/FFProbeTest.php (99%) rename tests/{FFMpeg/Tests => Unit}/Filters/Audio/AudioFiltersTest.php (89%) rename tests/{FFMpeg/Tests => Unit}/Filters/Audio/AudioResamplableFilterTest.php (88%) rename tests/{FFMpeg/Tests => Unit}/Filters/FiltersCollectionTest.php (96%) rename tests/{FFMpeg/Tests => Unit}/Filters/Frame/DisplayRatioFixerFilterTest.php (92%) rename tests/{FFMpeg/Tests => Unit}/Filters/Frame/FrameFiltersTest.php (84%) rename tests/{FFMpeg/Tests => Unit}/Filters/Video/CropFilterTest.php (94%) rename tests/{FFMpeg/Tests => Unit}/Filters/Video/CustomFilterTest.php (87%) rename tests/{FFMpeg/Tests => Unit}/Filters/Video/FrameRateFilterTest.php (94%) rename tests/{FFMpeg/Tests => Unit}/Filters/Video/ResizeFilterTest.php (98%) rename tests/{FFMpeg/Tests => Unit}/Filters/Video/RotateFilterTest.php (96%) rename tests/{FFMpeg/Tests => Unit}/Filters/Video/SynchronizeFilterTest.php (84%) rename tests/{FFMpeg/Tests => Unit}/Filters/Video/VideoFiltersTest.php (96%) rename tests/{FFMpeg/Tests => Unit}/Filters/Video/WatermarkFilterTest.php (59%) rename tests/{FFMpeg/Tests => Unit}/Format/Audio/AacTest.php (77%) rename tests/{FFMpeg/Tests => Unit}/Format/Audio/AudioTestCase.php (97%) rename tests/{FFMpeg/Tests => Unit}/Format/Audio/FlacTest.php (78%) rename tests/{FFMpeg/Tests => Unit}/Format/Audio/Mp3Test.php (77%) rename tests/{FFMpeg/Tests => Unit}/Format/Audio/VorbisTest.php (78%) rename tests/{FFMpeg/Tests => Unit}/Format/Audio/WavTest.php (77%) rename tests/{FFMpeg/Tests => Unit}/Format/ProgressListener/AudioProgressListenerTest.php (97%) rename tests/{FFMpeg/Tests => Unit}/Format/ProgressListener/VideoProgressListenerTest.php (97%) rename tests/{FFMpeg/Tests => Unit}/Format/Video/OggTest.php (77%) rename tests/{FFMpeg/Tests => Unit}/Format/Video/VideoTestCase.php (96%) rename tests/{FFMpeg/Tests => Unit}/Format/Video/WMV3Test.php (78%) rename tests/{FFMpeg/Tests => Unit}/Format/Video/WMVTest.php (77%) rename tests/{FFMpeg/Tests => Unit}/Format/Video/WebMTest.php (78%) rename tests/{FFMpeg/Tests => Unit}/Format/Video/X264Test.php (78%) rename tests/{FFMpeg/Tests => Unit}/Media/AbstractMediaTestCase.php (50%) rename tests/{FFMpeg/Tests => Unit}/Media/AbstractStreamableTestCase.php (96%) rename tests/{FFMpeg/Tests => Unit}/Media/AudioProg.php (82%) rename tests/{FFMpeg/Tests => Unit}/Media/AudioTest.php (98%) rename tests/{FFMpeg/Tests => Unit}/Media/FrameTest.php (98%) rename tests/{FFMpeg/Tests => Unit}/Media/Prog.php (81%) rename tests/{FFMpeg/Tests => Unit}/Media/VideoTest.php (99%) rename tests/{FFMpeg/Tests => Unit}/TestCase.php (99%) diff --git a/composer.json b/composer.json index 8fa6a0e..658a8c7 100644 --- a/composer.json +++ b/composer.json @@ -34,13 +34,18 @@ "require-dev": { "sami/sami": "~1.0", "silex/silex": "~1.0", - "phpunit/phpunit": "~3.7" + "phpunit/phpunit": "^4.8" }, "autoload": { "psr-0": { "FFMpeg": "src" } }, + "autoload-dev": { + "psr-4": { + "Tests\\FFMpeg\\": "tests" + } + }, "extra": { "branch-alias": { "dev-master": "0.6-dev" diff --git a/phpunit-functional.xml.dist b/phpunit-functional.xml.dist deleted file mode 100644 index 3f0f738..0000000 --- a/phpunit-functional.xml.dist +++ /dev/null @@ -1,27 +0,0 @@ - - - - - tests/FFMpeg/Functional - - - - - vendor - tests - - - - - diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f36c568..3027d1f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -12,16 +12,19 @@ bootstrap="tests/bootstrap.php" > - - tests/FFMpeg/Tests + + tests/Unit + + + tests/Functional + vendor tests - diff --git a/tests/FFMpeg/Functional/FFProbeTest.php b/tests/Functional/FFProbeTest.php similarity index 90% rename from tests/FFMpeg/Functional/FFProbeTest.php rename to tests/Functional/FFProbeTest.php index 5f7bb03..10a98c0 100644 --- a/tests/FFMpeg/Functional/FFProbeTest.php +++ b/tests/Functional/FFProbeTest.php @@ -1,6 +1,6 @@ assertGreaterThan(0, count($ffprobe->streams(__DIR__ . '/../../files/Audio.mp3'))); + $this->assertGreaterThan(0, count($ffprobe->streams(__DIR__ . '/../files/Audio.mp3'))); } /** diff --git a/tests/FFMpeg/Functional/FunctionalTestCase.php b/tests/Functional/FunctionalTestCase.php similarity index 87% rename from tests/FFMpeg/Functional/FunctionalTestCase.php rename to tests/Functional/FunctionalTestCase.php index 25e6461..02556ea 100644 --- a/tests/FFMpeg/Functional/FunctionalTestCase.php +++ b/tests/Functional/FunctionalTestCase.php @@ -1,6 +1,6 @@ getFFMpeg(); - $video = $ffmpeg->open(__DIR__ . '/../../files/Test.ogv'); + $video = $ffmpeg->open(__DIR__ . '/../files/Test.ogv'); $this->assertInstanceOf('FFMpeg\Media\Video', $video); @@ -46,13 +46,13 @@ class VideoTranscodeTest extends FunctionalTestCase public function testTranscodeInvalidFile() { $ffmpeg = $this->getFFMpeg(); - $ffmpeg->open(__DIR__ . '/../../files/UnknownFileTest.ogv'); + $ffmpeg->open(__DIR__ . '/../files/UnknownFileTest.ogv'); } public function testSaveInvalidForgedVideo() { $ffmpeg = $this->getFFMpeg(); - $video = new Video(__DIR__ . '/../../files/UnknownFileTest.ogv', $ffmpeg->getFFMpegDriver(), $ffmpeg->getFFProbe()); + $video = new Video(__DIR__ . '/../files/UnknownFileTest.ogv', $ffmpeg->getFFMpegDriver(), $ffmpeg->getFFProbe()); $this->setExpectedException('FFMpeg\Exception\RuntimeException'); $video->save(new X264('libvo_aacenc'), __DIR__ . '/output/output-x264.mp4'); @@ -72,7 +72,7 @@ class VideoTranscodeTest extends FunctionalTestCase } $ffmpeg = $this->getFFMpeg(); - $video = $ffmpeg->open(__DIR__ . '/../../files/portrait.MOV'); + $video = $ffmpeg->open(__DIR__ . '/../files/portrait.MOV'); $video->filters() ->resize(new Dimension(320, 240), ResizeFilter::RESIZEMODE_INSET) diff --git a/tests/FFMpeg/Functional/output/.placeholder b/tests/Functional/output/.placeholder similarity index 100% rename from tests/FFMpeg/Functional/output/.placeholder rename to tests/Functional/output/.placeholder diff --git a/tests/FFMpeg/Tests/Coordinate/AspectRatioTest.php b/tests/Unit/Coordinate/AspectRatioTest.php similarity index 97% rename from tests/FFMpeg/Tests/Coordinate/AspectRatioTest.php rename to tests/Unit/Coordinate/AspectRatioTest.php index 49e703c..100b6b7 100644 --- a/tests/FFMpeg/Tests/Coordinate/AspectRatioTest.php +++ b/tests/Unit/Coordinate/AspectRatioTest.php @@ -1,9 +1,9 @@ getMock('FFMpeg\Format\VideoInterface'); - $filter = new WatermarkFilter(__DIR__ . '/../../../../files/watermark.png'); - $this->assertEquals(array('-vf', 'movie='.__DIR__ .'/../../../../files/watermark.png [watermark]; [in][watermark] overlay=0:0 [out]'), $filter->apply($video, $format)); + $filter = new WatermarkFilter(__DIR__ . '/../../../files/watermark.png'); + $this->assertEquals(array('-vf', 'movie='.__DIR__ .'/../../../files/watermark.png [watermark]; [in][watermark] overlay=0:0 [out]'), $filter->apply($video, $format)); // check size of video is unchanged $this->assertEquals(320, $stream->get('width')); @@ -33,31 +33,31 @@ class WatermarkFilterTest extends TestCase $format = $this->getMock('FFMpeg\Format\VideoInterface'); // test position absolute - $filter = new WatermarkFilter(__DIR__ . '/../../../../files/watermark.png', array( + $filter = new WatermarkFilter(__DIR__ . '/../../../files/watermark.png', array( 'position' => 'absolute', 'x' => 10, 'y' => 5 )); - $this->assertEquals(array('-vf', 'movie='.__DIR__ .'/../../../../files/watermark.png [watermark]; [in][watermark] overlay=10:5 [out]'), $filter->apply($video, $format)); + $this->assertEquals(array('-vf', 'movie='.__DIR__ .'/../../../files/watermark.png [watermark]; [in][watermark] overlay=10:5 [out]'), $filter->apply($video, $format)); // test position relative - $filter = new WatermarkFilter(__DIR__ . '/../../../../files/watermark.png', array( + $filter = new WatermarkFilter(__DIR__ . '/../../../files/watermark.png', array( 'position' => 'relative', 'bottom' => 10, 'left' => 5 )); - $this->assertEquals(array('-vf', 'movie='.__DIR__ .'/../../../../files/watermark.png [watermark]; [in][watermark] overlay=5:main_h - 10 - overlay_h [out]'), $filter->apply($video, $format)); + $this->assertEquals(array('-vf', 'movie='.__DIR__ .'/../../../files/watermark.png [watermark]; [in][watermark] overlay=5:main_h - 10 - overlay_h [out]'), $filter->apply($video, $format)); // test position relative - $filter = new WatermarkFilter(__DIR__ . '/../../../../files/watermark.png', array( + $filter = new WatermarkFilter(__DIR__ . '/../../../files/watermark.png', array( 'position' => 'relative', 'bottom' => 5, 'right' => 4 )); - $this->assertEquals(array('-vf', 'movie='.__DIR__ .'/../../../../files/watermark.png [watermark]; [in][watermark] overlay=main_w - 4 - overlay_w:main_h - 5 - overlay_h [out]'), $filter->apply($video, $format)); + $this->assertEquals(array('-vf', 'movie='.__DIR__ .'/../../../files/watermark.png [watermark]; [in][watermark] overlay=main_w - 4 - overlay_w:main_h - 5 - overlay_h [out]'), $filter->apply($video, $format)); // test position relative - $filter = new WatermarkFilter(__DIR__ . '/../../../../files/watermark.png', array( + $filter = new WatermarkFilter(__DIR__ . '/../../../files/watermark.png', array( 'position' => 'relative', 'left' => 5, 'top' => 11 )); - $this->assertEquals(array('-vf', 'movie='.__DIR__ .'/../../../../files/watermark.png [watermark]; [in][watermark] overlay=5:11 [out]'), $filter->apply($video, $format)); + $this->assertEquals(array('-vf', 'movie='.__DIR__ .'/../../../files/watermark.png [watermark]; [in][watermark] overlay=5:11 [out]'), $filter->apply($video, $format)); } } diff --git a/tests/FFMpeg/Tests/Format/Audio/AacTest.php b/tests/Unit/Format/Audio/AacTest.php similarity index 77% rename from tests/FFMpeg/Tests/Format/Audio/AacTest.php rename to tests/Unit/Format/Audio/AacTest.php index 5e98e77..7c316b5 100644 --- a/tests/FFMpeg/Tests/Format/Audio/AacTest.php +++ b/tests/Unit/Format/Audio/AacTest.php @@ -1,6 +1,6 @@ getMock('Alchemy\BinaryDriver\Listeners\ListenerInterface')); - $progressableFormat = $this->getMockBuilder('FFMpeg\Tests\Media\AudioProg') + $progressableFormat = $this->getMockBuilder('Tests\FFMpeg\Unit\Media\AudioProg') ->disableOriginalConstructor()->getMock(); $progressableFormat->expects($this->any()) ->method('getExtraParams') diff --git a/tests/FFMpeg/Tests/Media/FrameTest.php b/tests/Unit/Media/FrameTest.php similarity index 98% rename from tests/FFMpeg/Tests/Media/FrameTest.php rename to tests/Unit/Media/FrameTest.php index 8f9af04..43f70c3 100644 --- a/tests/FFMpeg/Tests/Media/FrameTest.php +++ b/tests/Unit/Media/FrameTest.php @@ -1,6 +1,6 @@ getMock('Alchemy\BinaryDriver\Listeners\ListenerInterface')); - $progressableFormat = $this->getMockBuilder('FFMpeg\Tests\Media\Prog') + $progressableFormat = $this->getMockBuilder('Tests\FFMpeg\Unit\Media\Prog') ->disableOriginalConstructor()->getMock(); $progressableFormat->expects($this->any()) ->method('getExtraParams') @@ -353,7 +353,7 @@ class VideoTest extends AbstractStreamableTestCase ->method('getPasses') ->will($this->returnValue(2)); - $progressableAudioFormat = $this->getMockBuilder('FFMpeg\Tests\Media\AudioProg') + $progressableAudioFormat = $this->getMockBuilder('Tests\FFMpeg\Unit\Media\AudioProg') ->disableOriginalConstructor()->getMock(); $progressableAudioFormat->expects($this->any()) ->method('getExtraParams') diff --git a/tests/FFMpeg/Tests/TestCase.php b/tests/Unit/TestCase.php similarity index 99% rename from tests/FFMpeg/Tests/TestCase.php rename to tests/Unit/TestCase.php index 4757f95..5481599 100644 --- a/tests/FFMpeg/Tests/TestCase.php +++ b/tests/Unit/TestCase.php @@ -1,6 +1,6 @@ add('FFMpeg\Tests', __DIR__); -$loader->add('FFMpeg\Functional', __DIR__); +$file = __DIR__ . '/../vendor/autoload.php'; +if (!file_exists($file)) { + throw new RuntimeException('Install dependencies to run test suite.'); +} + +$autoload = require_once $file; From fa0581b4684076a52cfc6136415911b791c61968 Mon Sep 17 00:00:00 2001 From: Patrik Karisch Date: Sun, 6 Mar 2016 23:43:03 +0100 Subject: [PATCH 007/117] Improve travis builds and test PHP 7.0 and HHVM (with allow failures) --- .travis.yml | 26 ++++++++++++++++++-------- composer.json | 2 +- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index e4bc51a..9f69cb6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,18 +1,28 @@ language: php -before_script: - - sudo apt-get update - - sudo apt-get install -y ffmpeg libavcodec-extra-53 - - composer self-update - - composer install --no-interaction --prefer-source --dev - php: - - 5.3.3 - 5.3 - 5.4 - 5.5 - 5.6 + - 7.0 + - hhvm + +matrix: + allow_failures: + - php: hhvm + include: + - php: 5.3 + env: COMPOSER_FLAGS="--prefer-lowest" + +before_install: + - sudo apt-get update + - composer self-update + - if [ "$COMPOSER_FLAGS" == "--prefer-lowest" ]; then composer require "roave/security-advisories" dev-master --no-update; fi; + +install: + - sudo apt-get install -y ffmpeg libavcodec-extra-53 + - composer update --prefer-source $COMPOSER_FLAGS script: - vendor/bin/phpunit --verbose - - vendor/bin/phpunit --verbose -c phpunit-functional.xml.dist diff --git a/composer.json b/composer.json index 658a8c7..6527383 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ } ], "require": { - "php": ">=5.3.3", + "php": "^5.3.9 || ^7.0", "alchemy/binary-driver": "^1.5", "doctrine/cache": "^1.0", "evenement/evenement": "^2.0 || ^1.0", From 232db3ce404b49d8ca5eda032e4a1dcd52abb80f Mon Sep 17 00:00:00 2001 From: Patrik Karisch Date: Mon, 7 Mar 2016 00:10:47 +0100 Subject: [PATCH 008/117] Build pushes only on master and pull requests only --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 9f69cb6..852dc1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,9 @@ language: php +branches: + only: + - master + php: - 5.3 - 5.4 From 7687be530c0bb22ee92ee8924cb0ff0e5edd5e5d Mon Sep 17 00:00:00 2001 From: Patrik Karisch Date: Tue, 8 Mar 2016 01:47:06 +0100 Subject: [PATCH 009/117] Update changelog --- CHANGELOG.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2f6830..e9206b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,14 @@ CHANGELOG --------- -* 0.6.0 (xx-xx-2015) +* 0.6.1 (2016-03-08) + + * Support PHP 7 and test against + * Unused code cleanup (@haphan) + * Composer and tests cleanup (PSR-4 autoloading) + * Allow usage of evenement v2.0 + +* 0.6.0 (2016-01-30) * AbstractData::get no longer throws exceptions (@sujayjaju). * Add crop filter (@cangelis). From 16ee22dc65b382a7be54829716769ae5f23f7f7d Mon Sep 17 00:00:00 2001 From: Patrik Karisch Date: Mon, 7 Mar 2016 00:39:23 +0100 Subject: [PATCH 010/117] Add a meaningful pull request template --- .github/PULL_REQUEST_TEMPLATE.md | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..2a25088 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,36 @@ +| Q | A +| ------------------ | --- +| Bug fix? | yes +| New feature? | yes +| BC breaks? | yes +| Deprecations? | yes +| Fixed tickets | fixes #issuenum +| Related issues/PRs | #issuenum +| License | MIT + +#### What's in this PR? + +Explain the contents of the PR. + +#### Why? + +Which problem does the PR fix? + +#### Example Usage + +~~~php +$foo = new Foo(); + +// Now we can do +$foo->doSomething(); + +// Remove this section if not needed +~~~ + +#### BC Breaks/Deprecations + +Describe BC breaks/deprecations here (Remove this section if not needed). + +#### To Do + +- [ ] Create tests From b1912859308faf4df76d768fcc3cd79a83558490 Mon Sep 17 00:00:00 2001 From: Patrik Karisch Date: Mon, 7 Mar 2016 00:51:04 +0100 Subject: [PATCH 011/117] Add a meaningful issue template --- .github/ISSUE_TEMPLATE.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..9899b3a --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,23 @@ +| Q | A +| ------------ | --- +| Bug? | no +| Version Used | Specific tag or commit sha +| New Feature? | no + +#### Expected Behavior + +What is the behavior you expect? + +#### Actual Behavior + +How does Sulu behave at the moment? + +#### Steps to Reproduce + +What are the steps to reproduce this bug? Please add code examples, +screenshots or links to GitHub repositories that reproduce the problem. + +#### Possible Solutions + +If you have already ideas how to solve the issue, add them here. +Otherwise remove this section. From d1c60d29d81a4228f6f688f3159f5fa799808773 Mon Sep 17 00:00:00 2001 From: Patrik Karisch Date: Wed, 9 Mar 2016 22:09:51 +0100 Subject: [PATCH 012/117] Updated changelog to follow keepachangelog.com style --- CHANGELOG.md | 188 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 123 insertions(+), 65 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9206b3..def4d95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,108 +1,166 @@ CHANGELOG ---------- +========= -* 0.6.1 (2016-03-08) +All notable changes to this project will be documented in this file. +This project adheres to [Semantic Versioning](http://semver.org/). - * Support PHP 7 and test against - * Unused code cleanup (@haphan) - * Composer and tests cleanup (PSR-4 autoloading) - * Allow usage of evenement v2.0 +[Unreleased] +------------ -* 0.6.0 (2016-01-30) +### Added - * AbstractData::get no longer throws exceptions (@sujayjaju). - * Add crop filter (@cangelis). - * Fix watermark (@sujayjaju). +- Add pull request and issue templates. -* 0.5.1 (08-26-2014) +### Changed - * Fix video aspect ratio calculation (@nlegoff). +- Updated changelog to follow [keepachangelog.com](http://keepachangelog.com/) + style you see now here. -* 0.5.0 (08-12-2014) +[0.6.1] - 2016-03-08 +-------------------- - * Add support for Wav and AAC audio formats (@MrHash). - * Add watermark filter (@sylvainv). - * Add configuration for audio channels (@SimonSimCity). +- Support PHP 7 and test against +- Unused code cleanup (@haphan) +- Composer and tests cleanup (PSR-4 autoloading) +- Allow usage of evenement v2.0 -* 0.4.4 (12-17-2013) +[0.6.0] - 2016-01-30 +-------------------- - * Fix width / height dimensions extraction. +- AbstractData::get no longer throws exceptions (@sujayjaju). +- Add crop filter (@cangelis). +- Fix watermark (@sujayjaju). -* 0.4.3 (12-02-2013) +[0.5.1] - 2016-08-26 +-------------------- - * Fix using rotate and resize filters at the same time (#78) +- Fix video aspect ratio calculation (@nlegoff). -* 0.4.2 (11-29-2013) +[0.5.0] - 2014-08-12 +-------------------- - * Add Rotate filter. - * Remove time_start metadata when using synchronize filter - * Remove restriction on filesystem resources. +- Add support for Wav and AAC audio formats (@MrHash). +- Add watermark filter (@sylvainv). +- Add configuration for audio channels (@SimonSimCity). -* 0.4.1 (11-26-2013) +[0.4.4] - 2016-12-17 +-------------------- - * Add Clip filter (@guimeira) +- Fix width / height dimensions extraction. -* 0.4.0 (10-21-2013) +[0.4.3] - 2013-02-12 +-------------------- - * Add support for video to audio transcoding - * BC Break : Add FormatInterface::getPasses and FormatInterface::getExtraParams +- Fix using rotate and resize filters at the same time (#78) -* 0.3.5 (10-21-2013) +[0.4.2] - 2013-11-29 +-------------------- - * Add vorbis audio format (@jacobbudin). - * Fix #66 : Allow single pass encodings. +- Add Rotate filter. +- Remove time_start metadata when using synchronize filter +- Remove restriction on filesystem resources. -* 0.3.4 (09-05-2013) +[0.4.1] - 2013-11-26 +-------------------- - * Fix Invalid ratio computing. +- Add Clip filter (@guimeira) -* 0.3.3 (09-05-2013) +[0.4.0] - 2013-10-21 +-------------------- - * Add convenient Stream::getDimensions method to extract video dimension. - * Add DisplayRatioFixer Frame filter. +- Add support for video to audio transcoding +- BC Break : Add FormatInterface::getPasses and FormatInterface::getExtraParams -* 0.3.2 (08-08-2013) +[0.3.5] - 2013-10-21 +-------------------- - * Fix A/V synchronization over flash and HTML5 players. +- Add vorbis audio format (@jacobbudin). +- Fix #66 : Allow single pass encodings. -* 0.3.1 (08-06-2013) +[0.3.4] - 2013-09-05 +-------------------- - * Allow use of FFProbe on remote URIs. - * Fix #47 : MediaTypeInterface::save adds filters depending on the codec. - * Save frame to target file without prompt. +- Fix Invalid ratio computing. -* 0.3.0 (07-04-2013) +[0.3.3] - 2013-09-05 +-------------------- - * Complete rewrite of the library, lots of BC breaks, check the doc. +- Add convenient Stream::getDimensions method to extract video dimension. +- Add DisplayRatioFixer Frame filter. -* 0.2.4 (05-10-2013) +[0.3.2] - 2013-08-08 +-------------------- - * Add Video\ResizableInterface::getModulus method for better output scaling (@retrojunk) - * Fix timeout setting on audio/video encoding (@xammep-ua) +- Fix A/V synchronization over flash and HTML5 players. -* 0.2.3 (04-21-2013) +[0.3.1] - 2013-08-06 +-------------------- - * Add timeout getter and setter on FFMpeg and FFProbe - * Add timeout setting via second argument on FFMpeg::load and FFProbe::load +- Allow use of FFProbe on remote URIs. +- Fix #47 : MediaTypeInterface::save adds filters depending on the codec. +- Save frame to target file without prompt. -* 0.2.2 (02-11-2013) +[0.3.0] - 2013-07-04 +-------------------- - * Add compatibility with FFMpeg 1.1 - * Upgrade deprecated options (`-ab`, `-qscale` and `-b`) - * Use of a custom stat file for each multi-pass encoding (fix #20) - * Use larger version range for dependencies +- Complete rewrite of the library, lots of BC breaks, check the doc. -* 0.2.1 (02-04-2013) +[0.2.4] - 2013-05-10 +-------------------- - * Parse the output of FFProbe using correct EOL sequences (@ak76) - * Add process timeout customization (@pulse00) - * Fix `accurate` option (`FFMpeg::extractImage`) +- Add Video\ResizableInterface::getModulus method for better output scaling (@retrojunk) +- Fix timeout setting on audio/video encoding (@xammep-ua) -* 0.2.0 (12-13-2012) +[0.2.3] - 2013-04-21 +-------------------- - * Add HelperInterface and support for realtime progress ( @pulse00 ). - * Add `accurate` option to `FFMpeg::extractImage` method. +- Add timeout getter and setter on FFMpeg and FFProbe +- Add timeout setting via second argument on FFMpeg::load and FFProbe::load -* 0.1.0 (10-30-2012) +[0.2.2] - 2013-02-11 +-------------------- - * First stable version. +- Add compatibility with FFMpeg 1.1 +- Upgrade deprecated options (`-ab`, `-qscale` and `-b`) +- Use of a custom stat file for each multi-pass encoding (fix #20) +- Use larger version range for dependencies + +[0.2.1] - 2013-02-04 +-------------------- + +- Parse the output of FFProbe using correct EOL sequences (@ak76) +- Add process timeout customization (@pulse00) +- Fix `accurate` option (`FFMpeg::extractImage`) + +[0.2.0] - 2012-12-13 +-------------------- + +- Add HelperInterface and support for realtime progress ( @pulse00 ). +- Add `accurate` option to `FFMpeg::extractImage` method. + +0.1.0 - 2012-10-30 +-------------------- + +- First stable version. + +[Unreleased]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.6.1...HEAD +[0.6.1]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.6.0...0.6.1 +[0.6.0]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.5.1...0.6.0 +[0.5.1]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.5.0...0.5.1 +[0.5.0]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.4.4...0.5.0 +[0.4.4]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.4.3...0.4.4 +[0.4.3]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.4.2...0.4.3 +[0.4.2]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.4.1...0.4.2 +[0.4.1]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.4.0...0.4.1 +[0.4.0]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.3.5...0.4.0 +[0.3.5]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.3.4...0.3.5 +[0.3.4]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.3.3...0.3.4 +[0.3.3]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.3.2...0.3.3 +[0.3.2]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.3.1...0.3.2 +[0.3.1]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.3.0...0.3.1 +[0.3.0]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.2.4...0.3.0 +[0.2.4]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.2.3...0.2.4 +[0.2.3]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.2.2...0.2.3 +[0.2.2]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.2.1...0.2.2 +[0.2.1]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.2.0...0.2.1 +[0.2.0]: https://github.com/PHP-FFMpeg/PHP-FFMpeg/compare/0.1.0...0.2.0 From 06d8031b9d00210184ce7c1057d5251f8c8c2724 Mon Sep 17 00:00:00 2001 From: Patrik Karisch Date: Wed, 23 Mar 2016 07:57:05 +0100 Subject: [PATCH 013/117] Update github templates --- .github/ISSUE_TEMPLATE.md | 20 +++++++++++--------- .github/PULL_REQUEST_TEMPLATE.md | 10 +++++----- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 9899b3a..ef7b4f8 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,17 +1,19 @@ -| Q | A -| ------------ | --- -| Bug? | no -| Version Used | Specific tag or commit sha -| New Feature? | no +| Q | A +| -------------- | --- +| Bug? | no +| New Feature? | no +| Version Used | Specific tag or commit sha +| FFmpeg Version | FFmpeg or AVConv and version +| OS | Your OS and version + +#### Actual Behavior + +How does PHP-FFMpeg behave at the moment? #### Expected Behavior What is the behavior you expect? -#### Actual Behavior - -How does Sulu behave at the moment? - #### Steps to Reproduce What are the steps to reproduce this bug? Please add code examples, diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 2a25088..49205d2 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,9 +1,9 @@ | Q | A | ------------------ | --- -| Bug fix? | yes -| New feature? | yes -| BC breaks? | yes -| Deprecations? | yes +| Bug fix? | no +| New feature? | no +| BC breaks? | no +| Deprecations? | no | Fixed tickets | fixes #issuenum | Related issues/PRs | #issuenum | License | MIT @@ -18,7 +18,7 @@ Which problem does the PR fix? #### Example Usage -~~~php +```php $foo = new Foo(); // Now we can do From e9f87eee94288b7aadd909b217925fb101cb3e7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lavoie?= Date: Mon, 2 May 2016 13:24:08 -0400 Subject: [PATCH 014/117] Added documentation for the watermark filter (#221) Added documentation for the watermark filter --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index 967ee3a..a8a0f12 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,35 @@ The resize filter takes three parameters : - `$mode`, one of the constants `FFMpeg\Filters\Video\ResizeFilter::RESIZEMODE_*` constants - `$useStandards`, a boolean to force the use of the nearest aspect ratio standard. +###### Watermark + +Watermark a video with a given image. + +```php +$video + ->filters() + ->watermark($watermarkPath, array( + 'position' => 'relative', + 'bottom' => 50, + 'right' => 50, + )); +``` + +The watermark filter takes two parameters: + +`$watermarkPath`, the path to your watermark file. +`$coordinates`, an array defining how you want your watermark positioned. You can use relative positioning as demonstrated above or absolute as such: + +```php +$video + ->filters() + ->watermark($watermarkPath, array( + 'position' => 'absolute', + 'x' => 1180, + 'y' => 620, + )); +``` + ###### Framerate Changes the frame rate of the video. From 010b3b8a6d936476cea13ede8a4e85fbe6048be1 Mon Sep 17 00:00:00 2001 From: Romain Biard Date: Thu, 10 Nov 2016 12:19:17 -0300 Subject: [PATCH 015/117] Creation of a setPasses method for the X264 format. --- .../API/API/FFMpeg/Format/Video/X264.html | 43 +++++++++++++++++-- src/FFMpeg/Format/Video/X264.php | 16 ++++++- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/docs/source/API/API/FFMpeg/Format/Video/X264.html b/docs/source/API/API/FFMpeg/Format/Video/X264.html index 399b173..bcf7d52 100644 --- a/docs/source/API/API/FFMpeg/Format/Video/X264.html +++ b/docs/source/API/API/FFMpeg/Format/Video/X264.html @@ -119,7 +119,17 @@ - string + integer + + + setPasses(integer $passes) +

Sets the number of passes.

+ + + + + + integer getPasses() @@ -499,12 +509,37 @@ + + + +

+
in X264 at line 68
+ public integer + setPasses(integer $passes) +

+
+

Sets the number of passes.

+

+

+
+ +

Parameters

+ + + + + + +
integer$passes
+ + +

-
at line 68
- public string +
in X264 at line 79
+ public integer getPasses()

@@ -517,7 +552,7 @@ - + diff --git a/src/FFMpeg/Format/Video/X264.php b/src/FFMpeg/Format/Video/X264.php index 5f8e8d9..c945167 100644 --- a/src/FFMpeg/Format/Video/X264.php +++ b/src/FFMpeg/Format/Video/X264.php @@ -19,6 +19,9 @@ class X264 extends DefaultVideo /** @var boolean */ private $bframesSupport = true; + /** @var integer */ + private $passes = 2; + public function __construct($audioCodec = 'libfaac', $videoCodec = 'libx264') { $this @@ -62,12 +65,23 @@ class X264 extends DefaultVideo return array('libx264'); } + /** + * @param $passes + * + * @return X264 + */ + public function setPasses($passes) + { + $this->passes = $passes; + return $this; + } + /** * {@inheritDoc} */ public function getPasses() { - return 2; + return $this->passes; } /** From b7a8be46aa72a0193ef41ff8a912614891906021 Mon Sep 17 00:00:00 2001 From: Romain Biard Date: Tue, 15 Nov 2016 16:54:46 -0300 Subject: [PATCH 016/117] First implemtation of the waveform feature --- .../Waveform/WaveformFilterInterface.php | 20 ++++ .../Filters/Waveform/WaveformFilters.php | 39 +++++++ .../Waveform/WaveformRatioFixerFilter.php | 69 ++++++++++++ src/FFMpeg/Media/Waveform.php | 101 ++++++++++++++++++ tests/Unit/Media/WaveformTest.php | 71 ++++++++++++ 5 files changed, 300 insertions(+) create mode 100644 src/FFMpeg/Filters/Waveform/WaveformFilterInterface.php create mode 100644 src/FFMpeg/Filters/Waveform/WaveformFilters.php create mode 100644 src/FFMpeg/Filters/Waveform/WaveformRatioFixerFilter.php create mode 100644 src/FFMpeg/Media/Waveform.php create mode 100644 tests/Unit/Media/WaveformTest.php diff --git a/src/FFMpeg/Filters/Waveform/WaveformFilterInterface.php b/src/FFMpeg/Filters/Waveform/WaveformFilterInterface.php new file mode 100644 index 0000000..7cabdd3 --- /dev/null +++ b/src/FFMpeg/Filters/Waveform/WaveformFilterInterface.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FFMpeg\Filters\Waveform; + +use FFMpeg\Filters\FilterInterface; +use FFMpeg\Media\Waveform; + +interface WaveformFilterInterface extends FilterInterface +{ + public function apply(Waveform $waveform); +} diff --git a/src/FFMpeg/Filters/Waveform/WaveformFilters.php b/src/FFMpeg/Filters/Waveform/WaveformFilters.php new file mode 100644 index 0000000..6ef4043 --- /dev/null +++ b/src/FFMpeg/Filters/Waveform/WaveformFilters.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FFMpeg\Filters\Waveform; + +use FFMpeg\Media\Waveform; + +class WaveformFilters +{ + private $waveform; + + public function __construct(Waveform $waveform) + { + $this->waveform = $waveform; + } + + /** + * Fixes the display ratio of the output frame. + * + * In case the sample ratio and display ratio are different, image may be + * anamorphozed. This filter fixes this by specifying the output size. + * + * @return FrameFilters + */ + public function fixDisplayRatio() + { + $this->frame->addFilter(new DisplayRatioFixerFilter()); + + return $this; + } +} diff --git a/src/FFMpeg/Filters/Waveform/WaveformRatioFixerFilter.php b/src/FFMpeg/Filters/Waveform/WaveformRatioFixerFilter.php new file mode 100644 index 0000000..61d558b --- /dev/null +++ b/src/FFMpeg/Filters/Waveform/WaveformRatioFixerFilter.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FFMpeg\Filters\Waveform; + +use FFMpeg\Exception\RuntimeException; +use FFMpeg\Media\Waveform; + +class WaveformRatioFixerFilter implements WaveformFilterInterface +{ + /** @var boolean */ + private $downmix; + + // By default, the downmix value is set to FALSE. + public function __construct($downmix = FALSE) + { + $this->downmix = $downmix; + } + + /** + * {@inheritdoc} + */ + public function getDownmix() + { + return $this->downmix; + } + + /** + * {@inheritdoc} + */ + public function apply(Waveform $waveform) + { + $dimensions = null; + $commands = array(); + + foreach ($waveform->getVideo()->getStreams() as $stream) { + if ($stream->isVideo()) { + try { + + // Get the dimensions of the video + $dimensions = $stream->getDimensions(); + + // If the downmix parameter is set to TRUE, we add an option to the FFMPEG command + if(!$this->downmix) { + $commands[] = '"showwavespic=s=' . $dimensions->getWidth() . 'x' . $dimensions->getHeight().'"'; + } + else { + $commands[] = '"aformat=channel_layouts=mono,showwavespic=s=' . $dimensions->getWidth() . 'x' . $dimensions->getHeight().'"'; + } + + break; + + } catch (RuntimeException $e) { + + } + } + } + + return $commands; + } +} diff --git a/src/FFMpeg/Media/Waveform.php b/src/FFMpeg/Media/Waveform.php new file mode 100644 index 0000000..8adf2be --- /dev/null +++ b/src/FFMpeg/Media/Waveform.php @@ -0,0 +1,101 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FFMpeg\Media; + +use Alchemy\BinaryDriver\Exception\ExecutionFailureException; +use FFMpeg\Filters\Waveform\WaveformFilterInterface; +use FFMpeg\Filters\Waveform\WaveformFilters; +use FFMpeg\Driver\FFMpegDriver; +use FFMpeg\FFProbe; +use FFMpeg\Exception\RuntimeException; +use FFMpeg\Coordinate\TimeCode; + +class Waveform extends AbstractMediaType +{ + /** @var Video */ + private $video; + + public function __construct(Video $video, FFMpegDriver $driver, FFProbe $ffprobe) + { + parent::__construct($video->getPathfile(), $driver, $ffprobe); + $this->video = $video; + } + + /** + * Returns the video related to the waveform. + * + * @return Video + */ + public function getVideo() + { + return $this->video; + } + + /** + * {@inheritdoc} + * + * @return WaveformFilters + */ + public function filters() + { + return new WaveformFilters($this); + } + + /** + * {@inheritdoc} + * + * @return Waveform + */ + public function addFilter(WaveformFilterInterface $filter) + { + $this->filters->add($filter); + + return $this; + } + + /** + * Saves the waveform in the given filename. + * + * @param string $pathfile + * + * @return Waveform + * + * @throws RuntimeException + */ + public function save($pathfile) + { + /** + * might be optimized with http://ffmpeg.org/trac/ffmpeg/wiki/Seeking%20with%20FFmpeg + * @see http://ffmpeg.org/ffmpeg.html#Main-options + */ + $commands = array( + '-i', 'input', '-filter_complex', + '-frames:v', '1', + $this->pathfile + ); + + foreach ($this->filters as $filter) { + $commands = array_merge($commands, $filter->apply($this)); + } + + $commands = array_merge($commands, array($pathfile)); + + try { + $this->driver->command($commands); + } catch (ExecutionFailureException $e) { + $this->cleanupTemporaryFile($pathfile); + throw new RuntimeException('Unable to save waveform', $e->getCode(), $e); + } + + return $this; + } +} diff --git a/tests/Unit/Media/WaveformTest.php b/tests/Unit/Media/WaveformTest.php new file mode 100644 index 0000000..d88da55 --- /dev/null +++ b/tests/Unit/Media/WaveformTest.php @@ -0,0 +1,71 @@ +getFFMpegDriverMock(); + $ffprobe = $this->getFFProbeMock(); + + $waveform = new Waveform($this->getVideoMock(__FILE__), $driver, $ffprobe); + $this->assertInstanceOf('FFMpeg\Filters\Waveform\WaveformFilters', $waveform->filters()); + } + + public function testAddFiltersAddsAFilter() + { + $driver = $this->getFFMpegDriverMock(); + $ffprobe = $this->getFFProbeMock(); + + $filters = $this->getMockBuilder('FFMpeg\Filters\FiltersCollection') + ->disableOriginalConstructor() + ->getMock(); + + $filter = $this->getMock('FFMpeg\Filters\Waveform\WaveformFilterInterface'); + + $filters->expects($this->once()) + ->method('add') + ->with($filter); + + $waveform = new Waveform($this->getVideoMock(__FILE__), $driver, $ffprobe); + $waveform->setFiltersCollection($filters); + $waveform->addFilter($filter); + } + + /** + * @dataProvider provideSaveOptions + */ + public function testSave($commands) + { + $driver = $this->getFFMpegDriverMock(); + $ffprobe = $this->getFFProbeMock(); + + $pathfile = '/target/destination'; + + array_push($commands, $pathfile); + + $driver->expects($this->once()) + ->method('command') + ->with($commands); + + $waveform = new Waveform($this->getVideoMock(__FILE__), $driver, $ffprobe); + $this->assertSame($waveform, $waveform->save($pathfile)); + } + + public function provideSaveOptions() + { + return array( + array( + array( + '-i', 'input', '-filter_complex', + '-frames:v', '1', + __FILE__ + ), + ), + ); + } +} From 9f970c5d5a90ee9303a5e86af5dc5dca0458594a Mon Sep 17 00:00:00 2001 From: Romain Biard Date: Wed, 16 Nov 2016 12:29:56 -0300 Subject: [PATCH 017/117] Creation of a waveform method in FFMpeg\Media\Video --- .../Filters/Waveform/WaveformFilterInterface.php | 2 +- src/FFMpeg/Filters/Waveform/WaveformFilters.php | 8 ++++---- .../Filters/Waveform/WaveformRatioFixerFilter.php | 2 +- src/FFMpeg/Media/Video.php | 10 ++++++++++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/FFMpeg/Filters/Waveform/WaveformFilterInterface.php b/src/FFMpeg/Filters/Waveform/WaveformFilterInterface.php index 7cabdd3..51e69bc 100644 --- a/src/FFMpeg/Filters/Waveform/WaveformFilterInterface.php +++ b/src/FFMpeg/Filters/Waveform/WaveformFilterInterface.php @@ -3,7 +3,7 @@ /* * This file is part of PHP-FFmpeg. * - * (c) Alchemy + * (c) Strime * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/FFMpeg/Filters/Waveform/WaveformFilters.php b/src/FFMpeg/Filters/Waveform/WaveformFilters.php index 6ef4043..703220f 100644 --- a/src/FFMpeg/Filters/Waveform/WaveformFilters.php +++ b/src/FFMpeg/Filters/Waveform/WaveformFilters.php @@ -3,7 +3,7 @@ /* * This file is part of PHP-FFmpeg. * - * (c) Alchemy + * (c) Strime * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -23,16 +23,16 @@ class WaveformFilters } /** - * Fixes the display ratio of the output frame. + * Fixes the display ratio of the output waveform. * * In case the sample ratio and display ratio are different, image may be * anamorphozed. This filter fixes this by specifying the output size. * - * @return FrameFilters + * @return WaveformFilters */ public function fixDisplayRatio() { - $this->frame->addFilter(new DisplayRatioFixerFilter()); + $this->waveform->addFilter(new DisplayRatioFixerFilter()); return $this; } diff --git a/src/FFMpeg/Filters/Waveform/WaveformRatioFixerFilter.php b/src/FFMpeg/Filters/Waveform/WaveformRatioFixerFilter.php index 61d558b..ec40205 100644 --- a/src/FFMpeg/Filters/Waveform/WaveformRatioFixerFilter.php +++ b/src/FFMpeg/Filters/Waveform/WaveformRatioFixerFilter.php @@ -3,7 +3,7 @@ /* * This file is part of PHP-FFmpeg. * - * (c) Alchemy + * (c) Strime * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/FFMpeg/Media/Video.php b/src/FFMpeg/Media/Video.php index 9200f49..3338b51 100644 --- a/src/FFMpeg/Media/Video.php +++ b/src/FFMpeg/Media/Video.php @@ -181,4 +181,14 @@ class Video extends Audio { return new Frame($this, $this->driver, $this->ffprobe, $at); } + + /** + * Gets the waveform of the video. + * + * @return Waveform + */ + public function waveform() + { + return new Waveform($this, $this->driver, $this->ffprobe); + } } From 18845d406e1d4839886b2e010ff51a1c7bc97480 Mon Sep 17 00:00:00 2001 From: Romain Biard Date: Wed, 16 Nov 2016 12:43:40 -0300 Subject: [PATCH 018/117] We add a missing parameter to the ffmpeg command --- src/FFMpeg/Media/Video.php | 6 ++++-- src/FFMpeg/Media/Waveform.php | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/FFMpeg/Media/Video.php b/src/FFMpeg/Media/Video.php index 3338b51..d6852a2 100644 --- a/src/FFMpeg/Media/Video.php +++ b/src/FFMpeg/Media/Video.php @@ -185,10 +185,12 @@ class Video extends Audio /** * Gets the waveform of the video. * + * @param integer $width + * @param integer $height * @return Waveform */ - public function waveform() + public function waveform($width = 640, $height = 120) { - return new Waveform($this, $this->driver, $this->ffprobe); + return new Waveform($this, $this->driver, $this->ffprobe, $width, $height); } } diff --git a/src/FFMpeg/Media/Waveform.php b/src/FFMpeg/Media/Waveform.php index 8adf2be..062d006 100644 --- a/src/FFMpeg/Media/Waveform.php +++ b/src/FFMpeg/Media/Waveform.php @@ -23,11 +23,15 @@ class Waveform extends AbstractMediaType { /** @var Video */ private $video; + private $width; + private $height; - public function __construct(Video $video, FFMpegDriver $driver, FFProbe $ffprobe) + public function __construct(Video $video, FFMpegDriver $driver, FFProbe $ffprobe, $width, $height) { parent::__construct($video->getPathfile(), $driver, $ffprobe); $this->video = $video; + $this->width = $width; + $this->height = $height; } /** @@ -79,6 +83,7 @@ class Waveform extends AbstractMediaType */ $commands = array( '-i', 'input', '-filter_complex', + 'showwavespic=s='.$this->width.'x'.$this->height, '-frames:v', '1', $this->pathfile ); From 4c0b6f35959acd6c04352179bda8b520605bbb48 Mon Sep 17 00:00:00 2001 From: Romain Biard Date: Wed, 16 Nov 2016 12:49:33 -0300 Subject: [PATCH 019/117] Fixed a bug in the way the input file is passed to the waveform request --- src/FFMpeg/Media/Waveform.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/FFMpeg/Media/Waveform.php b/src/FFMpeg/Media/Waveform.php index 062d006..feb26b3 100644 --- a/src/FFMpeg/Media/Waveform.php +++ b/src/FFMpeg/Media/Waveform.php @@ -82,10 +82,9 @@ class Waveform extends AbstractMediaType * @see http://ffmpeg.org/ffmpeg.html#Main-options */ $commands = array( - '-i', 'input', '-filter_complex', + '-i', $this->pathfile, '-filter_complex', 'showwavespic=s='.$this->width.'x'.$this->height, - '-frames:v', '1', - $this->pathfile + '-frames:v', '1' ); foreach ($this->filters as $filter) { From 7ce571119a192f797d1a0c4071f4391455160258 Mon Sep 17 00:00:00 2001 From: Romain Biard Date: Wed, 16 Nov 2016 12:55:48 -0300 Subject: [PATCH 020/117] The waveform filter can only be applied to audio files --- src/FFMpeg/Media/Audio.php | 12 ++++++++++++ src/FFMpeg/Media/Video.php | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/FFMpeg/Media/Audio.php b/src/FFMpeg/Media/Audio.php index 25c8961..19f3478 100644 --- a/src/FFMpeg/Media/Audio.php +++ b/src/FFMpeg/Media/Audio.php @@ -102,4 +102,16 @@ class Audio extends AbstractStreamableMedia return $this; } + + /** + * Gets the waveform of the video. + * + * @param integer $width + * @param integer $height + * @return Waveform + */ + public function waveform($width = 640, $height = 120) + { + return new Waveform($this, $this->driver, $this->ffprobe, $width, $height); + } } diff --git a/src/FFMpeg/Media/Video.php b/src/FFMpeg/Media/Video.php index d6852a2..9200f49 100644 --- a/src/FFMpeg/Media/Video.php +++ b/src/FFMpeg/Media/Video.php @@ -181,16 +181,4 @@ class Video extends Audio { return new Frame($this, $this->driver, $this->ffprobe, $at); } - - /** - * Gets the waveform of the video. - * - * @param integer $width - * @param integer $height - * @return Waveform - */ - public function waveform($width = 640, $height = 120) - { - return new Waveform($this, $this->driver, $this->ffprobe, $width, $height); - } } From dab2ae5a8c0719f79d9b0ecd2d71b95f785cfc5c Mon Sep 17 00:00:00 2001 From: Romain Biard Date: Wed, 16 Nov 2016 13:15:27 -0300 Subject: [PATCH 021/117] Improvements in the way we deal with filters for the waveform --- .../Filters/Waveform/WaveformRatioFixerFilter.php | 14 ++++---------- src/FFMpeg/Media/Waveform.php | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/FFMpeg/Filters/Waveform/WaveformRatioFixerFilter.php b/src/FFMpeg/Filters/Waveform/WaveformRatioFixerFilter.php index ec40205..368b6bd 100644 --- a/src/FFMpeg/Filters/Waveform/WaveformRatioFixerFilter.php +++ b/src/FFMpeg/Filters/Waveform/WaveformRatioFixerFilter.php @@ -41,19 +41,13 @@ class WaveformRatioFixerFilter implements WaveformFilterInterface $dimensions = null; $commands = array(); - foreach ($waveform->getVideo()->getStreams() as $stream) { - if ($stream->isVideo()) { + foreach ($waveform->getAudio()->getStreams() as $stream) { + if ($stream->isAudio()) { try { - // Get the dimensions of the video - $dimensions = $stream->getDimensions(); - // If the downmix parameter is set to TRUE, we add an option to the FFMPEG command - if(!$this->downmix) { - $commands[] = '"showwavespic=s=' . $dimensions->getWidth() . 'x' . $dimensions->getHeight().'"'; - } - else { - $commands[] = '"aformat=channel_layouts=mono,showwavespic=s=' . $dimensions->getWidth() . 'x' . $dimensions->getHeight().'"'; + if($this->downmix == TRUE) { + $commands[] = '"aformat=channel_layouts=mono"'; } break; diff --git a/src/FFMpeg/Media/Waveform.php b/src/FFMpeg/Media/Waveform.php index feb26b3..e34f564 100644 --- a/src/FFMpeg/Media/Waveform.php +++ b/src/FFMpeg/Media/Waveform.php @@ -26,7 +26,7 @@ class Waveform extends AbstractMediaType private $width; private $height; - public function __construct(Video $video, FFMpegDriver $driver, FFProbe $ffprobe, $width, $height) + public function __construct(Audio $audio, FFMpegDriver $driver, FFProbe $ffprobe, $width, $height) { parent::__construct($video->getPathfile(), $driver, $ffprobe); $this->video = $video; From a32fa06ac46db16413ab23ce9a4dcab9f315da6c Mon Sep 17 00:00:00 2001 From: Romain Biard Date: Wed, 16 Nov 2016 13:19:05 -0300 Subject: [PATCH 022/117] Fixed an error in a variable and method of the waveform Class --- src/FFMpeg/Media/Waveform.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/FFMpeg/Media/Waveform.php b/src/FFMpeg/Media/Waveform.php index e34f564..b1ca160 100644 --- a/src/FFMpeg/Media/Waveform.php +++ b/src/FFMpeg/Media/Waveform.php @@ -22,26 +22,26 @@ use FFMpeg\Coordinate\TimeCode; class Waveform extends AbstractMediaType { /** @var Video */ - private $video; + private $audio; private $width; private $height; public function __construct(Audio $audio, FFMpegDriver $driver, FFProbe $ffprobe, $width, $height) { parent::__construct($video->getPathfile(), $driver, $ffprobe); - $this->video = $video; + $this->audio = $audio; $this->width = $width; $this->height = $height; } /** - * Returns the video related to the waveform. + * Returns the audio related to the waveform. * - * @return Video + * @return Audio */ - public function getVideo() + public function getAudio() { - return $this->video; + return $this->audio; } /** From a331632725a2af91fb74de6b2e8cc890f50300d2 Mon Sep 17 00:00:00 2001 From: Romain Biard Date: Wed, 16 Nov 2016 13:20:48 -0300 Subject: [PATCH 023/117] Fixed an error in a variable and method of the waveform Class --- src/FFMpeg/Media/Waveform.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FFMpeg/Media/Waveform.php b/src/FFMpeg/Media/Waveform.php index b1ca160..1794890 100644 --- a/src/FFMpeg/Media/Waveform.php +++ b/src/FFMpeg/Media/Waveform.php @@ -28,7 +28,7 @@ class Waveform extends AbstractMediaType public function __construct(Audio $audio, FFMpegDriver $driver, FFProbe $ffprobe, $width, $height) { - parent::__construct($video->getPathfile(), $driver, $ffprobe); + parent::__construct($audio->getPathfile(), $driver, $ffprobe); $this->audio = $audio; $this->width = $width; $this->height = $height; From e1625f1f949fa00fa515fc2df81b5a2bea50637f Mon Sep 17 00:00:00 2001 From: Romain Biard Date: Wed, 16 Nov 2016 14:11:11 -0300 Subject: [PATCH 024/117] Modification of the filters --- README.md | 38 +- docs/source/API/API/FFMpeg/Media/Audio.html | 63 ++ .../source/API/API/FFMpeg/Media/Waveform.html | 621 ++++++++++++++++++ sami.phar | Bin 0 -> 2213889 bytes ...erFilter.php => WaveformDownmixFilter.php} | 16 +- .../Filters/Waveform/WaveformFilters.php | 9 +- .../Waveform/WaveformDownmixFilterTest.php | 28 + .../Filters/Waveform/WaveformFiltersTest.php | 21 + tests/Unit/Media/WaveformTest.php | 12 +- 9 files changed, 794 insertions(+), 14 deletions(-) create mode 100644 docs/source/API/API/FFMpeg/Media/Waveform.html create mode 100644 sami.phar rename src/FFMpeg/Filters/Waveform/{WaveformRatioFixerFilter.php => WaveformDownmixFilter.php} (79%) create mode 100644 tests/Unit/Filters/Waveform/WaveformDownmixFilterTest.php create mode 100644 tests/Unit/Filters/Waveform/WaveformFiltersTest.php diff --git a/README.md b/README.md index a8a0f12..3f7cc1f 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ below for more informations. You can extract a frame at any timecode using the `FFMpeg\Media\Video::frame` method. -This code return a `FFMpeg\Media\Frame` instance corresponding to the second 42. +This code returns a `FFMpeg\Media\Frame` instance corresponding to the second 42. You can pass any `FFMpeg\Coordinate\TimeCode` as argument, see dedicated documentation below for more information. @@ -145,6 +145,42 @@ $frame = $video->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(42)); $frame->save('image.jpg'); ``` +##### Generate a waveform + +You can generate a waveform of an audio file using the `FFMpeg\Media\Audio::waveform` +method. + +This code returns a `FFMpeg\Media\Waveform` instance. +You can optionally pass dimensions as arguments, see dedicated +documentation below for more information. + +The ouput file MUST use the PNG extension. + +```php +$waveform = $audio->waveform(640, 120); +$waveform->save('waveform.png'); +``` + +If you want to get a waveform from a video, convert it in an audio file first. + +```php +// Open your video file +$video = $ffmpeg->open( 'video.mp4' ); + +// Set an audio format +$audio_format = new FFMpeg\Format\Audio\Mp3(); + +// Extract the audio into a new file +$video->save('audio.mp3'); + +// Set the audio file +$audio = $ffmpeg->open( 'audio.mp3' ); + +// Create the waveform +$waveform = $audio->waveform(); +$waveform->save( 'waveform.png' ); +``` + ##### Filters You can apply filters on `FFMpeg\Media\Video` with the `FFMpeg\Media\Video::addFilter` diff --git a/docs/source/API/API/FFMpeg/Media/Audio.html b/docs/source/API/API/FFMpeg/Media/Audio.html index 3a8be2c..afdb3fe 100644 --- a/docs/source/API/API/FFMpeg/Media/Audio.html +++ b/docs/source/API/API/FFMpeg/Media/Audio.html @@ -171,6 +171,16 @@

Exports the audio in the desired format, applies registered filters.

+ + + + +
stringinteger
+ Audio + + waveform(integer $width, integer $height) +

Generates an image file representing the waveform of the audio file.

+
@@ -609,6 +619,59 @@
+

+
at line 113
+ public Audio + save(FormatInterface $format, string $outputPathfile) +

+
+

Exports the audio in the desired format, applies registered filters.

+

+

+
+

Parameters

+ + + + + + + + + + + + +
FormatInterface$format +
string$outputPathfile +
+ + +

Return Value

+ + + + + + +
Audio +
+ + +

Exceptions

+ + + + + + +
RuntimeException +
+ + +
+
+