jina.types.document.mixins.video module

class jina.types.document.mixins.video.VideoDataMixin[source]

Bases: object

Provide helper functions for Document to support video data.

load_uri_to_video_blob(only_keyframes=False)[source]

Convert a uri to a video ndarray blob.

Parameters

only_keyframes (bool) – only keep the keyframes in the video

Return type

~T

Returns

Document itself after processed

dump_video_blob_to_file(file, frame_rate=30, codec='h264')[source]

Save blob as a video mp4/h264 file.

Parameters
  • file (Union[str, BinaryIO]) – The file to open, which can be either a string or a file-like object.

  • frame_rate (int) – frames per second

  • codec (str) – the name of a decoder/encoder

Return type

~T

Returns

itself after processed

convert_uri_to_video_blob(**kwargs)