|
| 1 | +# Google Video PHP Sample Application |
| 2 | + |
| 3 | +## Description |
| 4 | + |
| 5 | +This simple command-line application demonstrates how to invoke Google |
| 6 | +Video Intelligence API from PHP. |
| 7 | + |
| 8 | +## Build and Run |
| 9 | +1. **Enable APIs** - [Enable the Video Intelligence API]( |
| 10 | + https://console.cloud.google.com/flows/enableapi?apiid=videointelligence.googleapis.com) |
| 11 | + and create a new project or select an existing project. |
| 12 | +2. **Download The Credentials** - Click "Go to credentials" after enabling the APIs. Click |
| 13 | + "New Credentials" |
| 14 | + and select "Service Account Key". Create a new service account, use the JSON key type, and |
| 15 | + select "Create". Once downloaded, set the environment variable `GOOGLE_APPLICATION_CREDENTIALS` |
| 16 | + to the path of the JSON key that was downloaded. |
| 17 | +3. **Clone the repo** and cd into this directory |
| 18 | +``` |
| 19 | + $ git clone https://github.com/GoogleCloudPlatform/php-docs-samples |
| 20 | + $ cd php-docs-samples/video |
| 21 | +``` |
| 22 | +4. **Install dependencies** via [Composer](http://getcomposer.org/doc/00-intro.md). |
| 23 | + Run `php composer.phar install` (if composer is installed locally) or `composer install` |
| 24 | + (if composer is installed globally). |
| 25 | +5. Run `php video.php`. The following commands are available: |
| 26 | + |
| 27 | + ``` |
| 28 | + help Displays help for a command |
| 29 | + list Lists commands |
| 30 | + shots Detect shot changes in video using Google Cloud Video Intelligence API |
| 31 | + ``` |
| 32 | +
|
| 33 | + Example: |
| 34 | +
|
| 35 | + ``` |
| 36 | + $ php video.php shots gs://cloudmleap/video/next/fox-snatched.mp4 |
| 37 | + annotation_results { |
| 38 | + input_uri: "\/cloudmleap\/video\/next\/fox-snatched.mp4" |
| 39 | + shot_annotations { |
| 40 | + start_time_offset: 41729 |
| 41 | + end_time_offset: 1000984 |
| 42 | + } |
| 43 | + shot_annotations { |
| 44 | + start_time_offset: 1042713 |
| 45 | + end_time_offset: 6006032 |
| 46 | + } |
| 47 | + ... |
| 48 | + } |
| 49 | + ``` |
| 50 | +
|
| 51 | +
|
| 52 | +6. Run `php video.php COMMAND --help` to print information about the usage of each command. |
| 53 | +
|
| 54 | +## Contributing changes |
| 55 | +
|
| 56 | +* See [CONTRIBUTING.md](../../CONTRIBUTING.md) |
| 57 | +
|
| 58 | +## Licensing |
| 59 | +
|
| 60 | +* See [LICENSE](../../LICENSE) |
0 commit comments