How to use the @google-cloud/video-intelligence.StreamingVideoIntelligenceServiceClient 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-streaming-labels.js View on Github external
async function main(path = 'YOUR_LOCAL_FILE') {
  // [START video_streaming_label_detection_beta]
  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  // const path = 'Local file to analyze, e.g. ./my-file.mp4';
  const {
    StreamingVideoIntelligenceServiceClient,
  } = require('@google-cloud/video-intelligence').v1p3beta1;
  const fs = require('fs');

  // Instantiates a client
  const client = new StreamingVideoIntelligenceServiceClient();
  // Streaming configuration
  const configRequest = {
    videoConfig: {
      feature: 'STREAMING_LABEL_DETECTION',
    },
  };
  const readStream = fs.createReadStream(path, {
    highWaterMark: 5 * 1024 * 1024, //chunk size set to 5MB (recommended less than 10MB)
    encoding: 'base64',
  });
  //Load file content
  const chunks = [];
  readStream
    .on('data', chunk => {
      const request = {
        inputContent: chunk.toString(),
github googleapis / nodejs-video-intelligence / samples / analyze-streaming-object.js View on Github external
async function main(path = 'YOUR_LOCAL_FILE') {
  // [START video_streaming_object_tracking_beta]
  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  // const path = 'Local file to analyze, e.g. ./my-file.mp4';
  const {
    StreamingVideoIntelligenceServiceClient,
  } = require('@google-cloud/video-intelligence').v1p3beta1;
  const fs = require('fs');

  // Instantiates a client
  const client = new StreamingVideoIntelligenceServiceClient();
  // Streaming configuration
  const configRequest = {
    videoConfig: {
      feature: 'STREAMING_OBJECT_TRACKING',
    },
  };
  const readStream = fs.createReadStream(path, {
    highWaterMark: 5 * 1024 * 1024, //chunk size set to 5MB (recommended less than 10MB)
    encoding: 'base64',
  });
  //Load file content
  const chunks = [];
  readStream
    .on('data', chunk => {
      const request = {
        inputContent: chunk.toString(),
github googleapis / nodejs-video-intelligence / samples / analyze-streaming-safe-search.js View on Github external
async function main(path = 'YOUR_LOCAL_FILE') {
  // [START video_streaming_explicit_content_detection_beta]
  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  // const path = 'Local file to analyze, e.g. ./my-file.mp4';
  const {
    StreamingVideoIntelligenceServiceClient,
  } = require('@google-cloud/video-intelligence').v1p3beta1;
  const fs = require('fs');

  // Instantiates a client
  const client = new StreamingVideoIntelligenceServiceClient();
  // Streaming configuration
  const configRequest = {
    videoConfig: {
      feature: 'STREAMING_EXPLICIT_CONTENT_DETECTION',
    },
  };

  const readStream = fs.createReadStream(path, {
    highWaterMark: 5 * 1024 * 1024, //chunk size set to 5MB (recommended less than 10MB)
    encoding: 'base64',
  });
  //Load file content
  const chunks = [];
  readStream
    .on('data', chunk => {
      const request = {
github googleapis / nodejs-video-intelligence / samples / analyze-streaming-shot-change.js View on Github external
async function main(path = 'YOUR_LOCAL_FILE') {
  // [START video_streaming_shot_change_detection_beta]
  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  // const path = 'Local file to analyze, e.g. ./my-file.mp4';
  const {
    StreamingVideoIntelligenceServiceClient,
  } = require('@google-cloud/video-intelligence').v1p3beta1;
  const fs = require('fs');

  // Instantiates a client
  const client = new StreamingVideoIntelligenceServiceClient();
  // Streaming configuration
  const configRequest = {
    videoConfig: {
      feature: 'STREAMING_SHOT_CHANGE_DETECTION',
    },
  };
  const readStream = fs.createReadStream(path, {
    highWaterMark: 5 * 1024 * 1024, //chunk size set to 5MB (recommended less than 10MB)
    encoding: 'base64',
  });
  //Load file content
  const chunks = [];
  readStream
    .on('data', chunk => {
      const request = {
        inputContent: chunk.toString(),
github googleapis / nodejs-video-intelligence / samples / analyze-streaming-annotation-to-storage.js View on Github external
async function main(path = 'YOUR_LOCAL_FILE', outputUri = 'PATH_TO_OUTPUT') {
  // [START video_streaming_annotation_to_storage_beta]
  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  // const path = 'Local file to analyze, e.g. ./my-file.mp4';
  // const outputUri = 'Path to output, e.g. gs://path_to_output';

  const {
    StreamingVideoIntelligenceServiceClient,
  } = require('@google-cloud/video-intelligence').v1p3beta1;
  const fs = require('fs');

  // Instantiates a client
  const client = new StreamingVideoIntelligenceServiceClient();
  // Streaming configuration
  const configRequest = {
    videoConfig: {
      feature: 'STREAMING_LABEL_DETECTION',
      storageConfig: {
        enableStorageAnnotationResult: true,
        annotationResultStorageDirectory: outputUri,
      },
    },
  };
  const readStream = fs.createReadStream(path, {
    highWaterMark: 5 * 1024 * 1024, //chunk size set to 5MB (recommended less than 10MB)
    encoding: 'base64',
  });
  //Load file content
  const chunks = [];
github googleapis / nodejs-video-intelligence / samples / analyze-streaming-automl-classification.js View on Github external
) {
  // [START video_streaming_automl_classification_beta]
  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  // const path = 'Local file to analyze, e.g. ./my-file.mp4';
  // const modelId = 'autoMl model'
  // const projectId = 'Your GCP Project'

  const {
    StreamingVideoIntelligenceServiceClient,
  } = require('@google-cloud/video-intelligence').v1p3beta1;
  const fs = require('fs');

  // Instantiates a client
  const client = new StreamingVideoIntelligenceServiceClient();

  // Streaming configuration
  const modelPath = `projects/${projectId}/locations/us-central1/models/${modelId}`;
  const configRequest = {
    videoConfig: {
      feature: 'STREAMING_AUTOML_CLASSIFICATION',
      automlClassificationConfig: {
        modelName: modelPath,
      },
    },
  };

  const readStream = fs.createReadStream(path, {
    highWaterMark: 5 * 1024 * 1024, //chunk size set to 5MB (recommended less than 10MB)
    encoding: 'base64',
  });