Add support for aac codec of ffmpeg3
This commit is contained in:
parent
e9f87eee94
commit
8f3b65dec6
4 changed files with 35 additions and 4 deletions
|
|
@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Add pull request and issue templates.
|
- Add pull request and issue templates.
|
||||||
|
- Usage of new codec "aac" of ffmpeg 3
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ class X264 extends DefaultVideo
|
||||||
*/
|
*/
|
||||||
public function getAvailableAudioCodecs()
|
public function getAvailableAudioCodecs()
|
||||||
{
|
{
|
||||||
return array('libvo_aacenc', 'libfaac', 'libmp3lame', 'libfdk_aac');
|
return array('aac', 'libvo_aacenc', 'libfaac', 'libmp3lame', 'libfdk_aac');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,37 @@ class VideoTranscodeTest extends FunctionalTestCase
|
||||||
$lastPercentage = null;
|
$lastPercentage = null;
|
||||||
$phpunit = $this;
|
$phpunit = $this;
|
||||||
|
|
||||||
$codec = new X264('libvo_aacenc');
|
$codec = new X264('aac');
|
||||||
|
$codec->on('progress', function ($video, $codec, $percentage) use ($phpunit, &$lastPercentage) {
|
||||||
|
if (null !== $lastPercentage) {
|
||||||
|
$phpunit->assertGreaterThanOrEqual($lastPercentage, $percentage);
|
||||||
|
}
|
||||||
|
$lastPercentage = $percentage;
|
||||||
|
$phpunit->assertGreaterThanOrEqual(0, $percentage);
|
||||||
|
$phpunit->assertLessThanOrEqual(100, $percentage);
|
||||||
|
});
|
||||||
|
|
||||||
|
$video->save($codec, $filename);
|
||||||
|
$this->assertFileExists($filename);
|
||||||
|
unlink($filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAacTranscodeX264()
|
||||||
|
{
|
||||||
|
$filename = __DIR__ . '/output/output-x264_2.mp4';
|
||||||
|
if (is_file($filename)) {
|
||||||
|
unlink(__DIR__ . '/output/output-x264_2.mp4');
|
||||||
|
}
|
||||||
|
|
||||||
|
$ffmpeg = $this->getFFMpeg();
|
||||||
|
$video = $ffmpeg->open(__DIR__ . '/../files/sample.3gp');
|
||||||
|
|
||||||
|
$this->assertInstanceOf('FFMpeg\Media\Video', $video);
|
||||||
|
|
||||||
|
$lastPercentage = null;
|
||||||
|
$phpunit = $this;
|
||||||
|
|
||||||
|
$codec = new X264('aac');
|
||||||
$codec->on('progress', function ($video, $codec, $percentage) use ($phpunit, &$lastPercentage) {
|
$codec->on('progress', function ($video, $codec, $percentage) use ($phpunit, &$lastPercentage) {
|
||||||
if (null !== $lastPercentage) {
|
if (null !== $lastPercentage) {
|
||||||
$phpunit->assertGreaterThanOrEqual($lastPercentage, $percentage);
|
$phpunit->assertGreaterThanOrEqual($lastPercentage, $percentage);
|
||||||
|
|
@ -55,7 +85,7 @@ class VideoTranscodeTest extends FunctionalTestCase
|
||||||
$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');
|
$this->setExpectedException('FFMpeg\Exception\RuntimeException');
|
||||||
$video->save(new X264('libvo_aacenc'), __DIR__ . '/output/output-x264.mp4');
|
$video->save(new X264('aac'), __DIR__ . '/output/output-x264.mp4');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testTranscodePortraitVideo()
|
public function testTranscodePortraitVideo()
|
||||||
|
|
@ -77,7 +107,7 @@ class VideoTranscodeTest extends FunctionalTestCase
|
||||||
$video->filters()
|
$video->filters()
|
||||||
->resize(new Dimension(320, 240), ResizeFilter::RESIZEMODE_INSET)
|
->resize(new Dimension(320, 240), ResizeFilter::RESIZEMODE_INSET)
|
||||||
->rotate(RotateFilter::ROTATE_90);
|
->rotate(RotateFilter::ROTATE_90);
|
||||||
$video->save(new X264('libvo_aacenc'), $filename);
|
$video->save(new X264('aac'), $filename);
|
||||||
|
|
||||||
$dimension = $ffmpeg->getFFProbe()
|
$dimension = $ffmpeg->getFFProbe()
|
||||||
->streams($filename)
|
->streams($filename)
|
||||||
|
|
|
||||||
BIN
tests/files/sample.3gp
Normal file
BIN
tests/files/sample.3gp
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue