whisper_functions.php
Table of Contents
Functions
- whisper_process_unprocessed() : int|false
- Processes all unprocessed audio/video resources supported by Whisper.
- whisper_process() : bool
- Converts a media file to audio, transcribes it using Whisper, and stores the transcript in a metadata field.
Functions
whisper_process_unprocessed()
Processes all unprocessed audio/video resources supported by Whisper.
whisper_process_unprocessed([int $size_limit = 0 ]) : int|false
This function:
- Prevents concurrent execution via process locking.
- Selects resources with supported file extensions that have not yet been transcribed.
- Invokes whisper_process() for each selected resource.
Parameters
- $size_limit : int = 0
-
The total size of files in GB to be processed in a batch, 0 = no limit
Return values
int|false —Returns the number of resources processed, or false if a process lock is active.
whisper_process()
Converts a media file to audio, transcribes it using Whisper, and stores the transcript in a metadata field.
whisper_process(int $resource) : bool
This function:
- Converts the original media file to mono, 16kHz WAV using ffmpeg.
- Runs Whisper transcription with an optional initial prompt.
- Saves the generated text into the configured resource field.
- Optionally adds a generated subtitle file as an alternative file.
- Marks the resource as processed by setting
whisper_processed = 1.
Parameters
- $resource : int
-
The resource ID to process.
Return values
bool —True on successful processing, false if any step fails.