Add support for video to audio transcoding

This commit is contained in:
Romain Neutron 2013-10-10 15:09:10 +02:00
commit d3e97c974e
11 changed files with 127 additions and 59 deletions

View file

@ -0,0 +1,10 @@
<?php
namespace FFMpeg\Tests\Media;
use FFMpeg\Format\ProgressableInterface;
use FFMpeg\Format\AudioInterface;
abstract class AudioProg implements ProgressableInterface, AudioInterface
{
}

View file

@ -333,7 +333,3 @@ class AudioTest extends AbstractStreamableTestCase
return 'FFMpeg\Media\Audio';
}
}
abstract class AudioProg implements ProgressableInterface, AudioInterface
{
}

View file

@ -0,0 +1,10 @@
<?php
namespace FFMpeg\Tests\Media;
use FFMpeg\Format\ProgressableInterface;
use FFMpeg\Format\VideoInterface;
abstract class Prog implements ProgressableInterface, VideoInterface
{
}

View file

@ -259,6 +259,20 @@ class VideoTest extends AbstractStreamableTestCase
->method('getPasses')
->will($this->returnValue(2));
$audioFormat = $this->getMock('FFMpeg\Format\AudioInterface');
$audioFormat->expects($this->any())
->method('getExtraParams')
->will($this->returnValue(array()));
$audioFormat->expects($this->any())
->method('getAudioCodec')
->will($this->returnValue('patati-patata-audio'));
$audioFormat->expects($this->any())
->method('getAudioKiloBitrate')
->will($this->returnValue(92));
$audioFormat->expects($this->any())
->method('getPasses')
->will($this->returnValue(1));
$audioVideoFormat = $this->getMock('FFMpeg\Format\VideoInterface');
$audioVideoFormat->expects($this->any())
->method('getExtraParams')
@ -333,6 +347,24 @@ class VideoTest extends AbstractStreamableTestCase
->method('getPasses')
->will($this->returnValue(2));
$progressableAudioFormat = $this->getMockBuilder('FFMpeg\Tests\Media\AudioProg')
->disableOriginalConstructor()->getMock();
$progressableAudioFormat->expects($this->any())
->method('getExtraParams')
->will($this->returnValue(array()));
$progressableAudioFormat->expects($this->any())
->method('getAudioCodec')
->will($this->returnValue('patati-patata-audio'));
$progressableAudioFormat->expects($this->any())
->method('createProgressListener')
->will($this->returnValue($listeners));
$progressableAudioFormat->expects($this->any())
->method('getAudioKiloBitrate')
->will($this->returnValue(92));
$progressableAudioFormat->expects($this->any())
->method('getPasses')
->will($this->returnValue(1));
return array(
array(false, array(array(
'-y', '-i', __FILE__, '-b:v', '663k',
@ -451,6 +483,18 @@ class VideoTest extends AbstractStreamableTestCase
'-qdiff', '4', '-trellis', '1', '-b:a', '92k', '-pass', '2', '-passlogfile',
'/target/file',
)), $listeners, $progressableFormat),
array(true, array(array(
'-y', '-i', __FILE__,
'-threads', 24, '-acodec', 'patati-patata-audio',
'-b:a', '92k',
'/target/file',
)), null, $audioFormat),
array(true, array(array(
'-y', '-i', __FILE__,
'-threads', 24, '-acodec', 'patati-patata-audio',
'-b:a', '92k',
'/target/file',
)), $listeners, $progressableAudioFormat),
);
}
@ -555,7 +599,3 @@ class VideoTest extends AbstractStreamableTestCase
return 'FFMpeg\Media\Video';
}
}
abstract class Prog implements ProgressableInterface, VideoInterface
{
}