Skip to content

Latest commit

 

History

26 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rio Archive Viewer Plugins

Overview

If a namespace has Archive Viewer enabled, every time an object is archived or found by indexing, Rio will search for a plugin that matches its file extension

Example: myMovie.mp4 will fire the plugin script associated with mp4.

Plug-in Workflow

Several options can scripted in an AV Plugin:

  1. Generate/register a Proxy (low-resolution video for identification and partial restore if enabled).
  2. Generate/register a Thumbnail (small image for identification in tabular data or poster in video player).
  3. Generate/Register a Preview (larger than a thumbnail but typically lower resolution static image) for preview display.
  4. Generate/Register a Sidecar/Sprites (grid of small frames) to support quick search/scrubbing of video timelines.
  5. Metadata generation and association (attach metadata generated by media utilities or AI).
  6. Generate/register Transcription (speech text) for preview display.

Rio functions and values

Several methods and parameters are passed in to the script from Rio. Rio methods

Available Libraries

Packages in lib are added to the Lua classpath and are available in scripts:

local rio_utils = require("rio_utils")
local json = require("dkjson")

User libraries need to be loaded of the server filesystem.

local my_lib = assert(loadfile("/user/rio/lua/lib/my_lib.lua"))()

Available methods / API

User-configuration Schema

The script's schema allows users to set parameters without accessing Lua code.

Return a valid JSON string in function schema()

local json = require("dkjson")

plugin = {}

function plugin.schema()
  return json.encode({
    -- AWS analysis
      { key = "frames_to_sample",           type = "integer", default = 10,       min = 1, max = 30,   label = "Frames to Sample" },
      { key = "max_tags_per_frame",         type = "integer", default = 20,       min = 1, max = 50,   label = "Max Tags per Frame" },
      { key = "aws_confidence_threshold",   type = "number",  default = 90,       min = 0, max = 100,  label = "AWS Confidence Threshold (%)" },
      { key = "do_transcription",           type = "boolean", default = true,                          label = "Enable Transcription" },
      { key = "do_aws_labels",              type = "boolean", default = true,                          label = "AWS Label Detection" },
      { key = "do_aws_celebrities",         type = "boolean", default = true,                          label = "AWS Celebrity Recognition" },
      { key = "do_aws_faces",               type = "boolean", default = false,                         label = "AWS Face Detection" },
      { key = "do_aws_text",                type = "boolean", default = false,                         label = "AWS Text Detection" },
      { key = "do_aws_moderation",          type = "boolean", default = false,                         label = "AWS Content Moderation" },
      -- Proxy / thumbnail
      { key = "proxy_format",   type = "enum",    default = "mp4",    choices ={"mp4", "webm"}, label = "Proxy Format" },
      { key = "proxy_codec",    type = "enum",    default = "libx264", choices ={"libx264", "libx265", "libvpx-vp9"}, label = "Video Codec" },
      { key = "thumbnail_size", type = "enum",    default = "320x180", choices ={"320x180", "640x360", "1280x720"}, label = "Thumbnail Size" },
      { key = "thumbnail_dpi",  type = "integer", default = 72,                                         label = "Thumbnail DPI" },
      { key = 's3_bucket' ,     type = 'string',  required = 'true',                                    label = 'Temp AWS S3 Bucket' },
  })
end

A form will be rendered in the Rio interface under Plugins

The values set by the user are passed in to execute() as a Map named settings

function plugin.execute()
    rio:log_info("Executing plugin using: " .. tostring(settings.s3_bucket))
end

Example Scripts

Example scripts are located in examples to support different workflows and tools.

Test Harness

Scripts can be tested outside of Rio using the test harness.

Build from source:

$ cd test_harness 
$ ./gradlew -q runLua -PluaScript=../examples/video_aws.lua -PluaInput=test1.mxf  -PluaSettings=settings-overrides.json

Download executable jar from Releases:

$ java -jar build/libs/plugin_test_harness-all.jar video_ollama.lua  -PluaInput=test2.mp4

(Or convenience script/BAT):

./runme.sh examples/pdf.lua test3.pdf

About

Archive View Processing Plugins for Rio MediaEngine

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages