google-cloud-video_intelligence 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/video_intelligence/v1/doc/google/cloud/videointelligence/v1/video_intelligence.rb +149 -4
  3. data/lib/google/cloud/video_intelligence/v1/video_intelligence_service_client_config.json +1 -1
  4. data/lib/google/cloud/video_intelligence/v1p1beta1.rb +177 -0
  5. data/lib/google/cloud/video_intelligence/v1p1beta1/credentials.rb +41 -0
  6. data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/cloud/videointelligence/v1p1beta1/video_intelligence.rb +410 -0
  7. data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/longrunning/operations.rb +93 -0
  8. data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/protobuf/any.rb +130 -0
  9. data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/protobuf/duration.rb +91 -0
  10. data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/rpc/status.rb +84 -0
  11. data/lib/google/cloud/video_intelligence/v1p1beta1/video_intelligence_service_client.rb +296 -0
  12. data/lib/google/cloud/video_intelligence/v1p1beta1/video_intelligence_service_client_config.json +31 -0
  13. data/lib/google/cloud/video_intelligence/v1p2beta1.rb +177 -0
  14. data/lib/google/cloud/video_intelligence/v1p2beta1/credentials.rb +41 -0
  15. data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/cloud/videointelligence/v1p2beta1/video_intelligence.rb +442 -0
  16. data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/longrunning/operations.rb +93 -0
  17. data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/protobuf/any.rb +130 -0
  18. data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/protobuf/duration.rb +91 -0
  19. data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/rpc/status.rb +84 -0
  20. data/lib/google/cloud/video_intelligence/v1p2beta1/video_intelligence_service_client.rb +296 -0
  21. data/lib/google/cloud/video_intelligence/v1p2beta1/video_intelligence_service_client_config.json +31 -0
  22. data/lib/google/cloud/videointelligence/v1/video_intelligence_pb.rb +38 -0
  23. data/lib/google/cloud/videointelligence/v1p1beta1/video_intelligence_pb.rb +169 -0
  24. data/lib/google/cloud/videointelligence/v1p1beta1/video_intelligence_services_pb.rb +49 -0
  25. data/lib/google/cloud/videointelligence/v1p2beta1/video_intelligence_pb.rb +190 -0
  26. data/lib/google/cloud/videointelligence/v1p2beta1/video_intelligence_services_pb.rb +50 -0
  27. metadata +26 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90fbf75498a2a7aac6b4a6c41b542ff59d10ad2d5fdc2399b8fc1758ba8825de
4
- data.tar.gz: 343d0a7a1a83d4173b183f853b76a6c540f43c7d94f0fe83367d74e6e9c97ad9
3
+ metadata.gz: 17f16aa8f5c1074f53928da96f39f8973c2b5e05a10fd62e3ba4d54c95f1c017
4
+ data.tar.gz: ca2d14463d0bb2d695667675404f226434d4274f5f330aa1b644f2d2bf37eec9
5
5
  SHA512:
6
- metadata.gz: 1e4f004ee8225e399442ca19995459bcb6497539c1bbccdf41a87c9dfb22807a12b1cbca58407c089cd664f1cf4c344ee0fb7b44d77fe54a5a3eb1c84722a60b
7
- data.tar.gz: 6c1a95f8caea6972839be04f9c46bf71647010c95c1dcb1fa337ed83d748b606c53bd946bd49bfc6cfc8ed0abe22dc97c13508a1458abad213b035a871bc0fd2
6
+ metadata.gz: 4f50bdb3012b53f9eeb036e25985dfc82d783131a687671c7dabb6260a190306a9716d0618215b65a8b7db92df369c155d9cd59bb7f78457ed8f19e8a1ef2f0f
7
+ data.tar.gz: 9f4375e444a101a90f8aecfe65dfb54d587f3fc1c84bb617ef7bf58688b3f3142882eeb3dd9f5f7ca4d822a8c67dff4deedbdb5465ef7d259aa07833b0997262
@@ -60,8 +60,8 @@ module Google
60
60
  # @!attribute [rw] segments
61
61
  # @return [Array<Google::Cloud::Videointelligence::V1::VideoSegment>]
62
62
  # Video segments to annotate. The segments may overlap and are not required
63
- # to be contiguous or span the whole video. If unspecified, each video
64
- # is treated as a single segment.
63
+ # to be contiguous or span the whole video. If unspecified, each video is
64
+ # treated as a single segment.
65
65
  # @!attribute [rw] label_detection_config
66
66
  # @return [Google::Cloud::Videointelligence::V1::LabelDetectionConfig]
67
67
  # Config for LABEL_DETECTION.
@@ -74,6 +74,9 @@ module Google
74
74
  # @!attribute [rw] face_detection_config
75
75
  # @return [Google::Cloud::Videointelligence::V1::FaceDetectionConfig]
76
76
  # Config for FACE_DETECTION.
77
+ # @!attribute [rw] speech_transcription_config
78
+ # @return [Google::Cloud::Videointelligence::V1::SpeechTranscriptionConfig]
79
+ # Config for SPEECH_TRANSCRIPTION.
77
80
  class VideoContext; end
78
81
 
79
82
  # Config for LABEL_DETECTION.
@@ -274,6 +277,9 @@ module Google
274
277
  # @!attribute [rw] explicit_annotation
275
278
  # @return [Google::Cloud::Videointelligence::V1::ExplicitContentAnnotation]
276
279
  # Explicit content annotation.
280
+ # @!attribute [rw] speech_transcriptions
281
+ # @return [Array<Google::Cloud::Videointelligence::V1::SpeechTranscription>]
282
+ # Speech transcription.
277
283
  # @!attribute [rw] error
278
284
  # @return [Google::Rpc::Status]
279
285
  # If set, indicates an error. Note that for a single `AnnotateVideoRequest`
@@ -295,8 +301,8 @@ module Google
295
301
  # [Google Cloud Storage](https://cloud.google.com/storage/).
296
302
  # @!attribute [rw] progress_percent
297
303
  # @return [Integer]
298
- # Approximate percentage processed thus far.
299
- # Guaranteed to be 100 when fully processed.
304
+ # Approximate percentage processed thus far. Guaranteed to be
305
+ # 100 when fully processed.
300
306
  # @!attribute [rw] start_time
301
307
  # @return [Google::Protobuf::Timestamp]
302
308
  # Time when the request was received.
@@ -313,6 +319,142 @@ module Google
313
319
  # Progress metadata for all videos specified in `AnnotateVideoRequest`.
314
320
  class AnnotateVideoProgress; end
315
321
 
322
+ # Config for SPEECH_TRANSCRIPTION.
323
+ # @!attribute [rw] language_code
324
+ # @return [String]
325
+ # *Required* The language of the supplied audio as a
326
+ # [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
327
+ # Example: "en-US".
328
+ # See [Language Support](https://cloud.google.com/speech/docs/languages)
329
+ # for a list of the currently supported language codes.
330
+ # @!attribute [rw] max_alternatives
331
+ # @return [Integer]
332
+ # *Optional* Maximum number of recognition hypotheses to be returned.
333
+ # Specifically, the maximum number of `SpeechRecognitionAlternative` messages
334
+ # within each `SpeechTranscription`. The server may return fewer than
335
+ # `max_alternatives`. Valid values are `0`-`30`. A value of `0` or `1` will
336
+ # return a maximum of one. If omitted, will return a maximum of one.
337
+ # @!attribute [rw] filter_profanity
338
+ # @return [true, false]
339
+ # *Optional* If set to `true`, the server will attempt to filter out
340
+ # profanities, replacing all but the initial character in each filtered word
341
+ # with asterisks, e.g. "f***". If set to `false` or omitted, profanities
342
+ # won't be filtered out.
343
+ # @!attribute [rw] speech_contexts
344
+ # @return [Array<Google::Cloud::Videointelligence::V1::SpeechContext>]
345
+ # *Optional* A means to provide context to assist the speech recognition.
346
+ # @!attribute [rw] enable_automatic_punctuation
347
+ # @return [true, false]
348
+ # *Optional* If 'true', adds punctuation to recognition result hypotheses.
349
+ # This feature is only available in select languages. Setting this for
350
+ # requests in other languages has no effect at all. The default 'false' value
351
+ # does not add punctuation to result hypotheses. NOTE: "This is currently
352
+ # offered as an experimental service, complimentary to all users. In the
353
+ # future this may be exclusively available as a premium feature."
354
+ # @!attribute [rw] audio_tracks
355
+ # @return [Array<Integer>]
356
+ # *Optional* For file formats, such as MXF or MKV, supporting multiple audio
357
+ # tracks, specify up to two tracks. Default: track 0.
358
+ # @!attribute [rw] enable_speaker_diarization
359
+ # @return [true, false]
360
+ # *Optional* If 'true', enables speaker detection for each recognized word in
361
+ # the top alternative of the recognition result using a speaker_tag provided
362
+ # in the WordInfo.
363
+ # Note: When this is true, we send all the words from the beginning of the
364
+ # audio for the top alternative in every consecutive responses.
365
+ # This is done in order to improve our speaker tags as our models learn to
366
+ # identify the speakers in the conversation over time.
367
+ # @!attribute [rw] diarization_speaker_count
368
+ # @return [Integer]
369
+ # *Optional*
370
+ # If set, specifies the estimated number of speakers in the conversation.
371
+ # If not set, defaults to '2'.
372
+ # Ignored unless enable_speaker_diarization is set to true.
373
+ # @!attribute [rw] enable_word_confidence
374
+ # @return [true, false]
375
+ # *Optional* If `true`, the top result includes a list of words and the
376
+ # confidence for those words. If `false`, no word-level confidence
377
+ # information is returned. The default is `false`.
378
+ class SpeechTranscriptionConfig; end
379
+
380
+ # Provides "hints" to the speech recognizer to favor specific words and phrases
381
+ # in the results.
382
+ # @!attribute [rw] phrases
383
+ # @return [Array<String>]
384
+ # *Optional* A list of strings containing words and phrases "hints" so that
385
+ # the speech recognition is more likely to recognize them. This can be used
386
+ # to improve the accuracy for specific words and phrases, for example, if
387
+ # specific commands are typically spoken by the user. This can also be used
388
+ # to add additional words to the vocabulary of the recognizer. See
389
+ # [usage limits](https://cloud.google.com/speech/limits#content).
390
+ class SpeechContext; end
391
+
392
+ # A speech recognition result corresponding to a portion of the audio.
393
+ # @!attribute [rw] alternatives
394
+ # @return [Array<Google::Cloud::Videointelligence::V1::SpeechRecognitionAlternative>]
395
+ # May contain one or more recognition hypotheses (up to the maximum specified
396
+ # in `max_alternatives`). These alternatives are ordered in terms of
397
+ # accuracy, with the top (first) alternative being the most probable, as
398
+ # ranked by the recognizer.
399
+ # @!attribute [rw] language_code
400
+ # @return [String]
401
+ # Output only. The
402
+ # [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag of the
403
+ # language in this result. This language code was detected to have the most
404
+ # likelihood of being spoken in the audio.
405
+ class SpeechTranscription; end
406
+
407
+ # Alternative hypotheses (a.k.a. n-best list).
408
+ # @!attribute [rw] transcript
409
+ # @return [String]
410
+ # Transcript text representing the words that the user spoke.
411
+ # @!attribute [rw] confidence
412
+ # @return [Float]
413
+ # The confidence estimate between 0.0 and 1.0. A higher number
414
+ # indicates an estimated greater likelihood that the recognized words are
415
+ # correct. This field is typically provided only for the top hypothesis, and
416
+ # only for `is_final=true` results. Clients should not rely on the
417
+ # `confidence` field as it is not guaranteed to be accurate or consistent.
418
+ # The default of 0.0 is a sentinel value indicating `confidence` was not set.
419
+ # @!attribute [rw] words
420
+ # @return [Array<Google::Cloud::Videointelligence::V1::WordInfo>]
421
+ # A list of word-specific information for each recognized word.
422
+ class SpeechRecognitionAlternative; end
423
+
424
+ # Word-specific information for recognized words. Word information is only
425
+ # included in the response when certain request parameters are set, such
426
+ # as `enable_word_time_offsets`.
427
+ # @!attribute [rw] start_time
428
+ # @return [Google::Protobuf::Duration]
429
+ # Time offset relative to the beginning of the audio, and
430
+ # corresponding to the start of the spoken word. This field is only set if
431
+ # `enable_word_time_offsets=true` and only in the top hypothesis. This is an
432
+ # experimental feature and the accuracy of the time offset can vary.
433
+ # @!attribute [rw] end_time
434
+ # @return [Google::Protobuf::Duration]
435
+ # Time offset relative to the beginning of the audio, and
436
+ # corresponding to the end of the spoken word. This field is only set if
437
+ # `enable_word_time_offsets=true` and only in the top hypothesis. This is an
438
+ # experimental feature and the accuracy of the time offset can vary.
439
+ # @!attribute [rw] word
440
+ # @return [String]
441
+ # The word corresponding to this set of information.
442
+ # @!attribute [rw] confidence
443
+ # @return [Float]
444
+ # Output only. The confidence estimate between 0.0 and 1.0. A higher number
445
+ # indicates an estimated greater likelihood that the recognized words are
446
+ # correct. This field is set only for the top alternative.
447
+ # This field is not guaranteed to be accurate and users should not rely on it
448
+ # to be always provided.
449
+ # The default of 0.0 is a sentinel value indicating `confidence` was not set.
450
+ # @!attribute [rw] speaker_tag
451
+ # @return [Integer]
452
+ # Output only. A distinct integer value is assigned for every speaker within
453
+ # the audio. This field specifies which one of those speakers was detected to
454
+ # have spoken this word. Value ranges from 1 up to diarization_speaker_count,
455
+ # and is only set if speaker diarization is enabled.
456
+ class WordInfo; end
457
+
316
458
  # Video annotation feature.
317
459
  module Feature
318
460
  # Unspecified.
@@ -329,6 +471,9 @@ module Google
329
471
 
330
472
  # Human face detection and tracking.
331
473
  FACE_DETECTION = 4
474
+
475
+ # Speech transcription.
476
+ SPEECH_TRANSCRIPTION = 6
332
477
  end
333
478
 
334
479
  # Label detection mode.
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "methods": {
23
23
  "AnnotateVideo": {
24
- "timeout_millis": 60000,
24
+ "timeout_millis": 600000,
25
25
  "retry_codes_name": "idempotent",
26
26
  "retry_params_name": "default"
27
27
  }
@@ -0,0 +1,177 @@
1
+ # Copyright 2018 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ require "google/cloud/video_intelligence/v1p1beta1/video_intelligence_service_client"
17
+ require "google/rpc/status_pb"
18
+ require "google/cloud/videointelligence/v1p1beta1/video_intelligence_pb"
19
+
20
+ module Google
21
+ module Cloud
22
+ module VideoIntelligence
23
+ # rubocop:disable LineLength
24
+
25
+ ##
26
+ # # Ruby Client for Cloud Video Intelligence API ([Beta](https://github.com/googleapis/google-cloud-ruby#versioning))
27
+ #
28
+ # [Cloud Video Intelligence API][Product Documentation]:
29
+ # Cloud Video Intelligence API.
30
+ # - [Product Documentation][]
31
+ #
32
+ # ## Quick Start
33
+ # In order to use this library, you first need to go through the following
34
+ # steps:
35
+ #
36
+ # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
37
+ # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
38
+ # 3. [Enable the Cloud Video Intelligence API.](https://console.cloud.google.com/apis/library/videointelligence.googleapis.com)
39
+ # 4. [Setup Authentication.](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
40
+ #
41
+ # ### Installation
42
+ # ```
43
+ # $ gem install google-cloud-video_intelligence
44
+ # ```
45
+ #
46
+ # ### Preview
47
+ # #### VideoIntelligenceServiceClient
48
+ # ```rb
49
+ # require "google/cloud/video_intelligence"
50
+ #
51
+ # video_intelligence_service_client = Google::Cloud::VideoIntelligence.new(version: :v1p1beta1)
52
+ # input_uri = "gs://demomaker/cat.mp4"
53
+ # features_element = :LABEL_DETECTION
54
+ # features = [features_element]
55
+ #
56
+ # # Register a callback during the method call.
57
+ # operation = video_intelligence_service_client.annotate_video(input_uri: input_uri, features: features) do |op|
58
+ # raise op.results.message if op.error?
59
+ # op_results = op.results
60
+ # # Process the results.
61
+ #
62
+ # metadata = op.metadata
63
+ # # Process the metadata.
64
+ # end
65
+ #
66
+ # # Or use the return value to register a callback.
67
+ # operation.on_done do |op|
68
+ # raise op.results.message if op.error?
69
+ # op_results = op.results
70
+ # # Process the results.
71
+ #
72
+ # metadata = op.metadata
73
+ # # Process the metadata.
74
+ # end
75
+ #
76
+ # # Manually reload the operation.
77
+ # operation.reload!
78
+ #
79
+ # # Or block until the operation completes, triggering callbacks on
80
+ # # completion.
81
+ # operation.wait_until_done!
82
+ # ```
83
+ #
84
+ # ### Next Steps
85
+ # - Read the [Cloud Video Intelligence API Product documentation][Product Documentation]
86
+ # to learn more about the product and see How-to Guides.
87
+ # - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
88
+ # to see the full list of Cloud APIs that we cover.
89
+ #
90
+ # [Product Documentation]: https://cloud.google.com/video-intelligence
91
+ #
92
+ # ## Enabling Logging
93
+ #
94
+ # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
95
+ # The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
96
+ # or a [`Google::Cloud::Logging::Logger`](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
97
+ # that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
98
+ # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
99
+ #
100
+ # Configuring a Ruby stdlib logger:
101
+ #
102
+ # ```ruby
103
+ # require "logger"
104
+ #
105
+ # module MyLogger
106
+ # LOGGER = Logger.new $stderr, level: Logger::WARN
107
+ # def logger
108
+ # LOGGER
109
+ # end
110
+ # end
111
+ #
112
+ # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
113
+ # module GRPC
114
+ # extend MyLogger
115
+ # end
116
+ # ```
117
+ #
118
+ module V1p1beta1
119
+ # rubocop:enable LineLength
120
+
121
+ ##
122
+ # Service that implements Google Cloud Video Intelligence API.
123
+ #
124
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
125
+ # Provides the means for authenticating requests made by the client. This parameter can
126
+ # be many types.
127
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
128
+ # authenticating requests made by this client.
129
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
130
+ # credentials for this client.
131
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
132
+ # credentials for this client.
133
+ # A `GRPC::Core::Channel` will be used to make calls through.
134
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
135
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
136
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
137
+ # metadata for requests, generally, to give OAuth credentials.
138
+ # @param scopes [Array<String>]
139
+ # The OAuth scopes for this service. This parameter is ignored if
140
+ # an updater_proc is supplied.
141
+ # @param client_config [Hash]
142
+ # A Hash for call options for each method. See
143
+ # Google::Gax#construct_settings for the structure of
144
+ # this data. Falls back to the default config if not specified
145
+ # or the specified config is missing data points.
146
+ # @param timeout [Numeric]
147
+ # The default timeout, in seconds, for calls made through this client.
148
+ # @param metadata [Hash]
149
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
150
+ # @param exception_transformer [Proc]
151
+ # An optional proc that intercepts any exceptions raised during an API call to inject
152
+ # custom error handling.
153
+ def self.new \
154
+ credentials: nil,
155
+ scopes: nil,
156
+ client_config: nil,
157
+ timeout: nil,
158
+ metadata: nil,
159
+ exception_transformer: nil,
160
+ lib_name: nil,
161
+ lib_version: nil
162
+ kwargs = {
163
+ credentials: credentials,
164
+ scopes: scopes,
165
+ client_config: client_config,
166
+ timeout: timeout,
167
+ metadata: metadata,
168
+ exception_transformer: exception_transformer,
169
+ lib_name: lib_name,
170
+ lib_version: lib_version
171
+ }.select { |_, v| v != nil }
172
+ Google::Cloud::VideoIntelligence::V1p1beta1::VideoIntelligenceServiceClient.new(**kwargs)
173
+ end
174
+ end
175
+ end
176
+ end
177
+ end
@@ -0,0 +1,41 @@
1
+ # Copyright 2018 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ require "googleauth"
17
+
18
+ module Google
19
+ module Cloud
20
+ module VideoIntelligence
21
+ module V1p1beta1
22
+ class Credentials < Google::Auth::Credentials
23
+ SCOPE = [
24
+ "https://www.googleapis.com/auth/cloud-platform"
25
+ ].freeze
26
+ PATH_ENV_VARS = %w(VIDEO_INTELLIGENCE_CREDENTIALS
27
+ VIDEO_INTELLIGENCE_KEYFILE
28
+ GOOGLE_CLOUD_CREDENTIALS
29
+ GOOGLE_CLOUD_KEYFILE
30
+ GCLOUD_KEYFILE)
31
+ JSON_ENV_VARS = %w(VIDEO_INTELLIGENCE_CREDENTIALS_JSON
32
+ VIDEO_INTELLIGENCE_KEYFILE_JSON
33
+ GOOGLE_CLOUD_CREDENTIALS_JSON
34
+ GOOGLE_CLOUD_KEYFILE_JSON
35
+ GCLOUD_KEYFILE_JSON)
36
+ DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,410 @@
1
+ # Copyright 2018 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ module Google
17
+ module Cloud
18
+ module Videointelligence
19
+ module V1p1beta1
20
+ # Video annotation request.
21
+ # @!attribute [rw] input_uri
22
+ # @return [String]
23
+ # Input video location. Currently, only
24
+ # [Google Cloud Storage](https://cloud.google.com/storage/) URIs are
25
+ # supported, which must be specified in the following format:
26
+ # `gs://bucket-id/object-id` (other URI formats return
27
+ # {Google::Rpc::Code::INVALID_ARGUMENT}). For more information, see
28
+ # [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
29
+ # A video URI may include wildcards in `object-id`, and thus identify
30
+ # multiple videos. Supported wildcards: '*' to match 0 or more characters;
31
+ # '?' to match 1 character. If unset, the input video should be embedded
32
+ # in the request as `input_content`. If set, `input_content` should be unset.
33
+ # @!attribute [rw] input_content
34
+ # @return [String]
35
+ # The video data bytes.
36
+ # If unset, the input video(s) should be specified via `input_uri`.
37
+ # If set, `input_uri` should be unset.
38
+ # @!attribute [rw] features
39
+ # @return [Array<Google::Cloud::Videointelligence::V1p1beta1::Feature>]
40
+ # Requested video annotation features.
41
+ # @!attribute [rw] video_context
42
+ # @return [Google::Cloud::Videointelligence::V1p1beta1::VideoContext]
43
+ # Additional video context and/or feature-specific parameters.
44
+ # @!attribute [rw] output_uri
45
+ # @return [String]
46
+ # Optional location where the output (in JSON format) should be stored.
47
+ # Currently, only [Google Cloud Storage](https://cloud.google.com/storage/)
48
+ # URIs are supported, which must be specified in the following format:
49
+ # `gs://bucket-id/object-id` (other URI formats return
50
+ # {Google::Rpc::Code::INVALID_ARGUMENT}). For more information, see
51
+ # [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
52
+ # @!attribute [rw] location_id
53
+ # @return [String]
54
+ # Optional cloud region where annotation should take place. Supported cloud
55
+ # regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region
56
+ # is specified, a region will be determined based on video file location.
57
+ class AnnotateVideoRequest; end
58
+
59
+ # Video context and/or feature-specific parameters.
60
+ # @!attribute [rw] segments
61
+ # @return [Array<Google::Cloud::Videointelligence::V1p1beta1::VideoSegment>]
62
+ # Video segments to annotate. The segments may overlap and are not required
63
+ # to be contiguous or span the whole video. If unspecified, each video is
64
+ # treated as a single segment.
65
+ # @!attribute [rw] label_detection_config
66
+ # @return [Google::Cloud::Videointelligence::V1p1beta1::LabelDetectionConfig]
67
+ # Config for LABEL_DETECTION.
68
+ # @!attribute [rw] shot_change_detection_config
69
+ # @return [Google::Cloud::Videointelligence::V1p1beta1::ShotChangeDetectionConfig]
70
+ # Config for SHOT_CHANGE_DETECTION.
71
+ # @!attribute [rw] explicit_content_detection_config
72
+ # @return [Google::Cloud::Videointelligence::V1p1beta1::ExplicitContentDetectionConfig]
73
+ # Config for EXPLICIT_CONTENT_DETECTION.
74
+ # @!attribute [rw] speech_transcription_config
75
+ # @return [Google::Cloud::Videointelligence::V1p1beta1::SpeechTranscriptionConfig]
76
+ # Config for SPEECH_TRANSCRIPTION.
77
+ class VideoContext; end
78
+
79
+ # Config for LABEL_DETECTION.
80
+ # @!attribute [rw] label_detection_mode
81
+ # @return [Google::Cloud::Videointelligence::V1p1beta1::LabelDetectionMode]
82
+ # What labels should be detected with LABEL_DETECTION, in addition to
83
+ # video-level labels or segment-level labels.
84
+ # If unspecified, defaults to `SHOT_MODE`.
85
+ # @!attribute [rw] stationary_camera
86
+ # @return [true, false]
87
+ # Whether the video has been shot from a stationary (i.e. non-moving) camera.
88
+ # When set to true, might improve detection accuracy for moving objects.
89
+ # Should be used with `SHOT_AND_FRAME_MODE` enabled.
90
+ # @!attribute [rw] model
91
+ # @return [String]
92
+ # Model to use for label detection.
93
+ # Supported values: "builtin/stable" (the default if unset) and
94
+ # "builtin/latest".
95
+ class LabelDetectionConfig; end
96
+
97
+ # Config for SHOT_CHANGE_DETECTION.
98
+ # @!attribute [rw] model
99
+ # @return [String]
100
+ # Model to use for shot change detection.
101
+ # Supported values: "builtin/stable" (the default if unset) and
102
+ # "builtin/latest".
103
+ class ShotChangeDetectionConfig; end
104
+
105
+ # Config for EXPLICIT_CONTENT_DETECTION.
106
+ # @!attribute [rw] model
107
+ # @return [String]
108
+ # Model to use for explicit content detection.
109
+ # Supported values: "builtin/stable" (the default if unset) and
110
+ # "builtin/latest".
111
+ class ExplicitContentDetectionConfig; end
112
+
113
+ # Video segment.
114
+ # @!attribute [rw] start_time_offset
115
+ # @return [Google::Protobuf::Duration]
116
+ # Time-offset, relative to the beginning of the video,
117
+ # corresponding to the start of the segment (inclusive).
118
+ # @!attribute [rw] end_time_offset
119
+ # @return [Google::Protobuf::Duration]
120
+ # Time-offset, relative to the beginning of the video,
121
+ # corresponding to the end of the segment (inclusive).
122
+ class VideoSegment; end
123
+
124
+ # Video segment level annotation results for label detection.
125
+ # @!attribute [rw] segment
126
+ # @return [Google::Cloud::Videointelligence::V1p1beta1::VideoSegment]
127
+ # Video segment where a label was detected.
128
+ # @!attribute [rw] confidence
129
+ # @return [Float]
130
+ # Confidence that the label is accurate. Range: [0, 1].
131
+ class LabelSegment; end
132
+
133
+ # Video frame level annotation results for label detection.
134
+ # @!attribute [rw] time_offset
135
+ # @return [Google::Protobuf::Duration]
136
+ # Time-offset, relative to the beginning of the video, corresponding to the
137
+ # video frame for this location.
138
+ # @!attribute [rw] confidence
139
+ # @return [Float]
140
+ # Confidence that the label is accurate. Range: [0, 1].
141
+ class LabelFrame; end
142
+
143
+ # Detected entity from video analysis.
144
+ # @!attribute [rw] entity_id
145
+ # @return [String]
146
+ # Opaque entity ID. Some IDs may be available in
147
+ # [Google Knowledge Graph Search
148
+ # API](https://developers.google.com/knowledge-graph/).
149
+ # @!attribute [rw] description
150
+ # @return [String]
151
+ # Textual description, e.g. `Fixed-gear bicycle`.
152
+ # @!attribute [rw] language_code
153
+ # @return [String]
154
+ # Language code for `description` in BCP-47 format.
155
+ class Entity; end
156
+
157
+ # Label annotation.
158
+ # @!attribute [rw] entity
159
+ # @return [Google::Cloud::Videointelligence::V1p1beta1::Entity]
160
+ # Detected entity.
161
+ # @!attribute [rw] category_entities
162
+ # @return [Array<Google::Cloud::Videointelligence::V1p1beta1::Entity>]
163
+ # Common categories for the detected entity.
164
+ # E.g. when the label is `Terrier` the category is likely `dog`. And in some
165
+ # cases there might be more than one categories e.g. `Terrier` could also be
166
+ # a `pet`.
167
+ # @!attribute [rw] segments
168
+ # @return [Array<Google::Cloud::Videointelligence::V1p1beta1::LabelSegment>]
169
+ # All video segments where a label was detected.
170
+ # @!attribute [rw] frames
171
+ # @return [Array<Google::Cloud::Videointelligence::V1p1beta1::LabelFrame>]
172
+ # All video frames where a label was detected.
173
+ class LabelAnnotation; end
174
+
175
+ # Video frame level annotation results for explicit content.
176
+ # @!attribute [rw] time_offset
177
+ # @return [Google::Protobuf::Duration]
178
+ # Time-offset, relative to the beginning of the video, corresponding to the
179
+ # video frame for this location.
180
+ # @!attribute [rw] pornography_likelihood
181
+ # @return [Google::Cloud::Videointelligence::V1p1beta1::Likelihood]
182
+ # Likelihood of the pornography content..
183
+ class ExplicitContentFrame; end
184
+
185
+ # Explicit content annotation (based on per-frame visual signals only).
186
+ # If no explicit content has been detected in a frame, no annotations are
187
+ # present for that frame.
188
+ # @!attribute [rw] frames
189
+ # @return [Array<Google::Cloud::Videointelligence::V1p1beta1::ExplicitContentFrame>]
190
+ # All video frames where explicit content was detected.
191
+ class ExplicitContentAnnotation; end
192
+
193
+ # Annotation results for a single video.
194
+ # @!attribute [rw] input_uri
195
+ # @return [String]
196
+ # Output only. Video file location in
197
+ # [Google Cloud Storage](https://cloud.google.com/storage/).
198
+ # @!attribute [rw] segment_label_annotations
199
+ # @return [Array<Google::Cloud::Videointelligence::V1p1beta1::LabelAnnotation>]
200
+ # Label annotations on video level or user specified segment level.
201
+ # There is exactly one element for each unique label.
202
+ # @!attribute [rw] shot_label_annotations
203
+ # @return [Array<Google::Cloud::Videointelligence::V1p1beta1::LabelAnnotation>]
204
+ # Label annotations on shot level.
205
+ # There is exactly one element for each unique label.
206
+ # @!attribute [rw] frame_label_annotations
207
+ # @return [Array<Google::Cloud::Videointelligence::V1p1beta1::LabelAnnotation>]
208
+ # Label annotations on frame level.
209
+ # There is exactly one element for each unique label.
210
+ # @!attribute [rw] shot_annotations
211
+ # @return [Array<Google::Cloud::Videointelligence::V1p1beta1::VideoSegment>]
212
+ # Shot annotations. Each shot is represented as a video segment.
213
+ # @!attribute [rw] explicit_annotation
214
+ # @return [Google::Cloud::Videointelligence::V1p1beta1::ExplicitContentAnnotation]
215
+ # Explicit content annotation.
216
+ # @!attribute [rw] speech_transcriptions
217
+ # @return [Array<Google::Cloud::Videointelligence::V1p1beta1::SpeechTranscription>]
218
+ # Speech transcription.
219
+ # @!attribute [rw] error
220
+ # @return [Google::Rpc::Status]
221
+ # Output only. If set, indicates an error. Note that for a single
222
+ # `AnnotateVideoRequest` some videos may succeed and some may fail.
223
+ class VideoAnnotationResults; end
224
+
225
+ # Video annotation response. Included in the `response`
226
+ # field of the `Operation` returned by the `GetOperation`
227
+ # call of the `google::longrunning::Operations` service.
228
+ # @!attribute [rw] annotation_results
229
+ # @return [Array<Google::Cloud::Videointelligence::V1p1beta1::VideoAnnotationResults>]
230
+ # Annotation results for all videos specified in `AnnotateVideoRequest`.
231
+ class AnnotateVideoResponse; end
232
+
233
+ # Annotation progress for a single video.
234
+ # @!attribute [rw] input_uri
235
+ # @return [String]
236
+ # Output only. Video file location in
237
+ # [Google Cloud Storage](https://cloud.google.com/storage/).
238
+ # @!attribute [rw] progress_percent
239
+ # @return [Integer]
240
+ # Output only. Approximate percentage processed thus far. Guaranteed to be
241
+ # 100 when fully processed.
242
+ # @!attribute [rw] start_time
243
+ # @return [Google::Protobuf::Timestamp]
244
+ # Output only. Time when the request was received.
245
+ # @!attribute [rw] update_time
246
+ # @return [Google::Protobuf::Timestamp]
247
+ # Output only. Time of the most recent update.
248
+ class VideoAnnotationProgress; end
249
+
250
+ # Video annotation progress. Included in the `metadata`
251
+ # field of the `Operation` returned by the `GetOperation`
252
+ # call of the `google::longrunning::Operations` service.
253
+ # @!attribute [rw] annotation_progress
254
+ # @return [Array<Google::Cloud::Videointelligence::V1p1beta1::VideoAnnotationProgress>]
255
+ # Progress metadata for all videos specified in `AnnotateVideoRequest`.
256
+ class AnnotateVideoProgress; end
257
+
258
+ # Config for SPEECH_TRANSCRIPTION.
259
+ # @!attribute [rw] language_code
260
+ # @return [String]
261
+ # *Required* The language of the supplied audio as a
262
+ # [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
263
+ # Example: "en-US".
264
+ # See [Language Support](https://cloud.google.com/speech/docs/languages)
265
+ # for a list of the currently supported language codes.
266
+ # @!attribute [rw] max_alternatives
267
+ # @return [Integer]
268
+ # *Optional* Maximum number of recognition hypotheses to be returned.
269
+ # Specifically, the maximum number of `SpeechRecognitionAlternative` messages
270
+ # within each `SpeechRecognitionResult`. The server may return fewer than
271
+ # `max_alternatives`. Valid values are `0`-`30`. A value of `0` or `1` will
272
+ # return a maximum of one. If omitted, will return a maximum of one.
273
+ # @!attribute [rw] filter_profanity
274
+ # @return [true, false]
275
+ # *Optional* If set to `true`, the server will attempt to filter out
276
+ # profanities, replacing all but the initial character in each filtered word
277
+ # with asterisks, e.g. "f***". If set to `false` or omitted, profanities
278
+ # won't be filtered out.
279
+ # @!attribute [rw] speech_contexts
280
+ # @return [Array<Google::Cloud::Videointelligence::V1p1beta1::SpeechContext>]
281
+ # *Optional* A means to provide context to assist the speech recognition.
282
+ # @!attribute [rw] enable_automatic_punctuation
283
+ # @return [true, false]
284
+ # *Optional* If 'true', adds punctuation to recognition result hypotheses.
285
+ # This feature is only available in select languages. Setting this for
286
+ # requests in other languages has no effect at all. The default 'false' value
287
+ # does not add punctuation to result hypotheses. NOTE: "This is currently
288
+ # offered as an experimental service, complimentary to all users. In the
289
+ # future this may be exclusively available as a premium feature."
290
+ # @!attribute [rw] audio_tracks
291
+ # @return [Array<Integer>]
292
+ # *Optional* For file formats, such as MXF or MKV, supporting multiple audio
293
+ # tracks, specify up to two tracks. Default: track 0.
294
+ class SpeechTranscriptionConfig; end
295
+
296
+ # Provides "hints" to the speech recognizer to favor specific words and phrases
297
+ # in the results.
298
+ # @!attribute [rw] phrases
299
+ # @return [Array<String>]
300
+ # *Optional* A list of strings containing words and phrases "hints" so that
301
+ # the speech recognition is more likely to recognize them. This can be used
302
+ # to improve the accuracy for specific words and phrases, for example, if
303
+ # specific commands are typically spoken by the user. This can also be used
304
+ # to add additional words to the vocabulary of the recognizer. See
305
+ # [usage limits](https://cloud.google.com/speech/limits#content).
306
+ class SpeechContext; end
307
+
308
+ # A speech recognition result corresponding to a portion of the audio.
309
+ # @!attribute [rw] alternatives
310
+ # @return [Array<Google::Cloud::Videointelligence::V1p1beta1::SpeechRecognitionAlternative>]
311
+ # Output only. May contain one or more recognition hypotheses (up to the
312
+ # maximum specified in `max_alternatives`).
313
+ # These alternatives are ordered in terms of accuracy, with the top (first)
314
+ # alternative being the most probable, as ranked by the recognizer.
315
+ class SpeechTranscription; end
316
+
317
+ # Alternative hypotheses (a.k.a. n-best list).
318
+ # @!attribute [rw] transcript
319
+ # @return [String]
320
+ # Output only. Transcript text representing the words that the user spoke.
321
+ # @!attribute [rw] confidence
322
+ # @return [Float]
323
+ # Output only. The confidence estimate between 0.0 and 1.0. A higher number
324
+ # indicates an estimated greater likelihood that the recognized words are
325
+ # correct. This field is typically provided only for the top hypothesis, and
326
+ # only for `is_final=true` results. Clients should not rely on the
327
+ # `confidence` field as it is not guaranteed to be accurate or consistent.
328
+ # The default of 0.0 is a sentinel value indicating `confidence` was not set.
329
+ # @!attribute [rw] words
330
+ # @return [Array<Google::Cloud::Videointelligence::V1p1beta1::WordInfo>]
331
+ # Output only. A list of word-specific information for each recognized word.
332
+ class SpeechRecognitionAlternative; end
333
+
334
+ # Word-specific information for recognized words. Word information is only
335
+ # included in the response when certain request parameters are set, such
336
+ # as `enable_word_time_offsets`.
337
+ # @!attribute [rw] start_time
338
+ # @return [Google::Protobuf::Duration]
339
+ # Output only. Time offset relative to the beginning of the audio, and
340
+ # corresponding to the start of the spoken word. This field is only set if
341
+ # `enable_word_time_offsets=true` and only in the top hypothesis. This is an
342
+ # experimental feature and the accuracy of the time offset can vary.
343
+ # @!attribute [rw] end_time
344
+ # @return [Google::Protobuf::Duration]
345
+ # Output only. Time offset relative to the beginning of the audio, and
346
+ # corresponding to the end of the spoken word. This field is only set if
347
+ # `enable_word_time_offsets=true` and only in the top hypothesis. This is an
348
+ # experimental feature and the accuracy of the time offset can vary.
349
+ # @!attribute [rw] word
350
+ # @return [String]
351
+ # Output only. The word corresponding to this set of information.
352
+ class WordInfo; end
353
+
354
+ # Video annotation feature.
355
+ module Feature
356
+ # Unspecified.
357
+ FEATURE_UNSPECIFIED = 0
358
+
359
+ # Label detection. Detect objects, such as dog or flower.
360
+ LABEL_DETECTION = 1
361
+
362
+ # Shot change detection.
363
+ SHOT_CHANGE_DETECTION = 2
364
+
365
+ # Explicit content detection.
366
+ EXPLICIT_CONTENT_DETECTION = 3
367
+
368
+ # Speech transcription.
369
+ SPEECH_TRANSCRIPTION = 6
370
+ end
371
+
372
+ # Label detection mode.
373
+ module LabelDetectionMode
374
+ # Unspecified.
375
+ LABEL_DETECTION_MODE_UNSPECIFIED = 0
376
+
377
+ # Detect shot-level labels.
378
+ SHOT_MODE = 1
379
+
380
+ # Detect frame-level labels.
381
+ FRAME_MODE = 2
382
+
383
+ # Detect both shot-level and frame-level labels.
384
+ SHOT_AND_FRAME_MODE = 3
385
+ end
386
+
387
+ # Bucketized representation of likelihood.
388
+ module Likelihood
389
+ # Unspecified likelihood.
390
+ LIKELIHOOD_UNSPECIFIED = 0
391
+
392
+ # Very unlikely.
393
+ VERY_UNLIKELY = 1
394
+
395
+ # Unlikely.
396
+ UNLIKELY = 2
397
+
398
+ # Possible.
399
+ POSSIBLE = 3
400
+
401
+ # Likely.
402
+ LIKELY = 4
403
+
404
+ # Very likely.
405
+ VERY_LIKELY = 5
406
+ end
407
+ end
408
+ end
409
+ end
410
+ end