Skip to content

IVideoIndexer

Namespace: VideoCataloger

Type: Interface

VideoIndexer interface.

Definition

public interface IVideoIndexer

Methods

Method Description
CaptureSingleFrame(long, double) Capture an a frame at the provided time. This function will queue a capture of a given frame if a capture is in progress.
CaptureSingleFrameToFile(long, double, string) Capture an a frame at the provided time to a jpeg file. This function will queue a capture of a given frame if a capture is in progress.
AddVideoFile(string, string, string, string) Add a video file in the queue to be indexed.
AddFolder(string, bool, bool) Scan a folder of videos in the queue to be indexed.
StartIndexing() Start processing the index queue.
StopIndexing() Request that indexing stops. The remaining queue is kept, so indexing can be resumed with StartIndexing.
SetIndexingCallbacks(IVideoIndexerCallbacks) Set callback interface implementation
SetTranscription(long, string) Set transcription from an srt file. If there already is a transcription for the video it will be replaced.
TranscribeFromAudio(long, string) Queue a video to be transcribed from a separate audio file instead of its own audio.
ReadMetadata(long) Queue a video to have its metadata read from the file again, without capturing thumbnails.

CaptureSingleFrame

Capture an a frame at the provided time. This function will queue a capture of a given frame if a capture is in progress.

void CaptureSingleFrame(long video_id, double current_video_play_pos)

Parameters:

Name Type Description
video_id Int64 Id of video to capture from
current_video_play_pos Double Seconds from the start where we want to capture

CaptureSingleFrameToFile

Capture an a frame at the provided time to a jpeg file. This function will queue a capture of a given frame if a capture is in progress.

void CaptureSingleFrameToFile(long video_id, double current_video_play_pos, string output_file)

Parameters:

Name Type Description
video_id Int64 Id of video to capture from
current_video_play_pos Double Seconds from the start where we want to capture
output_file String Path to where to save the file.

AddVideoFile

Add a video file in the queue to be indexed.

void AddVideoFile(string path, string title = "", string url = "", string desc = "")

Parameters:

Name Type Description
path String Path to the video file to be added. Please use windows paths and remember you need to use // to get a / in a C# string.
title String optional title of the video file
url String optional url for the video file.
desc String option desc for the videoe.

AddFolder

Scan a folder of videos in the queue to be indexed.

void AddFolder(string folder, bool include_subfolders, bool skip_added)

Parameters:

Name Type Description
folder String Path to the folder to scan.
include_subfolders Boolean Scan subfolders for videos.
skip_added Boolean Ignore videos already in the catalog.

StartIndexing

Start processing the index queue.

If a call to AddFolder or AddVideoFile is still scanning when you call this, the request is remembered and indexing starts as soon as that scan has finished. That means AddFolder followed directly by StartIndexing works as expected — you do not have to wait between the two calls.

void StartIndexing()

StopIndexing

Request that indexing stops. Videos that have already been indexed stay in the catalog and the remaining queue is kept, so indexing can be resumed with StartIndexing. Does nothing if indexing is not running.

void StopIndexing()

SetIndexingCallbacks

Set callback interface implementation

void SetIndexingCallbacks(IVideoIndexerCallbacks callbacks = null)

Parameters:

Name Type Description
callbacks VideoCataloger.IVideoIndexerCallbacks Object implementing the IVideoindexerCallbacks interface. Call with null to clear any previously set callbacks

SetTranscription

Set transcription from an srt file. If there already is a transcription for the video it will be replaced.

void SetTranscription(long video_id, string path)

Parameters:

Name Type Description
video_id Int64 Id of video that will get the loaded transcript.
path String Path to the srt file to be used for transcription. Please use windows paths and remember you need to use // to get a / in a C# string.

TranscribeFromAudio

Queue a video to be transcribed (speech-to-text) from a separate audio file instead of its own audio, for sound recorded apart from the picture. This is the same as choosing an audio file with Add in the transcript window. The transcript is stored on the video and replaces any transcript it had.

Like indexing it is queued: the call returns at once and the transcription runs from the index queue, with the speech-to-text model and Spoken language set in the preferences. The transcript times are those of the audio file, so if the recorder was started at a different moment than the camera, the lines are shifted by the difference.

void TranscribeFromAudio(long video_id, string audio_path)

Parameters:

Name Type Description
video_id Int64 Id of a video in the catalog.
audio_path String Path to the audio file to transcribe, for example a .wav or .mp3. A video file works too.

Example:

// Transcribe every selected video from the .wav file with the same name beside it.
var catalog = scripting.GetVideoCatalogService();
var indexer = scripting.GetVideoIndexer();
foreach (long id in scripting.GetSelection().GetSelectedVideos())
{
    string video = scripting.GetUtilities().ConvertToLocalPath(catalog.GetVideoFileEntry(id).FilePath);
    string wav = System.IO.Path.ChangeExtension(video, ".wav");
    if (System.IO.File.Exists(wav))
        indexer.TranscribeFromAudio(id, wav);
}

ReadMetadata

Queue a video to have its metadata read from the file again, without capturing thumbnails. This is the same as Index > Re-read metadata in the program, and like indexing it is queued: the call returns at once and the video is processed from the index queue.

The .nfo file, MediaInfo, Windows file properties and XMP metadata are read as ticked under Extract metadata from in the Video Indexer preferences. A title, description, link or rating that differs in the file replaces the catalog's, keywords in the file are added, and extended properties are set. Nothing is cleared: an empty value in the file leaves the catalog as it is, and keywords or properties removed from the file stay in the catalog. A video id that is not in the catalog is ignored.

void ReadMetadata(long video_id)

Parameters:

Name Type Description
video_id Int64 Id of a video in the catalog.