module documentation

FiftyOne Server JIT metadata utilities

Copyright 2017-2025, Voxel51, Inc.

Class MediaType Undocumented
Class Reader Asynchronous file-like reader.
Exception FFmpegNotFoundException Exception raised when FFmpeg or FFprobe cannot be found.
Exception MetadataException Exception raised when metadata for a media file cannot be computed.
Async Function get_image_dimensions Gets the dimensions of an image from its file-like asynchronous byte stream.
Async Function get_metadata Gets the metadata for the given local media file.
Async Function get_stream_info Returns a eta.core.video.VideoStreamInfo instance for the provided video path.
Async Function read_metadata Calculates the metadata for the given local media path.
Variable logger Undocumented
Function _create_media_urls Undocumented
Function _get_additional_media_fields Undocumented
Constant _ADDITIONAL_MEDIA_FIELDS Undocumented
Constant _FFPROBE_BINARY_PATH Undocumented
async def get_image_dimensions(input): (source)

Gets the dimensions of an image from its file-like asynchronous byte stream.

Parameters
inputfile-like object with async read and seek methods
Returns
the (width, height)
async def get_metadata(collection: SampleCollection, sample: dict, media_type: str, metadata_cache: dict[str, dict[str, str]], url_cache: dict[str, str]): (source)

Gets the metadata for the given local media file.

Parameters
collection:SampleCollectionUndocumented
sample:dictUndocumented
media_type:strthe file's media type
metadata_cache:dict[str, dict[str, str]]Undocumented
url_cache:dict[str, str]Undocumented
metadata:Nonea pre-existing metadata dict to use if possible
filepaththe path to the file
Returns
metadata dict
async def get_stream_info(path): (source)

Returns a eta.core.video.VideoStreamInfo instance for the provided video path.

Parameters
patha video filepath
Returns
a eta.core.video.VideoStreamInfo
async def read_metadata(filepath, is_video): (source)

Calculates the metadata for the given local media path.

Parameters
filepatha filepath
is_videowhether the file is a video
Returns
dict

Undocumented

def _create_media_urls(collection: SampleCollection, sample: dict, sample_media_type: str, cache: dict, additional_fields: list[str] | None = None, opm_field: str | None = None, detections_fields: list[str] | None = None) -> dict[str, str]: (source)

Undocumented

def _get_additional_media_fields(collection: SampleCollection) -> list[str]: (source)

Undocumented

_ADDITIONAL_MEDIA_FIELDS = (source)

Undocumented

Value
{fol.Detection: 'mask_path',
 fol.Detections: 'mask_path',
 fol.Heatmap: 'map_path',
 fol.Segmentation: 'mask_path',
 OrthographicProjectionMetadata: 'filepath',
 RrdFile: 'filepath'}
_FFPROBE_BINARY_PATH = (source)

Undocumented

Value
shutil.which('ffprobe')