How to use the @google-cloud/video-intelligence.VideoIntelligenceServiceClient function in @google-cloud/video-intelligence

To help you get started, we’ve selected a few @google-cloud/video-intelligence examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googleapis / nodejs-video-intelligence / samples / analyze.js View on Github external
async function analyzeObjectTrackingGCS(gcsUri) {
  //gcsUri - GCS URI of the video to analyze, e.g. gs://my-bucket/my-video.mp4
  //[START video_object_tracking_gcs]
  // Imports the Google Cloud Video Intelligence library
  const Video = require('@google-cloud/video-intelligence');

  // Creates a client
  const video = new Video.VideoIntelligenceServiceClient();

  /**
   * TODO(developer): Uncomment the following line before running the sample.
   */
  // const gcsUri = 'GCS URI of the video to analyze, e.g. gs://my-bucket/my-video.mp4';

  const request = {
    inputUri: gcsUri,
    features: ['OBJECT_TRACKING'],
    //recommended to use us-east1 for the best latency due to different types of processors used in this region and others
    locationId: 'us-east1',
  };
  // Detects objects in a video
  const [operation] = await video.annotateVideo(request);
  const results = await operation.promise();
  console.log('Waiting for operation to complete...');
github googleapis / nodejs-video-intelligence / samples / quickstart.js View on Github external
async function main() {
  // [START video_quickstart]
  // Imports the Google Cloud Video Intelligence library
  const videoIntelligence = require('@google-cloud/video-intelligence');

  // Creates a client
  const client = new videoIntelligence.VideoIntelligenceServiceClient();

  // The GCS uri of the video to analyze
  const gcsUri = 'gs://cloud-samples-data/video/cat.mp4';

  // Construct request
  const request = {
    inputUri: gcsUri,
    features: ['LABEL_DETECTION'],
  };

  // Execute request
  const [operation] = await client.annotateVideo(request);

  console.log(
    'Waiting for operation to complete... (this may take a few minutes)'
  );
github googleapis / nodejs-video-intelligence / samples / analyze.js View on Github external
async function analyzeTextGCS(gcsUri) {
  //gcsUri - GCS URI of the video to analyze, e.g. gs://my-bucket/my-video.mp4
  //[START video_detect_text_gcs]
  // Imports the Google Cloud Video Intelligence library
  const Video = require('@google-cloud/video-intelligence');
  // Creates a client
  const video = new Video.VideoIntelligenceServiceClient();

  /**
   * TODO(developer): Uncomment the following line before running the sample.
   */
  // const gcsUri = 'GCS URI of the video to analyze, e.g. gs://my-bucket/my-video.mp4';

  const request = {
    inputUri: gcsUri,
    features: ['TEXT_DETECTION'],
  };
  // Detects text in a video
  const [operation] = await video.annotateVideo(request);
  const results = await operation.promise();
  console.log('Waiting for operation to complete...');
  // Gets annotations for video
  const textAnnotations = results[0].annotationResults[0].textAnnotations;
github sararob / video-intelligence-demo / backend / index.js View on Github external
//     http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

const config = require('./local.json');
const Storage = require('@google-cloud/storage');
const storage = new Storage({
    projectId: config.cloud_project_id
});

const video = require('@google-cloud/video-intelligence');
const client = new video.VideoIntelligenceServiceClient({
    projectId: config.cloud_project_id,
    keyfileName: './keyfile.json'
});

const ffmpeg = require('fluent-ffmpeg');
const path = require('path');
const binPath = path.resolve(__dirname, 'ffmpeg');
const ffmpegPath = path.resolve(binPath, 'ffmpeg');
const ffprobePath = path.resolve(binPath, 'ffprobe');
const rimraf = require('rimraf');

ffmpeg.setFfmpegPath(ffmpegPath);
ffmpeg.setFfprobePath(ffprobePath);

const thumbnailBucket = storage.bucket(config.thumbnail_bucket);
const videoBucket = storage.bucket(config.video_bucket);
github googleapis / nodejs-video-intelligence / samples / analyze.js View on Github external
async function analyzeObjectTracking(path) {
  //[START video_object_tracking]
  // Imports the Google Cloud Video Intelligence library
  const Video = require('@google-cloud/video-intelligence');
  const fs = require('fs');
  const util = require('util');
  // Creates a client
  const video = new Video.VideoIntelligenceServiceClient();
  /**
   * TODO(developer): Uncomment the following line before running the sample.
   */
  // const path = 'Local file to analyze, e.g. ./my-file.mp4';

  // Reads a local video file and converts it to base64
  const file = await util.promisify(fs.readFile)(path);
  const inputContent = file.toString('base64');

  const request = {
    inputContent: inputContent,
    features: ['OBJECT_TRACKING'],
    //recommended to use us-east1 for the best latency due to different types of processors used in this region and others
    locationId: 'us-east1',
  };
  // Detects objects in a video
github googleapis / nodejs-video-intelligence / samples / analyze.js View on Github external
async function analyzeVideoTranscription(gcsUri) {
  // [START video_speech_transcription_gcs]
  // Imports the Google Cloud Video Intelligence library
  const videoIntelligence = require('@google-cloud/video-intelligence');

  // Creates a client
  const client = new videoIntelligence.VideoIntelligenceServiceClient();

  /**
   * TODO(developer): Uncomment the following line before running the sample.
   */
  // const gcsUri = 'GCS URI of video to analyze, e.g. gs://my-bucket/my-video.mp4';

  const videoContext = {
    speechTranscriptionConfig: {
      languageCode: 'en-US',
      enableAutomaticPunctuation: true,
    },
  };

  const request = {
    inputUri: gcsUri,
    features: ['SPEECH_TRANSCRIPTION'],
github googleapis / nodejs-video-intelligence / samples / analyze.js View on Github external
async function analyzeText(path) {
  //[START video_detect_text]
  // Imports the Google Cloud Video Intelligence library + Node's fs library
  const Video = require('@google-cloud/video-intelligence');
  const fs = require('fs');
  const util = require('util');
  // Creates a client
  const video = new Video.VideoIntelligenceServiceClient();

  /**
   * TODO(developer): Uncomment the following line before running the sample.
   */
  // const path = 'Local file to analyze, e.g. ./my-file.mp4';

  // Reads a local video file and converts it to base64
  const file = await util.promisify(fs.readFile)(path);
  const inputContent = file.toString('base64');

  const request = {
    inputContent: inputContent,
    features: ['TEXT_DETECTION'],
  };
  // Detects text in a video
  const [operation] = await video.annotateVideo(request);