/**
  * @test
  * @dataProvider configProvider
  *
  * @param FtpInputConfig $ftpInputConfig
  *
  * @return Input
  */
 public function create($ftpInputConfig)
 {
     $input = Input::create($ftpInputConfig);
     $this->checkInput($input);
     self::$createdInputs[] = array($input);
     return $input;
 }
示例#2
0
 /**
  * @test
  * @return Job
  */
 public function createJob()
 {
     $inputConfig = new HttpInputConfig();
     $inputConfig->url = self::URL_FILE;
     $input = Input::create($inputConfig);
     /* CREATE VIDEO STREAM CONFIG */
     $videoStreamConfig = new VideoStreamConfig();
     $videoStreamConfig->bitrate = 1024000;
     $videoStreamConfig->height = 202;
     $videoStreamConfig->width = 480;
     /* CREATE AUDIO STREAM CONFIGS */
     $audioStreamConfig = new AudioStreamConfig();
     $audioStreamConfig->bitrate = 256000;
     $encodingProfileConfig = new EncodingProfileConfig();
     $encodingProfileConfig->name = $this->getName() . 'EncodingProfile';
     $encodingProfileConfig->videoStreamConfigs[] = $videoStreamConfig;
     $encodingProfileConfig->audioStreamConfigs[] = $audioStreamConfig;
     /* CREATE ENCODING PROFILE */
     $encodingProfile = EncodingProfile::create($encodingProfileConfig);
     $jobConfig = new JobConfig();
     $jobConfig->encodingProfile = $encodingProfile;
     $jobConfig->input = $input;
     $jobConfig->manifestTypes[] = ManifestTypes::M3U8;
     $jobConfig->manifestTypes[] = ManifestTypes::MPD;
     /* CREATE JOB */
     $job = Job::create($jobConfig);
     $this->assertInstanceOf(Job::class, $job);
     $this->assertNotNull($job->jobId);
     $this->assertNotEquals($job->status, Job::STATUS_ERROR);
     return $job;
 }
示例#3
0
 /**
  * @test
  * @return Input
  */
 public function create()
 {
     $inputConfig = new HttpInputConfig();
     $inputConfig->url = self::URL_FILE;
     $input = Input::create($inputConfig);
     $this->checkInput($input);
     return $input;
 }
示例#4
0
 /**
  * @test
  * @expectedException bitcodin\exceptions\BitcodinException
  */
 public function createWithInvalidSettings()
 {
     $inputConfig = new AzureBlobStorageInputConfig();
     $inputConfig->url = 'www.invalidazureinput.com/invalid/input.mkv';
     $inputConfig->accountName = $this->getKey('azure')->accountName;
     $inputConfig->accountKey = $this->getKey('azure')->accountKey;
     $inputConfig->container = 'php-api-wrapper';
     Input::create($inputConfig);
 }
示例#5
0
 /**
  * @test
  * @return Input
  */
 public function createFtpInput_File4()
 {
     $ftpConfig2 = $this->getKey('ftpSpecialChar2');
     $inputConfig = new FtpInputConfig();
     $inputConfig->url = $ftpConfig2->server . self::USER2_FTP_FILE_1;
     $inputConfig->username = $ftpConfig2->user;
     $inputConfig->password = $ftpConfig2->password;
     $input = Input::create($inputConfig);
     $this->checkInput($input);
     return $input;
 }
示例#6
0
 public function testDeleteAll()
 {
     $count = 10;
     for ($num = 0; $num < $count; $num++) {
         $inputConfig = new HttpInputConfig();
         $inputConfig->url = self::URL_FILE;
         $input = Input::create($inputConfig);
     }
     Input::deleteAll();
     $this->assertEquals(0, sizeof(Input::getListAll()));
 }
 public function testMergeChannelsMultiAudioStreamJob()
 {
     $inputConfig = new HttpInputConfig();
     $inputConfig->url = 'http://bitbucketireland.s3.amazonaws.com/at_test/mono_streams.mkv';
     $input = Input::create($inputConfig);
     /* CREATE VIDEO STREAM CONFIG */
     $videoStreamConfig = new VideoStreamConfig();
     $videoStreamConfig->bitrate = 512000;
     $videoStreamConfig->height = 202;
     $videoStreamConfig->width = 480;
     /* CREATE AUDIO STREAM CONFIGS */
     $audioStreamConfig1 = new AudioStreamConfig();
     $audioStreamConfig1->bitrate = 256000;
     $audioStreamConfig1->defaultStreamId = 0;
     $audioStreamConfig2 = new AudioStreamConfig();
     $audioStreamConfig2->bitrate = 128000;
     $audioStreamConfig2->defaultStreamId = 1;
     $encodingProfileConfig = new EncodingProfileConfig();
     $encodingProfileConfig->name = 'Multi Audio Stream Profile';
     $encodingProfileConfig->videoStreamConfigs[] = $videoStreamConfig;
     $encodingProfileConfig->audioStreamConfigs[] = $audioStreamConfig1;
     $encodingProfileConfig->audioStreamConfigs[] = $audioStreamConfig2;
     /* CREATE ENCODING PROFILE */
     $encodingProfile = EncodingProfile::create($encodingProfileConfig);
     $audioMetaData12 = new AudioMetaData();
     $audioMetaData12->defaultStreamId = 0;
     $audioMetaData12->label = 'Channel 1 and 2';
     $audioMetaData12->language = 'en';
     $audioMetaData34 = new AudioMetaData();
     $audioMetaData34->defaultStreamId = 1;
     $audioMetaData34->label = 'Channel 3 and 4';
     $audioMetaData34->language = 'en';
     $mergeAudioChannelConfig12 = new MergeAudioChannelConfig();
     $mergeAudioChannelConfig12->audioChannels = array(1, 2);
     $mergeAudioChannelConfig34 = new MergeAudioChannelConfig();
     $mergeAudioChannelConfig34->audioChannels = array(3, 4);
     $jobConfig = new JobConfig();
     $jobConfig->encodingProfile = $encodingProfile;
     $jobConfig->input = $input;
     $jobConfig->manifestTypes[] = ManifestTypes::M3U8;
     $jobConfig->manifestTypes[] = ManifestTypes::MPD;
     $jobConfig->speed = JobSpeedTypes::STANDARD;
     $jobConfig->audioMetaData[] = $audioMetaData12;
     $jobConfig->audioMetaData[] = $audioMetaData34;
     $jobConfig->mergeAudioChannelConfigs[] = $mergeAudioChannelConfig12;
     $jobConfig->mergeAudioChannelConfigs[] = $mergeAudioChannelConfig34;
     /* CREATE JOB */
     $job = Job::create($jobConfig);
     $this->assertInstanceOf('bitcodin\\Job', $job);
     $this->assertNotNull($job->jobId);
     $this->assertNotEquals($job->status, Job::STATUS_ERROR);
     return $job;
 }
示例#8
0
 /**
  * @test
  * @return Input
  */
 public function create()
 {
     $s3Config = $this->getKey('s3input');
     $inputConfig = new S3InputConfig();
     $inputConfig->accessKey = $s3Config->accessKey;
     $inputConfig->secretKey = $s3Config->secretKey;
     $inputConfig->region = $s3Config->region;
     $inputConfig->bucket = $s3Config->bucket;
     $inputConfig->objectKey = self::S3_FILE;
     $input = Input::create($inputConfig);
     $this->checkInput($input);
     return $input;
 }
 public function testMultiLanguageJob()
 {
     $inputConfig = new HttpInputConfig();
     $inputConfig->url = self::URL_FILE;
     $inputConfig->skipAnalysis = true;
     $input = Input::create($inputConfig);
     $audioMetaDataJustSound = new AudioMetaData();
     $audioMetaDataJustSound->defaultStreamId = 0;
     $audioMetaDataJustSound->label = 'Just Sound';
     $audioMetaDataJustSound->language = 'de';
     $audioMetaDataSoundAndVoice = new AudioMetaData();
     $audioMetaDataSoundAndVoice->defaultStreamId = 1;
     $audioMetaDataSoundAndVoice->label = 'Sound and Voice';
     $audioMetaDataSoundAndVoice->language = 'en';
     /* CREATE VIDEO STREAM CONFIG */
     $videoStreamConfig = new VideoStreamConfig();
     $videoStreamConfig->bitrate = 2400000;
     $videoStreamConfig->height = 720;
     $videoStreamConfig->width = 1280;
     /* CREATE AUDIO STREAM CONFIGS */
     $audioStreamConfig = new AudioStreamConfig();
     $audioStreamConfig->bitrate = 256000;
     $encodingProfileConfig = new EncodingProfileConfig();
     $encodingProfileConfig->name = 'SkippedAnalysisProfile';
     $encodingProfileConfig->videoStreamConfigs[] = $videoStreamConfig;
     $encodingProfileConfig->audioStreamConfigs[] = $audioStreamConfig;
     /* CREATE ENCODING PROFILE */
     $encodingProfile = EncodingProfile::create($encodingProfileConfig);
     $jobConfig = new JobConfig();
     $jobConfig->encodingProfile = $encodingProfile;
     $jobConfig->input = $input;
     $jobConfig->manifestTypes[] = ManifestTypes::MPD;
     $jobConfig->manifestTypes[] = ManifestTypes::M3U8;
     $jobConfig->speed = JobSpeedTypes::STANDARD;
     $jobConfig->audioMetaData[] = $audioMetaDataJustSound;
     $jobConfig->audioMetaData[] = $audioMetaDataSoundAndVoice;
     /* CREATE JOB */
     $job = Job::create($jobConfig);
     $this->assertInstanceOf('bitcodin\\Job', $job);
     $this->assertNotNull($job->jobId);
     $this->assertNotEquals($job->status, Job::STATUS_ERROR);
     return $job;
 }
use bitcodin\ManifestTypes;
require_once __DIR__ . '/../vendor/autoload.php';
function getHeight($width, $aspectRatio)
{
    $height = intval(round($width / $aspectRatio, 0));
    if ($height % 2 != 0) {
        $height++;
    }
    return $height;
}
/* CONFIGURATION */
Bitcodin::setApiToken('Insert Your Api Key here');
// Your can find your api key in the settings menu. Your account (right corner) -> Settings -> API
$inputConfig = new HttpInputConfig();
$inputConfig->url = 'http://eu-storage.bitcodin.com/inputs/Sintel.2010.720p.mkv';
$input = Input::create($inputConfig);
$inputVideoMediaConfiguration = NULL;
foreach ($input->getVideoMediaConfigurations() as $inputMediaConfiguration) {
    if ($inputMediaConfiguration->type === 'video') {
        $inputVideoMediaConfiguration = $inputMediaConfiguration;
        break;
    }
}
if (is_null($inputVideoMediaConfiguration)) {
    throw new \Exception("No video media configuration found!");
}
$inputWidth = $inputVideoMediaConfiguration->displayAspectRatioNum;
$inputHeight = $inputVideoMediaConfiguration->displayAspectRatioDen;
$aspectRatio = $inputWidth / $inputHeight;
// Predefined widths
$widths = array(426, 640, 854, 1280, 1920);
 public function testMultiLanguageJobWithMissingAudioMetaDataFields()
 {
     $inputConfig = new HttpInputConfig();
     $inputConfig->url = self::URL_FILE;
     $input = Input::create($inputConfig);
     $encodingProfile = $this->getMultiLanguageEncodingProfile();
     $audioMetaDataJustSound = new AudioMetaData();
     $audioMetaDataJustSound->defaultStreamId = 0;
     $audioMetaDataJustSound->label = 'Just Sound';
     $audioMetaDataSoundAndVoice = new AudioMetaData();
     $audioMetaDataSoundAndVoice->defaultStreamId = 1;
     $audioMetaDataSoundAndVoice->language = 'en';
     $jobConfig = new JobConfig();
     $jobConfig->encodingProfile = $encodingProfile;
     $jobConfig->input = $input;
     $jobConfig->manifestTypes[] = ManifestTypes::MPD;
     $jobConfig->speed = JobSpeedTypes::STANDARD;
     $jobConfig->audioMetaData[] = $audioMetaDataJustSound;
     $jobConfig->audioMetaData[] = $audioMetaDataSoundAndVoice;
     $this->setExpectedException('bitcodin\\exceptions\\BitcodinException');
     $job = Job::create($jobConfig);
     return $job;
 }
示例#12
0
 public function testVideoOnlyJob()
 {
     $inputConfig = new HttpInputConfig();
     $inputConfig->url = self::URL_FILE;
     $input = Input::create($inputConfig);
     /* CREATE VIDEO STREAM CONFIG */
     $videoStreamConfig = new VideoStreamConfig();
     $videoStreamConfig->bitrate = 1024000;
     $videoStreamConfig->height = 202;
     $videoStreamConfig->width = 480;
     $encodingProfileConfig = new EncodingProfileConfig();
     $encodingProfileConfig->name = 'TestEncodingProfile_' . $this->getName() . '@JobMultiLanguageTest';
     $encodingProfileConfig->videoStreamConfigs[] = $videoStreamConfig;
     /* CREATE ENCODING PROFILE */
     $encodingProfile = EncodingProfile::create($encodingProfileConfig);
     $jobConfig = new JobConfig();
     $jobConfig->encodingProfile = $encodingProfile;
     $jobConfig->input = $input;
     $jobConfig->manifestTypes[] = ManifestTypes::MPD;
     $jobConfig->manifestTypes[] = ManifestTypes::M3U8;
     $jobConfig->speed = JobSpeedTypes::STANDARD;
     /* CREATE JOB */
     $job = Job::create($jobConfig);
     $this->assertInstanceOf('bitcodin\\Job', $job);
     $this->assertNotNull($job->jobId);
     $this->assertNotEquals($job->status, Job::STATUS_ERROR);
     return $job;
 }