Coder Social home page Coder Social logo

bitmovin / bitmovin-php Goto Github PK

View Code? Open in Web Editor NEW
19.0 21.0 13.0 746 KB

DEPRECATED: PHP client for the Bitmovin API, see https://github.com/bitmovin/bitmovin-api-sdk-php

PHP 100.00%
php bitmovin api-client bitmovin-api video-encoding analytics html5-player

bitmovin-php's Introduction

bitmovin

New API Client (Recommended)

bitmovin-php is the legacy Bitmovin API client for PHP.

We recommend using the new client, which you can find at bitmovin-api-sdk-php. Using the new client guarantees 100% specification conformity at any given time and access to all features of the API as soon as they are released.


bitmovin-php

PHP-Client which enables you to seamlessly integrate the Bitmovin API into your projects. Using this API client requires an active account. Sign up for a Bitmovin API key.

The full Bitmovin API reference can be found on our website.

Installation

Requirements: PHP 5.6.0 or higher is required

Composer

To install the api-client with composer, add the following to your composer.json file:

{
"require": 
  {
    "bitmovin/bitmovin-php": "1.5.*"
  }
}

Then run php composer.phar install

OR

run the following command: php composer.phar require bitmovin/bitmovin-php:1.5.*

Example

The following example creates a simple transcoding job and transfers it to a GCS output location (CreateSimpleEncoding.php):

<?php

use Bitmovin\api\enum\CloudRegion;
use Bitmovin\BitmovinClient;
use Bitmovin\configs\audio\AudioStreamConfig;
use Bitmovin\configs\EncodingProfileConfig;
use Bitmovin\configs\JobConfig;
use Bitmovin\configs\manifest\DashOutputFormat;
use Bitmovin\configs\manifest\HlsOutputFormat;
use Bitmovin\configs\video\H264VideoStreamConfig;
use Bitmovin\input\HttpInput;
use Bitmovin\output\GcsOutput;

require_once __DIR__ . '/vendor/autoload.php';

$client = new BitmovinClient('INSERT YOUR API KEY HERE');

// CONFIGURATION
$videoInputPath = 'http://eu-storage.bitcodin.com/inputs/Sintel.2010.720p.mkv';
$gcs_accessKey = 'INSERT YOUR GCS OUTPUT ACCESS KEY HERE';
$gcs_secretKey = 'INSERT YOUR GCS OUTPUT SECRET KEY HERE';
$gcs_bucketName = 'INSERT YOUR GCS OUTPUT BUCKET NAME HERE';
$gcs_prefix = 'path/to/your/output/destination/';

// CREATE ENCODING PROFILE
$encodingProfile = new EncodingProfileConfig();
$encodingProfile->name = 'Test Encoding';
$encodingProfile->cloudRegion = CloudRegion::GOOGLE_EUROPE_WEST_1;

// CREATE VIDEO STREAM CONFIG FOR 1080p
$videoStreamConfig_1080 = new H264VideoStreamConfig();
$videoStreamConfig_1080->input = new HttpInput($videoInputPath);
$videoStreamConfig_1080->width = 1920;
$videoStreamConfig_1080->height = 1080;
$videoStreamConfig_1080->bitrate = 4800000;
$videoStreamConfig_1080->rate = 25.0;
$encodingProfile->videoStreamConfigs[] = $videoStreamConfig_1080;

// CREATE VIDEO STREAM CONFIG FOR 720p
$videoStreamConfig_720 = new H264VideoStreamConfig();
$videoStreamConfig_720->input = new HttpInput($videoInputPath);
$videoStreamConfig_720->width = 1280;
$videoStreamConfig_720->height = 720;
$videoStreamConfig_720->bitrate = 2400000;
$videoStreamConfig_720->rate = 25.0;
$encodingProfile->videoStreamConfigs[] = $videoStreamConfig_720;

// CREATE AUDIO STREAM CONFIG
$audioConfig = new AudioStreamConfig();
$audioConfig->input = new HttpInput($videoInputPath);
$audioConfig->bitrate = 128000;
$audioConfig->rate = 48000;
$audioConfig->name = 'English';
$audioConfig->lang = 'en';
$audioConfig->position = 1;
$encodingProfile->audioStreamConfigs[] = $audioConfig;

// CREATE JOB CONFIG
$jobConfig = new JobConfig();
// ASSIGN OUTPUT
$jobConfig->output = new GcsOutput($gcs_accessKey, $gcs_secretKey, $gcs_bucketName, $gcs_prefix);
// ASSIGN ENCODING PROFILES TO JOB
$jobConfig->encodingProfile = $encodingProfile;
// ENABLE DASH OUTPUT
$jobConfig->outputFormat[] = new DashOutputFormat();
// ENABLE HLS OUTPUT
$jobConfig->outputFormat[] = new HlsOutputFormat();

// RUN JOB AND WAIT UNTIL IT HAS FINISHED
$client->runJobAndWaitForCompletion($jobConfig);

For more examples go to our example page.

bitmovin-php's People

Contributors

andreasrudich avatar gfronza avatar jschausberger avatar moser4035 avatar msmole avatar since avatar tigraine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bitmovin-php's Issues

S3 Directory Name

Hi there,
Can you tell me how I use Amazon S3 can specify a folder name in the API?

I use: $outputConfig->prefix = "/streams_neu/"

There he should create the video in the folder Video_XY. Unfortunately, he always creates a hash value as a folder name.

I need this to update videos.

Unfortunately, I find no function.

Hope you can help me.
Thank you.

Error

Hi,

I have a problem with the manifest, I removed subtitules and HLS. Error: Error with the manifest, maybe MPD is not valid.
XML:
{
"name": "stream.mpd",
"bucket": "prueba-ott.appspot.com",
"generation": "1530521806949461",
"metageneration": "2",
"contentType": "application/dash+xml",
"timeCreated": "2018-07-02T08:56:46.949Z",
"updated": "2018-07-02T08:59:43.887Z",
"storageClass": "STANDARD",
"size": "1544",
"md5Hash": "kp9kd/hZjTM47HeXOXS8Ww==",
"contentEncoding": "identity",
"crc32c": "XKMFqg==",
"etag": "CNWY/4SGgNwCEAI=",
"downloadTokens": "4a190606-08e8-4fef-94cf-a46302e8085a",
"metadata": {
"md5-hash": "929f6477f8598d3338ec77973974bc5b"
}
}

S3-to-S3 example failing

We're using the PHP S3-to-S3 example. We're encountering an error in the following lines:

                // CREATE API CLIENT
		$apiClient = new ApiClient('<our-API-key>');
		
		// CREATE ENCODING
		$encoding = new Encoding('A Name for your encoding');
		$encoding->setCloudRegion(CloudRegion::AWS_US_EAST_1);
		$encoding = $apiClient->encodings()->create($encoding);

We don't have an actual error message because this is being run within a Laravel project; the error we get is a fatal throwable exception, which tells us nothing.

Trimming is being ignored.

I want to encode a small part of a larger video, but the trim settings are not having any effect.

I ran the code exactly as it appears in the example EncodingWithS3InputAndS3OutputAndOffsetAndDuration.php.
The encoding works (and I can play the resulting manifests), but the offset and duration are completely ignored, and the encoding started at the beginning of the file.

update dependencies

can you please upgrade the dependencies?

  • jms/serializer -> 1.14 -> 3.0
  • icecave/parity -> 1.0 -> 2.0
  • icecave/repr -> 1.0 -> 2.0

i tried to do a PR, but somehow running tests, is a nightmare. (#88)

what is the current way to run, tests?

live statistics missing

Hi,
I can't find the live statistics function in the PHP SDK:

https://api.bitmovin.com/v1/encoding/statistics/encodings/encoding_id/live-statistics

Kind regards,
Erik

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.