Skip to content

Files

Failed to load latest commit information.

Latest commit

 Cannot retrieve latest commit at this time.

History

History

transcoder

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Google Transcoder PHP Sample Application

Open in Cloud Shell

Description

This simple command-line application demonstrates how to invoke Google Transcoder API from PHP.

Build and Run

  1. Enable APIs - Enable the Transcoder API and create a new project or select an existing project.
  2. Download The Credentials - Click "Go to credentials" after enabling the APIs. Click "New Credentials" and select "Service Account Key". Create a new service account, use the JSON key type, and select "Create". Once downloaded, set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of the JSON key that was downloaded.
  3. Clone the repo and cd into this directory
    $ git clone https://github.com/GoogleCloudPlatform/php-docs-samples
    $ cd media/transcoder
  1. Install dependencies via Composer. Run php composer.phar install (if composer is installed locally) or composer install (if composer is installed globally).
  2. Execute the snippets in the src/ directory by running php src/SNIPPET_NAME.php. The usage will print for each if no arguments are provided:
    $ php php src/create_job_from_ad_hoc.php
    Usage: create_job_from_ad_hoc.php $projectId $location $inputUri $outputUri
    
      @param string $projectId The ID of your Google Cloud Platform project.
      @param string $location The location of the job.
      @param string $inputUri Uri of the video in the Cloud Storage bucket.
      @param string $outputUri Uri of the video output folder in the Cloud Storage bucket.
    
    
    $ php create_job_from_ad_hoc.php my-project us-central1 gs://my-bucket/input.mp4 gs://my-bucket/adhoc/
    Job: projects/657323817858/locations/us-central1/jobs/13beaa6b-5a33-4a86-b280-04b524546291

See the Transcoder Documentation for more information.

Troubleshooting

bcmath extension missing

If you see an error like this:

PHP Fatal error:  Uncaught Error: Call to undefined function Google\Protobuf\Internal\bcsub()

You need to install the BC-Math extension.

See the Troubleshooting guide for more information.

Contributing changes

Licensing