Skip to content

Commit 8f80e31

Browse files
SurferJeffAtGooglebshaffer
authored andcommitted
Video intelligence sample. (GoogleCloudPlatform#374)
1 parent 30e1c58 commit 8f80e31

File tree

8 files changed

+2487
-0
lines changed

8 files changed

+2487
-0
lines changed

video/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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)

video/composer.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "google/translate-sample",
3+
"type": "project",
4+
"require": {
5+
"google/cloud-storage": "^1.0",
6+
"symfony/console": "^3.1",
7+
"google/cloud-videointelligence": "^0.2.0",
8+
"stanley-cheung/protobuf-php": "^0.6.0"
9+
},
10+
"autoload": {
11+
"files": [
12+
"src/analyze_shots.php"
13+
]
14+
},
15+
"require-dev": {
16+
"phpunit/phpunit": "~4"
17+
}
18+
}

0 commit comments

Comments
 (0)