项目作者: jaypajji4444

项目描述 :
Nodejs wrapper for Microsoft's Azure's Video Indexer API
高级语言: JavaScript
项目地址: git://github.com/jaypajji4444/Video_Indexing_Nodejs.git
创建时间: 2020-05-06T17:43:08Z
项目社区:https://github.com/jaypajji4444/Video_Indexing_Nodejs

开源协议:MIT License

下载


Video_Indexing_Nodejs

Nodejs wrapper for Microsaft Azure’s Video Indexer API

Features

  • Upload Videos though URL to Microsoft’s Video Indexer API.
  • Get Insights about the video
  • Get Information about Sentimenta, faces , Characters ,transcipts
  • Captions from videos
  • Thumbnails of videos in “JPEG” or “Base64” .
  • Error handling.

    (More Functionality To Be Added Soon-under development)

Loading and configuring the module

  1. // CommonJS
  2. const VideoIndexer = require('./Video_indexer/index');
  3. // ES Module
  4. import VideoIndexer from './Video_indexer/index';

Prerequisite

Before Starting to use need you will need to get and store the belowe mentioned stuffs:
1) Login to https://api-portal.videoindexer.ai/developer and get the Subscription Key
2) Go to https://www.videoindexer.ai/settings/account and get the Account Id and loacation
3) Store the keys somewhere.

Usage

1) Initialization

  1. // Basic configuration
  2. const Subscription_Key="Your-subscription-key";
  3. const Account_Id="Your-Azure's-account-Id";
  4. const Location="Your-location(Example:'trail')"
  5. // Instantation
  6. const vi = new VideoIndexer(Subscription_Key ,Account_Id ,Location)

2) Uploading Video :

Any video can can be uploaded through its URL. After Successfull upload ,promise iis returned which can be resolved to get videoId . This Id received can be used to get other information from video.

Note:

Only HTTPS Video URL is supported (HTML or any other types are not supported)

  1. // Uploading video
  2. vi.upload_video_to_indexer({
  3. videoUrl:"Url(https) of the video to upload" // Compulsory,
  4. language:"English or any other", // Optional(Default:"English"),
  5. name:"video-name" // Optional
  6. })
  7. .then(res=>{
  8. console.log("Video Id:",res.videoId)
  9. })
  10. .catch(err=>{
  11. console.log(err.response.data)
  12. })

3) Getting Video Indexing Information

  1. // Getting info
  2. vi.get_video_index({
  3. videoId:"Uploaded video's Id", // Required
  4. language: "English or any other", // Default : English
  5. })
  6. .then(data=>{
  7. console.log(data)
  8. // Processing Progress :
  9. console.log(data.videos[0].processingProgress)// 80% ..100%
  10. })
  11. .catch(err=>{
  12. console.log(err.response.data)
  13. })

Note :Insights won’t be generated untill video is processed completely(In case uploading and getting index are called back to back).

4) Getting video captions:

  1. vi.get_video_caption({
  2. videoId:"Uploaded video's Id", // Required
  3. format:"vtt or txt or csv or srt " // Default: vtt
  4. language: "English or any other", // Default : English
  5. })
  6. .then(res=>{
  7. console.log(res.data)
  8. })
  9. .catch(err=>{
  10. console.log(err.response.data)
  11. })

5) Getting video Thumbnails:

  1. vi.get_video_thumbnails({
  2. videoId:"Uploaded video's Id", // Required
  3. format:" jpeg || base64" // Default:jpeg
  4. })
  5. .then(res=>{
  6. console.log(res.data)
  7. })
  8. .catch(err=>{
  9. console.log(err.response.data)
  10. })