Process procedure

Official Content
This documentation is valid for:

Sends a video to be processed in order to be analyzed later by Analyze procedure. This task is performed asynchronously due to the processing latency.

Parameters

Configuration

The following table resumes the configuration properties (access credentials) you must set in order to use this AI task.

Property   Amazon WS Baidu AI  Google Cloud AI IBM Watson  Microsoft Azure  SAP Leonardo Tencent AI
Key - 视频内容分析 Video Intelligence API  Video Indexer   - -
SecretKey - 视频内容分析   - - - -
Account - - - - From Azure Connect  - -

Sample

This section describes two alternatives for processing a video: synchronously or asynchronously. Once processed, you can get the analysis made by the provider. In other words, you need to use both Process and Analyze tasks.

Synchronous processing

The way you process a video synchronously is by polling for the processing status. The example below shows how you can do it.

&callbackObject = "" // It's not necessary to indicate a callback object for this strategy
&VideoId = GeneXusAI.Video.Process(&video,&locale,&callbackObject,&Messages) 
if &Messages.Count > 0 
  <process_errors>
else
   do while True
      &outputAnalysis = GeneXusAI.Video.Analyze(&videoId,&provider,&Messages) // Polling
      if &outputAnalysis.Completed OR &Messages.Count > 0 
         exit // Exit from the loop
      endIf
     &x = Sleep(30) // Wait 30 seconds until poll again
   endDo
   if &Messages.Count > 0
       <process_errors> 
   else
       <analyze_result>
   endIf
endIf

Note that for large video files this strategy may take a long time. Consider using asynchronous strategy in these cases.

Asynchronous processing

The way you process a video asynchronously is by indicating a callback-object to this task.

For example, you can write a code as follows:

&callbackObject = VideoHandler.link("") // It gets the object name mantaining a reference to it
&VideoId = GeneXusAI.Video.Process(&video,&locale,&callbackObject,&Messages)
if &Messages.Count > 0
   <process_errors>
endIf

Where VideoHandler is a Procedure object defined as follows:

Rules:
   parm(in:&videoId); // Mandatory :: video identifier
Source:
   &provider = <your_provider_settings>
   &OutputAnalysis = GeneXusAI.Video.Analyze(&videoId,&provider,&Messages)
   if &Messages.Count > 0
       <process_errors>
   else
       <analyze_result>
   endIf

Alternatively, instead of getting the analysis in this object, you can send a notification and call the Analyze procedure on a Panel for Web or Smart Devices. This can be done by using Server.Socket external object for Web, or Notification Provider API for Smart Devices.

Warning: For testing your asynchronous solution, your application must be accessible for the external provider (e.g. your IP must be remotely accessible, or you can host your application on a real server -- Deploy To Cloud option can be a good alternative).

Notes

  • For the asynchronous strategy, the callback-object must include a Parm rule with the incoming video identifier.
    parm(in:&videoId);
    Where &videoId is a VarChar(128) variable.
  • Microsoft Cognitive Services:
    • To get the Key/Account, please refer to this document.
    • Despite no region is filled up on the 'Faces' field items (top, left, width, height fields are zero -- or empty), you will have a property with 'thumbnail' key whose value is a cropped image of the identified face.
  • Baidu AI:
    • Only supports synchronous mode (not callback-url is available).

Scope

Platforms  Web(.NET,.NETCore,Java), SmartDevices(Android,iOS)
Connectivity  Online

Availability

This procedure is available as of GeneXus 16 upgrade 1.

See also

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.