Connector Framework Server 23.2

# analyze_media_in_file

The function `analyze_media_in_file` performs media analysis on a file. If analysis is not successful, the function results in a Lua error.

## Syntax

    analyze_media_in_file(filename, params)

## Arguments

Argument | Description
--- | ---
`filename` | (string) The file to analyze.
`params` | (table) A table of named parameters to configure media analysis. The table maps parameter names (String) to parameter values. For information about the parameters that you can set, see the following table. For information about how to use named parameters refer to the Connector Framework Server Administration Guide.

## Named Parameters

Named Parameter | Description | Configuration Parameter
--- | --- | ---
`config_file` | (string) The path of a configuration file (relative to CFS) that CFS sends to Media Server when it requests media analysis. | MediaServerConfigurationFileName
`config_params` | (string table) A table of configuration parameters to send to OpenText Media Server. Any parameters that you specify override the same parameters in the configuration file specified by `config_file`. |
`request_parameters` | (table) Additional parameters to pass to the Media Server `process` action. |
`section` | (string) The name of a section in the CFS configuration file. If you set this then any parameters not set in the `params` table are read from this section of the configuration file. |
`server` | (table) A table of additional named parameters that configure communication with Media Server. The table maps parameter names (String) to parameter values. For information about the parameters that you can set, see the following table. |
`transform` | (string) The filename of an XSL transform. This is applied to the response from Media Server before the analysis results are returned. | MediaAnalysisTransform

## Media Server Settings

Named Parameter | Description | Configuration Parameter
--- | --- | ---
`section` | (string) The name of a section in the CFS configuration file. If you set this then any parameters not set in the `server` table are read from this section of the configuration file. If you do not set this parameter, the value of `section` from the `params` table is used. |
`host` | (string) The host name of the machine running Media Server. | MediaServerHost
`port` | (Number) The Media Server ACI port. | MediaServerHost
`sslSection` | (string) The name of a section in the CFS configuration file that contains settings for communicating with Media Server over SSL. | MediaServerSSLConfig
`readFromOriginalLocation` | (Boolean) A Boolean that specifies whether Media Server can read the media file from its original location. If you set this parameter to `true`, `sharedPath` is ignored. If you set neither this parameter nor `sharedPath`, CFS sends the media file to Media Server using an HTTP POST request. HTTP POST is not recommended for large files. | ReadFromOriginalLocation
`sharedPath` | (string) To transfer the file to Media Server through a shared folder, set this parameter to the path of the folder. Both CFS and Media Server must have access to this folder. If you set `readFromOriginalLocation` to `true`, this parameter is ignored. If you set neither this parameter nor `readFromOriginalLocation`, CFS sends the media file to Media Server using an HTTP POST request. HTTP POST is not recommended for large files. | MediaServerSharedPath

## Returns

(string). The XML returned from Media Server, after any specified XSL transform.

## Examples

The following Lua script performs analysis on a file named `video.mp4`, using the settings in the `[MediaServerSettings]` section of the CFS configuration file.

      local result = analyze_media_in_file("video.mp4",
            { section="MediaServerSettings" });

The following example runs OCR on an image file. It overrides some of the server settings and sets additional named parameters. It demonstrates how to parse the XML string returned from Media Server and add the information to the document metadata:

      function handler(document)
          local result = analyze_media_in_file("image.png",
          {
              section="MediaServerSettings",
              server={ host="localhost", port="14000" },
              transform="./xslt/mediaserver/ocr.xsl",
              config_file="./script_resources/mediaserver/ocr.cfg",
              config_params={ ["[Ingest]IngestEngine"]="Image" }
          });

          local parsed_xml = parse_xml(result)
          document:insertXmlWithoutRoot(parsed_xml:root())

          -- Add content to document content
          local content = { parsed_xml:XPathValues("//document/DRECONTENT") }
          for k,v in pairs(content) do
              document:appendContent(v)
          end

          return true;
      end

For complete example Lua scripts, Media Server configurations, and XSL transforms, see the folders `scripts/mediaserver`, `script_resources/mediaserver`, and `xslt/mediaserver`, in the CFS installation directory.

Copyright 2023 Open Text
Version 23.2 | Last updated March 2023

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL Connector Framework Server 23.2

Topic Title: analyze_media_in_file