Stay organized with collections Save and categorize content based on your preferences.
An idiomatic C++ client library for the Cloud Video Intelligence API, a service to detect objects, explicit content, and scene changes in videos. It also specifies the region for annotation and transcribes speech to text.
While this library is GA, please note Google Cloud C++ client libraries do not follow Semantic Versioning.
QuickstartThe following shows the code that you'll run in the google/cloud/videointelligence/quickstart/
directory, which should give you a taste of the Cloud Video Intelligence API C++ client library API.
#include "google/cloud/videointelligence/v1/video_intelligence_client.h"
#include <google/protobuf/util/time_util.h>
#include <iostream>
int main(int argc, char* argv[]) try {
auto constexpr kDefaultUri = "gs://cloud-samples-data/video/animals.mp4";
if (argc > 2) {
std::cerr << "Usage: " << argv[0] << " [video-uri]\n"
<< " The gcs-uri must be in gs://... format and must point to a"
<< " MP4 video.\n"
<< "It defaults to " << kDefaultUri << "\n";
return 1;
}
auto uri = std::string{argc == 2 ? argv[1] : kDefaultUri};
namespace videointelligence = ::google::cloud::videointelligence_v1;
auto client = videointelligence::VideoIntelligenceServiceClient(
videointelligence::MakeVideoIntelligenceServiceConnection());
using google::cloud::videointelligence::v1::Feature;
google::cloud::videointelligence::v1::AnnotateVideoRequest request;
request.set_input_uri(uri);
request.add_features(Feature::SPEECH_TRANSCRIPTION);
auto& config =
*request.mutable_video_context()->mutable_speech_transcription_config();
config.set_language_code("en-US"); // Adjust based
config.set_max_alternatives(1); // We will just print the highest-confidence
auto future = client.AnnotateVideo(request);
std::cout << "Waiting for response";
auto const delay = std::chrono::seconds(5);
while (future.wait_for(delay) == std::future_status::timeout) {
std::cout << '.' << std::flush;
}
std::cout << "DONE\n";
auto response = future.get();
if (!response) throw std::move(response).status();
for (auto const& result : response->annotation_results()) {
using ::google::protobuf::util::TimeUtil;
std::cout << "Segment ["
<< TimeUtil::ToString(result.segment().start_time_offset())
<< ", " << TimeUtil::ToString(result.segment().end_time_offset())
<< "]\n";
for (auto const& transcription : result.speech_transcriptions()) {
if (transcription.alternatives().empty()) continue;
std::cout << transcription.alternatives(0).transcript() << "\n";
}
}
return 0;
} catch (google::cloud::Status const& status) {
std::cerr << "google::cloud::Status thrown: " << status << "\n";
return 1;
}
Main classes
The main class in this library is videointelligence_v1::VideoIntelligenceServiceClient
. All RPCs are exposed as member functions of this class. Other classes provide helpers, configuration parameters, and infrastructure to mock videointelligence_v1::VideoIntelligenceServiceClient
when testing your application.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-14 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[[["This page details the C++ client library for Google Cloud's Video Intelligence API, which is used to detect objects, content, and scene changes in videos."],["The latest version of the library is 2.37.0-rc, and the page also provides access to older versions, as far back as 2.11.0."],["The library allows users to utilize speech-to-text transcription and also to specify regions in videos to annotate."],["The primary class in the library is `videointelligence_v1::VideoIntelligenceServiceClient`, which exposes all RPCs as member functions."],["The library does not adhere to Semantic Versioning despite being generally available (GA), and the page contains links to guides on error handling, endpoint and authentication credential overrides, and more."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4